Archived
1
0

creation of an ALU

This commit is contained in:
Erick
2022-03-04 01:39:07 +01:00
parent 52c7210d0c
commit 613178fc34
4 changed files with 49 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
'include "cpu/alu/halfadder.sv"
module adder (
output sum_bit,
output carry_bit,
input a,
input b,
input c
);
halfadder halfadd(tmpXor0, tmpAnd0, a, b);
xor sum_final(sum_bit, tmpXor0, c);
and carry_tmp0(tmpAnd1, tmpXor0, c);
or carry_final(carry_bit, tmpAnd0, tmpAnd1);
endmodule
+20
View File
@@ -0,0 +1,20 @@
'include "cpu/alu/adder.sv"
module adder16 (
output [15:0]sum_bit,
output [15:0]carry_bit
input [15:0]a,
input [15:0]b,
input [15:0]c,
);
halfadder(tmpXor0, tmpAnd0, a, b)
xor sum_final(sum_bit, tmpXor0, c);
and carry_tmp0(tmpAnd1, tmpXor0, c);
or carry_final(carry_bit, tmpAnd0, tmpAnd1);
endmodule
+11
View File
@@ -0,0 +1,11 @@
module halfadder (
output sum_bit,
output carry_bit,
input a,
input b
);
xor sum_g(sum_bit, a, b);
and carry_g(carry_bit, a, b);
endmodule
View File