Codiode

Variable Indexed Part Select

MediumVerilog / SystemVerilogBuild1 solved

Picking byte i out of a 64-bit word is a mux with eight inputs. Verilog's +: part select writes it in one line instead of an eight-way case.

This module acts as a dynamic byte extractor. It receives a 64-bit data word and a 3-bit index. The index dictates which 8-bit segment of the input word is routed to the output. An index of 0 selects the least significant byte (bits 7 down to 0). An index of 7 selects the most significant byte (bits 63 down to 56). The extraction must be implemented using Verilog's indexed part-select operator to infer the multiplexing logic efficiently.

This is a purely combinational circuit. There are no clocks, resets, or sequential elements. The output must update immediately when either the data or the index changes.

Signal Direction Width Description
data_in input 64 The full 64-bit input data word
byte_idx input 3 The 0-indexed byte position to extract
byte_out output 8 The extracted 8-bit data

Constraints

  • The circuit must be purely combinational.
  • The byte_idx input ranges from 0 to 7.
  • The output must reflect the exact 8-bit segment corresponding to the index.

Topics

MultiplexersData RoutingPart Select

Solve this problem

Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against the problem's testbench. You get the waveform back, not a stored answer.

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

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.

Part of Combinational RTL

Problem 10 of 15 in the Combinational RTL track.

Related problems

Browse all problems · Verilog practice problems · Learning tracks

Solve this on a laptopSend yourself the link and continue there.