Question: What is the value in count if input sel = 1 0 after the third rising edge of clock based on the following Verilog code:

What is the value in count if input sel=10 after the third rising edge of clock based on the following Verilog code:
module Stest(
input wire clk, input wire [1:0] sel, output reg out =0);
integer count=0;
always @ (posedge clk) begin
count = count +1;
case (sel)
0 : out = ~out;
1 : if (count ==2) begin
out = ~out;
count =0;
end
2 : if (count ==4) begin
out = ~out;
count =0;
end
3 : if (count ==8) begin
out = ~out;
count =0;
end
default: count =0;
endcase
end
endmodule
The answer can be 1,2,3,or 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Electrical Engineering Questions!