Updated ALU code with updated 2**width approach and assigned temporary pins to ASU (Q3)
This commit is contained in:
1 parent
5acf1c8b87
commit
dc32347c9b
212 files changed
+8657
-71
No files matched your search
+6
-6
@@ -1,13 +1,13 @@
|
||||
`include "asu.v"
|
||||
`include "lu.v"
|
||||
`include "asu.sv"
|
||||
`include "lu.sv"
|
||||
|
||||
// flags[0:0] = Cout
|
||||
// flags[1:1] = Overflow
|
||||
module alu #(width=8)(input logic [3:0] op,
|
||||
input logic [width-1:0] A, input logic [width-1:0] B.
|
||||
output logic [width-1:0] OUT_1, output logic flags[1:0]);
|
||||
module alu #(parameter width=2)(input logic [3:0] op,
|
||||
input logic [2**width-1:0] A, input logic [2**width-1:0] B,
|
||||
output logic [2**width-1:0] OUT_1, output logic flags[1:0]);
|
||||
|
||||
logic [width-1:0] asu_out;
|
||||
logic [2**width-1:0] asu_out;
|
||||
logic [1:0] asu_flags;
|
||||
logic [0:0] asu_op;
|
||||
asu #(width) adder_unit(asu_op, A, B, asu_out, asu_flags[0], asu_flags[1]);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
`include "asu.v"
|
||||
`include "lu.v"
|
||||
|
||||
// flags[0:0] = Cout
|
||||
// flags[1:1] = Overflow
|
||||
module alu #(width=8)(input logic [3:0] op,
|
||||
input logic [width-1:0] A, input logic [width-1:0] B.
|
||||
output logic [width-1:0] OUT_1, output logic flags[1:0]);
|
||||
|
||||
logic [width-1:0] asu_out;
|
||||
logic [1:0] asu_flags;
|
||||
logic [0:0] asu_op;
|
||||
asu #(width) adder_unit(asu_op, A, B, asu_out, asu_flags[0], asu_flags[1]);
|
||||
|
||||
logic [width-1:0] lu_out;
|
||||
lu #(width) logic_unit(op[1:0], A, B, lu_out);
|
||||
|
||||
// Cout = asu_flags[0]
|
||||
// Overflow = asu_flags[0] ^ asu_flags[1]
|
||||
endmodule
|
||||
Reference in new issue
Block a user