Question: module TestBench ( ) ; reg inp _ 0 , reset, present _ 0 2 3 , CLK; wire [ 1 5 : 0 ]
module TestBench;
reg inp reset, present CLK;
wire : out;
Main DUTout CLK inp reset, present;
always begin
#
CLK ;
#
CLK ;
end
initial begin
inp;
reset ;
present;
#
$displayoutb out;
#
$displayoutb out;
$finish;
end
endmodule
module Mainout CLK inp reset, present;
output : out;
input inp reset, present CLK;
wire andout, Q Q Q Q Q Q Q Q Q Q Q xorout, Q Q xorout, Q xorout, Q Q ;
wire : Splittercmb;
assign andout inp & CLK;
DflipFlop Q andout, xorout, reset, present;
assign Splittercmb Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q ;
assign out Splittercmb;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, present;
DflipFlop Q andout, Q reset, present;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, ;
assign xorout Q xorout;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, ;
assign xorout Q xorout;
DflipFlop Q andout, Q reset, ;
assign xorout Q Q ;
DflipFlop Q andout, Q reset, ;
DflipFlop Q andout, Q reset, ;
endmodule
module DflipFlopq qinv, clk d arst pre, en;
parameter WIDTH ;
output reg WIDTH: q qinv;
input clk arst pre, en;
input WIDTH: d;
always @ posedge clk or posedge arst
if arst begin
q b;
qinv b;
end else if en ;
else begin
q d;
qinv ~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 signal must be integrated into the reset if
statement
e Run a simulation to generate 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
