Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module SUMATOR_PROPAGAT_8_BIT(cin,cout,s,x,y);
- input cin;
- input x;
- input y;
- output reg cout;
- output reg s;
- always @(x or y) begin
- {cout,s}=x+y+cin;
- end
- endmodule
- module TEST_SUMATOR_PROPAGAT_8_BIT;
- reg cin;
- reg [7:0] x;
- reg [7:0] y;
- wire[7:0] s;
- wire cout;
- wire c01, c12, c23, c34, c45, c56, c67;
- TEST_SUMATOR_PROPAGAT_8_BIT zero(.cin(cin),.cout(c01),.s(s[0]),.x(x[0]),.y(y[0]));
- TEST_SUMATOR_PROPAGAT_8_BIT unu(.cin(c01),.cout(c12),.s(s[1]),.x(x[1]),.y(y[1]));
- TEST_SUMATOR_PROPAGAT_8_BIT doi(.cin(c12),.cout(c23),.s(s[2]),.x(x[2]),.y(y[2]));
- TEST_SUMATOR_PROPAGAT_8_BIT trei(.cin(c23),.cout(c34),.s(s[3]),.x(x[3]),.y(y[3]));
- TEST_SUMATOR_PROPAGAT_8_BIT patru(.cin(c34),.cout(c45),.s(s[4]),.x(x[4]),.y(y[4]));
- TEST_SUMATOR_PROPAGAT_8_BIT cinci(.cin(c45),.cout(c56),.s(s[5]),.x(x[5]),.y(y[5]));
- TEST_SUMATOR_PROPAGAT_8_BIT sase(.cin(c56),.cout(c67),.s(s[6]),.x(x[6]),.y(y[6]));
- TEST_SUMATOR_PROPAGAT_8_BIT sapte(.cin(c67),.cout(cout),.s(s[7]),.x(x[7]),.y(y[7]));
- initial begin
- #5 cin=1'b0;x=8'h20;y=8'h30;
- #5 cin=0'b0;x=8'h25;y=8'h30;
- #5 cin=0'b0;x=8'h36;y=8'h75;
- #5 cin=0'b0;x=8'h54;y=8'h43;
- #5 cin=0'b0;x=8'h42;y=8'h34;
- #5 cin=0'b0;x=8'h86;y=8'h76;
- #5 cin=0'b0;x=8'h43;y=8'h56;
- #5 cin=0'b0;x=8'h76;y=8'h24;
- #5 $finish;
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement