Codiode

Basic Vector Concatenation

EasyVerilog / SystemVerilogBuildFree24 solved

Status registers pack several 1-bit flags into one word so software can read them in a single access. The { } operator does the packing.

Combine four individual 1-bit input flags into a single 4-bit output vector. The output status_bus must map flag_a to bit 3 (the most significant bit), flag_b to bit 2, flag_c to bit 1, and flag_d to bit 0 (the least significant bit).

This is a purely combinational circuit. The output must reflect the current inputs immediately without any clock or reset synchronization.

Signal Direction Width Description
flag_a input 1 Flag mapped to MSB (bit 3)
flag_b input 1 Flag mapped to bit 2
flag_c input 1 Flag mapped to bit 1
flag_d input 1 Flag mapped to LSB (bit 0)
status_bus output 4 Concatenated status word

Constraints

  • The output status_bus must be driven combinationally.
  • The bit ordering must exactly match the specification with flag_a mapped to the MSB.
  • Do not use sequential logic.

Topics

combinationalsyntaxbus

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.

Free to solve. A Codiode account keeps your progress.

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 Verilog Syntax and Language Basics

Problem 16 of 25 in the Verilog Syntax and Language Basics track.

Related problems

Browse all problems · Verilog practice problems · Learning tracks

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