Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question

 

*How to compare the output waveform produced by both structural and behavioural models

*how to explain the waveform of both structural and behavioural models related to the coding

*how to explain both structural and behavioural models coding execute and work (add some comments)

Structural Module Model:

structural module code:

module adder1(A,B,Cin,Sum,Cout);

  input [3:0] A, B;

  input Cin;

  output [3:0] Sum;

  output Cout;

  

  wire C0, C1, C2;

  

  fulladder M1(A[0], B[0], Cin, Sum[0], C0);

  fulladder M2(A[1], B[1], C0, Sum[1], C1);

  fulladder M3(A[2], B[2], C1, Sum[2], C2);

  fulladder M4(A[3], B[3], C2, Sum[3], Cout);

  

endmodule

module fulladder (A, B, Cin, Sum, Cout);

  input A, B, Cin;

  output Sum, Cout;

  

  wire n1, n2 ,x1;

  xor u1 (x1, A, B);

  xor u2 (Sum, x1, Cin);

  and u3(n1, Cin, x1);

  and u4(n2, A, B);

  or u5(Cout, n1, n2);

  

endmodule

Testbench code for structural module code:

module adder1_tb();

timeunit 1us;

timeprecision 100ns;

reg[3:0] A, B;

reg Cin;

reg[3:0] Sum;

reg Cout;

adder1 u1(A, B, Cin, Sum, Cout);

initial

  begin

    $dumpfile("dump.vcd");

    $dumpvars(0, adder1_tb.u1);

     A=4'b1010; B=4'b0101; Cin=0;

    #10 A=4'b0011; B=4'b1101; Cin=1;

    #10 A=4'b1111; B=4'b1111; Cin =0;

    #10 $finish;

  end

endmodule

 

 

behavioural module code:

module adder2(A, B, Cin, Sum, Cout);

  input [3:0] A, B;

  input Cin;

  output [3:0] Sum;

  output Cout;

  

  assign {Cout, Sum} = A + B + {3'b0, Cin};

  

endmodule

 

Testbench for behavioural module code:

module adder2_tb();

  timeunit 1us;

  timeprecision 100ns;

  

  reg [3:0] A, B;

  reg Cin;

  reg [3:0] Sum;

  reg Cout;

  

  adder2 u1(A, B, Cin, Sum, Cout);

  

  initial

  begin

    $dumpfile("dump.vcd"); //To save the waveforms

    $dumpvars(0, adder2_tb.u1); //To save the waveforms

         A=4'b1010; B=4'b0101; Cin=0;

      #10 A=4'b0011; B=4'b1101; Cin=1;

      #10 A=4'b1111; B=4'b1111; Cin=0;

      #10 $finish;

  end

endmodule

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