aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAugustin Fabre <augustin@augfab.fr>2019-12-29 14:24:36 +0100
committerAugustin Fabre <augustin@augfab.fr>2019-12-29 14:24:55 +0100
commit44d2a99e55373d696ce362355f9d1c9e2499956c (patch)
tree2124772cf2c193a045f28ad10a1a7fc221f0e1c3
parent176918dedd0c88ad369131dbcaca750293ca66be (diff)
downloadminimal-cpu-44d2a99e55373d696ce362355f9d1c9e2499956c.tar.gz
minimal-cpu-44d2a99e55373d696ce362355f9d1c9e2499956c.tar.bz2
minimal-cpu-44d2a99e55373d696ce362355f9d1c9e2499956c.tar.xz
Define opcode enum inside the module
-rw-r--r--logical/cpu.sv21
1 files changed, 11 insertions, 10 deletions
diff --git a/logical/cpu.sv b/logical/cpu.sv
index 7bd4b47..c738b06 100644
--- a/logical/cpu.sv
+++ b/logical/cpu.sv
@@ -1,5 +1,16 @@
`ifndef CPU_
`define CPU_
+module cpu (
+ input wire clk_i,
+ input wire nrst_i,
+
+ input wire [7:0] data_i,
+
+ output wire we_o,
+ output wire [5:0] addr_o,
+ output wire [7:0] data_o
+);
+
typedef enum logic [1:0] {
NOR = 2'b00,
ADD = 2'b01,
@@ -15,16 +26,6 @@ typedef enum logic [2:0] {
CLEAR_CARRY
} state_t;
-module cpu (
- input wire clk_i,
- input wire nrst_i,
-
- input wire [7:0] data_i,
-
- output wire we_o,
- output wire [5:0] addr_o,
- output wire [7:0] data_o
-);
state_t state_q;
logic [5:0] pc_q; // Program counter.