Codiode

Basic Replication Operator

MediumVerilog / SystemVerilogBuild2 solved

Broadcasting one bit across a bus, as in sign extension, is {N{bit}} in Verilog. Writing the copies out by hand is where off-by-one mistakes come from.

This module takes a single input bit and duplicates it to form an 8-bit output vector. When the input is a logical zero, the output becomes all zeros. When the input is a logical one, the output becomes all ones.

The circuit is purely combinational. There is no clock or reset signal. The output must update immediately when the input changes.

Signal Direction Width Description
in_bit input 1 Single bit to be replicated
out_vec output 8 Eight-bit vector containing the replicated input bit

Constraints

  • The design must be purely combinational logic
  • The output out_vec must consist exactly of the in_bit repeated eight times
  • No sequential elements or flip-flops are permitted

Topics

CombinationalVerilog SyntaxOperators

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

Problem 19 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.