Day 13

Muxes

Day 13

Design a one-hot mux using the following language constructs:

Construct
Ternary Operator
Case statement
If else block
Combinatorial For loop
And-or tree

Interface Definition

The module should have the following interface:

input     wire[3:0] a_i,
input     wire[3:0] sel_i,

// Output using ternary operator
output    wire     y_ter_o,
// Output using case
output    logic     y_case_o,
// Ouput using if-else
output    logic     y_ifelse_o,
// Output using for loop
output    logic     y_loop_o,
// Output using and-or tree
output    logic     y_aor_o

Assume that sel_i is a one-hot signal

Coding Exercise

You're expected to code both the RTL and testbench for the problem. Your testbench should include the stimulus and checkers.

NOTE

The testcase will show PASSED as long as the RTL and testbench compile, but it doesn't imply that the implemented logic is correct.

If you're interested in learning more about RTL Design and don't want to worry about implementing the checks or the testbench code then I'd recommend the Hands-on RTL Design course. The course contains 25 RTL Design problems to help improve your design skills and comes with a 2-part video solution for every problem.

Loading the interactive workspace...