Professional Documents
Culture Documents
Important Instructions
Important Instructions
Important Instructions
HARSH MALPANI…………………………………………………………………………………………………………………………..
Affiliation (Institution/Company):
Email: hmalpani5@gmail.com………………………………………………………………
Phone: 9110012673…………………………………………………….
Important Instructions:
1) All assignment results should be computer screenshot or computer typed. Handwritten and
scanned copies shall not be considered for evaluation
2) Due date for all assignment submission is 1 Week from the last date of internship
3) All assignment questions should be captured along with solutions/answers.
4) Code snippets, simulation results should be captured properly
5) Use only the JPEG image format for capturing the simulation results and name/label the results
appropriately.
6) The description of answers should be short and crisp. Provide only the required information,
answered copied or cut and pasted from google shall not be considered.
input [3:0]d1,d2 ;
always@(posedge clk)
begin
if(ld)
begin
a<=d1;
b<=d2;
end
else
begin
a<=a>>1;
a[3]<=sum;
b<=b>>1;
b[3]<=b[0];
end
end
endmodule
FULL ADDER
module fulladder( a ,b,cin,sum,cout);
input a,b,cin;
output sum,cout;
assign { cout,sum}=a+b+cin;
Endmodule
input clk,in ;
output out;
reg out;
always@(posedge clk )
begin
out<=in;
end
endmodule
input [3:0]d1,d2;
input ld,clk;
output cout,sum;
wire cin;
wire [3:0]a,b ;
Dff B(clk,cout,cin);
fulladder C( a ,b,cin,sum,cout);
endmodule
TEST BENCH
module bit4serialadd_tb;
reg [3:0]d1,d2;
reg clk,ld;
wire cout,sum;
initial
begin
clk=1'b0;
ld=1'b0;
end
always #5 clk=~clk;
initial
begin
ld=1'b1;
d1=4'b1111;
d2=4'b1111;
#10 ld=1'b0;
end
initial
endmodule