Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write an instantiation for this verilog code ( calling in main ) module Add _ 1 6 ( input [ 1 5 : 0 ]

write an instantiation for this verilog code(calling in main) module Add_16(
input [15:0] A,
input [15:0] B,
input C,
output [15:0] Sum,
output Cout
);
wire [15:0] T;
assign T[0]= C;
FullAdder FA0(.A(A[0]),.B(B[0]),.Cin(T[0]),.Sum(Sum[0]),.Cout(T[1]));
FullAdder FA1(.A(A[1]),.B(B[1]),.Cin(T[1]),.Sum(Sum[1]),.Cout(T[2]));
FullAdder FA2(.A(A[2]),.B(B[2]),.Cin(T[2]),.Sum(Sum[2]),.Cout(T[3]));
FullAdder FA3(.A(A[3]),.B(B[3]),.Cin(T[3]),.Sum(Sum[3]),.Cout(T[4]));
FullAdder FA4(.A(A[4]),.B(B[4]),.Cin(T[4]),.Sum(Sum[4]),.Cout(T[5]));
FullAdder FA5(.A(A[5]),.B(B[5]),.Cin(T[5]),.Sum(Sum[5]),.Cout(T[6]));
FullAdder FA6(.A(A[6]),.B(B[6]),.Cin(T[6]),.Sum(Sum[6]),.Cout(T[7]));
FullAdder FA7(.A(A[7]),.B(B[7]),.Cin(T[7]),.Sum(Sum[7]),.Cout(T[8]));
Ful...
module FullAdder (A,B,Cin,Sum, Cout);
input A;
input B;
input Cin;
output Sum;
output Cout;
assign Sum=(A^B^Cin);
assign Cout =((A&B)|(B&Cin)|(A&Cin));
endmodule
module shift_left(
input [7:0] B,
input [2:0] j,
output reg [7:0] result
);
integer k;
always @* begin
// Shift A to the left by i bits
result =8'b0;
for (k =0; k <8; k = k +1) begin
if ((k + j)<8)
result[k + j]= B[k];
end
end
endmodule
module shift_right (A , i , R );
input [7:0]A;
input [3:0]i;
output reg [7:0]R;
always @(A or i)
begin
case (i)
3'b000: R <= A;
3'b001: R <={1'b0,A[7:1]};
3'b010: R <={2'b0,A[7:2]};
3'b011: R <={3'b0,A[7:3]};
3'b100: R <={4'b0,A[7:4]};
3'b101: R <={5'b0,A[7:5]};
3'b110: R <={6'b0,A[7:6]};
3'b111: R <={7'b0,A[7]};
endcase
end
endmodule
module Multiplier (a,b,p);
input [7:0] a,b;
wire [15:0] m0,m1,m2,m3,m4,m5,m6,m7;
wire [15:0] s1,s2,s3,s4,s5,s6,s7;
output [15:0] p;
wire [7:0]C;
assign m0={1'b0,{8{a[0]}}} & b[7:0];
assign m1={1'b0,{8{a[1]}}} & b[7:0];
assign m2={1'b0,{8{a[2]}}} & b[7:0];
assign m3={1'b0,{8{a[3]}}} & b[7:0];
assign m4={1'b0,{8{a[4]}}} & b[7:0];
assign m5={1'b0,{8{a[5]}}} & b[7:0];
assign m6={1'b0,{8{a[6]}}} & b[7:0];
assign m7={1'b0,{8{a[7]}}} & b[7:0];
Add_16 ad0( m0,{m1,1'b0},1'b0, s1, C[0]);
Add_16 ad1( s1,{m2,{2{1'b0}}}, C[0], s2, C[1]);
Add_16 ad2( s2,{m3,{3{1'b0}}}, C[1], s3, C[2]);
Add_16 ad3( s3,{m4,{4{1'b0}}}, C[2], s4, C[3]);
Add_16 ad4( s4,{m5,{5{1'b0}}}, C[3], s5, C[4]);
Add_16 ad5( s5,{m6,{6{1'b0}}}, C[4], s6, C[5]);
Add_16 ad6( s6,{m7,{7{1'b0}}}, C[5], s7, C[6]);
assign p=s7;
endmodule
module FullAdder8Bits(
input [7:0] A,
input [7:0] B,
input C,
output [7:0] Sum,
output Cout
);
wire [7:0] T;
assign T[0]= C;
FullAdder FA0(.A(A[0]),.B(B[0]),.Cin(T[0]),.Sum(Sum[0]),.Cout(T[1]));
FullAdder FA1(.A(A[1]),.B(B[1]),.Cin(T[1]),.Sum(Sum[

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

Students also viewed these Databases questions

Question

For one mole of van der Waals gas (a) Show that (U/V)T=a/V2

Answered: 1 week ago