please help me code a working testbench with comments

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

This is a HDL code for the state machine below, please help me code a working testbench with comments for better understanding for this structural module. The diagrams provided are the state diagrams and logic circuit diagrams for this circuit/module. I will rate 5 star for this pls tq

module dsd_assignment_structural_s (

input clk, x, clr, //setting input clock, x and clear/reset

output [2:0] Q, Qbar, //setting output Q, Qbar and Z

output z);

 

wire j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, dclk; //wire connecting the circuit

 

Clk_div_s #(.div_value(29999999)) ip5(

.clk(clk),

.divided_clk(dclk)); //run clock division command

 

Dflipflop A0 (j9, dclk, clr, Q[2], Qbar[2]);

Dflipflop A1 (j10, dclk, clr, Q[1], Qbar[1]);

Dflipflop A2 (~x, dclk, clr, Q[0], Qbar[0]); //Use the D Flip Flop command to link the inputs and

                                                                         //wires

and G0 (j0, Q[2], Qbar[1]);

and G1 (j1, Q[2], Qbar[1], ~x);

and G2 (j2, Q[2], Q[0], x);

and G3 (j3, Qbar[2], Q[1], Qbar[0], x);

and G4 (j4, Qbar[2], Q[1], Q[0], ~x); //AND the variables according to transition eqn & circuit diag.

 

and G5 (j5, Q[1], Qbar[0], ~x);

and G6 (j6, Q[1], Q[0], x);

and G7 (j7, Qbar[1], Qbar[0], x);

and G8 (j8, Qbar[1], Q[0], ~x); //AND the variables together according to transition eqn & circuit

                                                      //diagram

or G9 (j9, j0, j1, j2, j3, j4);

or G10 (j10, j5, j6, j7, j8);  //OR the variables together according to transition eqn & circuit

                                                      //diagram


assign z=Q[2]&Q[1];

 

endmodule

 

 

module Dflipflop(input D, clk, reset, output reg Q, Qp);  //coding D Flip Flop to be used above

 

always @(posedge clk or negedge reset) begin //operate when clock is 1 or reset is 0

                if (~reset) begin //if reset = 0

                Q<=0; //force Q=0

                Qp<=1; end //force Q=1

               

                else begin //if reset = 1

                Q<=D; //set Q = D

                Qp<=~D; end //set Q = D*

end

endmodule

               

X=1
Z=1
X=0
Z=0
A
000
E
001
X=0
Z=1
X=1
Z=0
X=1
Z=0
X=0
Z=0
X=0
Z=0
B
010
F
011
X=1
Z=0
X=1
Z=0
↑
X=0
Z=0
с
100
X=0 X=1
Z=0
Z=0
Figure 1
G
101
X=1
Z=0
个
X=0
Z=0
D
Ⓡ
110
X=0
Z=1
H
111
X=1
Z=1
Transcribed Image Text:X=1 Z=1 X=0 Z=0 A 000 E 001 X=0 Z=1 X=1 Z=0 X=1 Z=0 X=0 Z=0 X=0 Z=0 B 010 F 011 X=1 Z=0 X=1 Z=0 ↑ X=0 Z=0 с 100 X=0 X=1 Z=0 Z=0 Figure 1 G 101 X=1 Z=0 个 X=0 Z=0 D Ⓡ 110 X=0 Z=1 H 111 X=1 Z=1
D
S2
$1
S2
SO
X'
X
SO'
$2
$1
SO
X"
$1
SO'
X'
$1
$1'
TTTT
SO'
$1'
,SO'
U6
AND2
Us Us
AND3
AND3
U9
AND4
U10
AND4
U11
AND3
U12
AND3.
U13
AND3
U14
AND3
....2 ..... ........
U3
OR5
S2SI'+S2SO'X'+S
2S0X+S2'S1S0'X
+S2'S1S0X':
U4
15
AA
1kHz
OR4
Sis0'X'+S1S0X+S1'SO'X+S1'SOX'
*SET
ELK
........
D_FF
SO
SET
RESET
SET
REAKT
D_FF
S2
.D_FF
$1
:Z
AND2
S2
Transcribed Image Text:D S2 $1 S2 SO X' X SO' $2 $1 SO X" $1 SO' X' $1 $1' TTTT SO' $1' ,SO' U6 AND2 Us Us AND3 AND3 U9 AND4 U10 AND4 U11 AND3 U12 AND3. U13 AND3 U14 AND3 ....2 ..... ........ U3 OR5 S2SI'+S2SO'X'+S 2S0X+S2'S1S0'X +S2'S1S0X': U4 15 AA 1kHz OR4 Sis0'X'+S1S0X+S1'SO'X+S1'SOX' *SET ELK ........ D_FF SO SET RESET SET REAKT D_FF S2 .D_FF $1 :Z AND2 S2
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY