Question
Need help with filling out the rest of this code! on the design and half adder thanks! //This is the testbench `timescale 1ns/100ps module RippleCarry4Tester();
Need help with filling out the rest of this code! on the design and half adder thanks!
//This is the testbench
`timescale 1ns/100ps module RippleCarry4Tester(); reg cin; reg [3:0] a,b; wire [3:0] s; wire cout; RippleCarry4 r(cin,a,b,s,cout); integer i; initial begin //dump waves $dumpfile("dump.vcd"); $dumpvars(1); cin = 0 for(i = 0; i
//This is the design
`timescale 1ns/100ps `include "fulladder.v" module RippleCarry4(input cin, input [3:0] a, b, output [3:0] s, output cout); wire cout0, cout1, cout2; fulladder fa0(a[0], ,cin, cout0, s[0]), fa1( , b[1], cout0, , s[1]), fa2(a[2], ,cout1, , ), fa3( , , cout2, cout, s[3]); endmodule
//This is the half adder
`timescale 1ns/100ps module halfadder(input a,b, output c,s); xor x1( ); and a1( ); endmodule
//This is the full adder
`timescale 1ns/100ps `include "halfadder.v" module fulladder(input a,b,cin, output cout, s); wire carrygenerate, carrypropagate, sum1; halfadder ha0(a,b,carrygenerate, sum1), ha1(sum1, cin, carrypropagate, s); or o1(cout, carrygenerate, carrypropagate); endmodule
If everything works correctly then the following console output will be produced 017 05 design. sv testbench.sv && unbuffer vvp a. out ./fulladder.v:3: warning: timescale for fulladder inherited from another file. /halfadder.v:l: ...: The inherited timescale is here. design. sv:3: warning: timescale for RippleCarry4 inherited from another file. ./halfadder.v:1: ...: The inherited timescale is here. VCD info: dumpfile dump.vcd opened for output. cout -o a-0, b- 9, s- 9, a-6, b-3, s-9, cout a-0, b-13, s 13, cout-0 a-6, b-5, s 11, cout-0 1,b 2,s 3, Finding VCD file... /dump. vcd 2017-03-05 2:05 Opening EPWave... If everything works correctly then the following console output will be produced 017 05 design. sv testbench.sv && unbuffer vvp a. out ./fulladder.v:3: warning: timescale for fulladder inherited from another file. /halfadder.v:l: ...: The inherited timescale is here. design. sv:3: warning: timescale for RippleCarry4 inherited from another file. ./halfadder.v:1: ...: The inherited timescale is here. VCD info: dumpfile dump.vcd opened for output. cout -o a-0, b- 9, s- 9, a-6, b-3, s-9, cout a-0, b-13, s 13, cout-0 a-6, b-5, s 11, cout-0 1,b 2,s 3, Finding VCD file... /dump. vcd 2017-03-05 2:05 Opening EPWave
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started