CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Combinational Logic

ROM Inference via Case

MediumVerilog / SystemVerilogBuild

Digital signal processing pipelines often require small lookup tables for trigonometric functions. When these tables are shallow, mapping them to distributed logic rather than dedicated block RAM saves routing resources and prevents pipeline stalls.

The module acts as an asynchronous read only memory containing a 16-sample sine wave. It receives a 4-bit address representing the phase index and outputs the corresponding 8-bit amplitude. The output must react immediately to any change in the address input using purely combinational logic.

The memory must contain the following exact values for each address:

  • addr = 0: data = 128
  • addr = 1: data = 176
  • addr = 2: data = 218
  • addr = 3: data = 246
  • addr = 4: data = 255
  • addr = 5: data = 246
  • addr = 6: data = 218
  • addr = 7: data = 176
  • addr = 8: data = 128
  • addr = 9: data = 79
  • addr = 10: data = 38
  • addr = 11: data = 9
  • addr = 12: data = 0
  • addr = 13: data = 9
  • addr = 14: data = 38
  • addr = 15: data = 79

| Signal | Direction | Width | Description | |--------|-----------|-------|-------------| | addr | input | 4 | Phase index for the lookup table | | data | output | 8 | Amplitude value corresponding to the phase index; purely combinational |

Constraints

  • The circuit must be purely combinational with no clock or reset dependencies
  • All 16 possible input addresses must map to the exact specified integer values
  • The design must not infer latches; all branches must be explicitly defined

Topics

MemoryCombinational LogicDSPSynthesis Intuition

Solve this problem

Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against a real testbench — you get the waveform back, not a stored answer.

This problem is part of Codiode Pro. The statement above is free to read.

Sign in to solveSee what Pro unlocks

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Related problems

  • Single Continuous AssignmentEasy
  • Basic Vector ConcatenationEasy
  • Ternary Operator MuxEasy
  • Underscores for ReadabilityEasy
  • Left Hand Side ConcatenationEasy
  • Inout Port MechanicsEasy
  • Explicit Binary LiteralsEasy
  • Vector Port EndiannessEasy

Browse all problems · Learning tracks