Question: Design and implement a 8 - bit resetable up count, that stops counting when max is reached. The ports are: module counter ( output u
Design and implement a bit resetable up count, that stops counting when max is reached. The ports are:
module counter output ut count, input ut max,
input logic clk reset;
The ut type is defined in the test bench. count is the counter's output. The counter should increment by one for even positive edge clock until the max is reached. The counter should not increment when max is reached. The counter is reset if reset when a positive edge clock occurs.
The bit comparator module, cmp must be used to check when max is reached. The test bench will set max to for its testing.
include cmp module
module cmpoutput logic yes, input ut a b ;
logic : temp;
assign temp ~a b;
assign temp ~a b;
assign temp ~a b;
assign temp ~a b;
assign temp ~a b;
assign temp ~a b;
assign temp ~a b;
assign temp ~a b;
assign yes temp & temp & temp & temp & temp & temp & temp & temp;
endmodule
module counter output ut count, input ut max,
input logic clk reset;
logic mtest;
assign mtestb;
cmp test
yesmtest
acount
bmax
;
complete the rest
alwaysff @posedge clk or posedge reset begin
if reset begin
count b;
end else begin
mtest ~mtest;
if testyes && count max && count begin
count count b;
end
end
end
endmodule
typedef logic : ut;
module main;
ut count;
logic clk reset;
logic passfail;
ut expected, max;
integer cycles;
task clockcycleinteger n;
repeat n begin
clk ; #;
clk ; #;
end
endtask
counter dut count, max, clk reset ;
initial begin
max ;
expected ;
cycles ;
passfail ;
clk ;
reset ; clockcycle; reset ;
for cycles ; cycles max; cycles cycles begin
if count expected begin
$display "failed: countd expectedd count,expected;
passfail ;
end
expected expected ;
clockcycle;
end
clockcycle;
if count max begin
$display "failed: countd maxd count,max;
passfail ;
end
if passfail $display
Test passed";
else $display
Test failed";
end
endmodule
RTL Control of miniALU
Error Output
module.v:: error: Unresolved netuwire mtest cannot have multiple drivers.
module.v:: error: Output port expression must support continuous assignment.
module.v:: : Port yes of cmp is connected to mtest
module.v:: error: mtest Unable to assign to unresolved wires.
errors during elaboration.
solve the error so that it can provide the expected output
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
