Answered step by step
Verified Expert Solution
Question
1 Approved Answer
` ttimescale 1 ns / 1 ps module tb ( ) ; reg clk = 0 ; wire [ 2 : 0 ] floor; reg
ttimescale ns ps
module tb;
reg clk ;
wire : floor;
reg rst ;
reg : buttonvalue ;
reg buttonpressed ;
reg error ;
initial begin
rst;
@posedge clk;
rst;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
buttonvalue ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
buttonvalue ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
buttonvalue ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
buttonvalue ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
buttonvalue ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
@posedge clk;
if floor begin error ; $display: Expected Floor ; end
buttonpressed ;
if error $display Your elevator FAILED the test!";
else $display Your elevator PASSED the test!";
$finish;
end
elevator dut
iclkclk
irstrst
ibuttonpressedbuttonpressed
ibuttonvaluebuttonvalue
ofloorfloor
;
always # clk ~clk;
endmodule
testbench code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started