summaryrefslogtreecommitdiff
path: root/nandgame/logic_unit.sv
diff options
context:
space:
mode:
Diffstat (limited to 'nandgame/logic_unit.sv')
-rw-r--r--nandgame/logic_unit.sv3
1 files changed, 3 insertions, 0 deletions
diff --git a/nandgame/logic_unit.sv b/nandgame/logic_unit.sv
index 32b9691..93cb399 100644
--- a/nandgame/logic_unit.sv
+++ b/nandgame/logic_unit.sv
@@ -14,11 +14,14 @@ module logic_unit #(
output logic [(DATA_WIDTH-1):0] RES
);
+// learning: instead of this nested ternary...
// assign RES = operation == LOGIC_AND ? (X & Y) :
// operation == LOGIC_OR ? (X | Y) :
// operation == LOGIC_XOR ? (X ^ Y) :
// operation == LOGIC_NEGT ? (~X) : 0;
+// ... you can do this:
+
always_comb begin
case (operation)
LOGIC_AND: RES = X & Y;