Question: module TestBench ( ) ; reg inp _ 0 , reset, present _ 0 2 3 , CLK; wire [ 1 5 : 0 ]

module TestBench();
reg inp_0, reset, present_023, CLK;
wire [15:0] out_0;
Main DUT0(out_0, CLK, inp_0, reset, present_023);
always begin
#10
CLK =0;
#10
CLK =1;
end
initial begin
inp_0=0;
reset =0;
present_023=0;
#15
$display("out_0=%b", out_0);
#10
$display("out_0=%b", out_0);
$finish;
end
endmodule
*/
module Main(out_0, CLK, inp_0, reset, present_023);
output [15:0] out_0;
input inp_0, reset, present_023, CLK;
wire and_0_out, \0_Q ,\1_Q ,\2_Q ,\3_Q ,\4_Q ,\5_Q ,\6_Q ,\7_Q ,\8_Q ,\9_Q ,\10_Q , xor_2_out, \11_Q ,\12_Q , xor_1_out, \13_Q , xor_0_out, \14_Q ,\15_Q ;
wire [15:0] Splitter_0_cmb;
assign and_0_out = inp_0 & CLK;
DflipFlop \0(\0_Q ,, and_0_out, xor_2_out, reset, present_023,);
assign Splitter_0_cmb ={\15_Q ,\14_Q ,\12_Q ,\13_Q ,\11_Q ,\10_Q ,\9_Q ,\8_Q ,\7_Q ,\6_Q ,\5_Q ,\4_Q ,\3_Q ,\2_Q ,\1_Q ,\0_Q };
assign out_0= Splitter_0_cmb;
DflipFlop \1(\1_Q ,, and_0_out, \0_Q , reset, ,);
DflipFlop \2(\2_Q ,, and_0_out, \1_Q , reset, present_023,);
DflipFlop \3(\3_Q ,, and_0_out, \2_Q , reset, present_023,);
DflipFlop \4(\4_Q ,, and_0_out, \3_Q , reset, ,);
DflipFlop \5(\5_Q ,, and_0_out, \4_Q , reset, ,);
DflipFlop \6(\6_Q ,, and_0_out, \5_Q , reset, ,);
DflipFlop \7(\7_Q ,, and_0_out, \6_Q , reset, ,);
DflipFlop \8(\8_Q ,, and_0_out, \7_Q , reset, ,);
DflipFlop \9(\9_Q ,, and_0_out, \8_Q , reset, ,);
DflipFlop \10(\10_Q ,, and_0_out, \9_Q , reset, ,);
assign xor_2_out =\10_Q ^ xor_1_out;
DflipFlop \11(\11_Q ,, and_0_out, \10_Q , reset, ,);
DflipFlop \12(\12_Q ,, and_0_out, \11_Q , reset, ,);
assign xor_1_out =\12_Q ^ xor_0_out;
DflipFlop \13(\13_Q ,, and_0_out, \12_Q , reset, ,);
assign xor_0_out =\13_Q ^\15_Q ;
DflipFlop \14(\14_Q ,, and_0_out, \13_Q , reset, ,);
DflipFlop \15(\15_Q ,, and_0_out, \14_Q , reset, ,);
endmodule
module DflipFlop(q, q_inv, clk, d, a_rst, pre, en);
parameter WIDTH =1;
output reg [WIDTH-1:0] q, q_inv;
input clk, a_rst, pre, en;
input [WIDTH-1:0] d;
always @ (posedge clk or posedge a_rst)
if (a_rst) begin
q <='b0;
q_inv <='b1;
end else if (en ==0) ;
else begin
q <= d;
q_inv <= ~d;
end
endmodule
Separate out the design file and the testbench file so you can simulate the circuit using
the EDA playground.
c. You will need to edit the testbench and write code to toggle the reset and preset and
enable the clock.
d. You will need to edit the design file so that the DD flipflop works the same as it does in
CircuitVerse (code to use the preset_023 signal must be integrated into the reset if
statement).
e. Run a simulation to generate 10 numbers
f. Hand in your list of numbers in both binary and hexadecimal format.
g. Hand in a timing diagram of your simulation

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 Databases Questions!