Updated Q2 project and LU code such that it operates properly on the board. Changed to utilising a case statement for easier readability and also compiled and tested the code on the board.
This commit is contained in:
1 parent
32eea036a8
commit
2208eb4f16
101 files changed
+4341
-10
No files matched your search
+12
-8
@@ -1,12 +1,16 @@
|
||||
module lu #(width=8) (
|
||||
module lu #(parameter width = 2) (
|
||||
input logic [1:0] op,
|
||||
input logic [width-1:0] A, input logic [width-1:0] B,
|
||||
output logic [width-1:0] OUT_1);
|
||||
|
||||
input logic [2**width-1:0] A,
|
||||
input logic [2**width-1:0] B,
|
||||
output logic [2**width-1:0] Y);
|
||||
|
||||
always_comb begin
|
||||
if (op == 2'b00) OUT_1 = A & B;
|
||||
else if (op == 2'b01) OUT_1 = A | B;
|
||||
else if (op == 2'b10) OUT_1 = A ^ B;
|
||||
else if (op == 2'b10) OUT_1 = ~(A | B);
|
||||
case (op)
|
||||
2'b00: Y = A & B;
|
||||
2'b01: Y = A | B;
|
||||
2'b10: Y = A ^ B;
|
||||
2'b11: Y = ~(A | B);
|
||||
default: Y = '0;
|
||||
endcase
|
||||
end
|
||||
endmodule
|
||||
Reference in new issue
Block a user