summaryrefslogtreecommitdiff
path: root/rtl/core
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-10-23 23:43:37 -0600
committerAlejandro Soto <alejandro@34project.org>2022-10-23 23:43:37 -0600
commit0374ac313e850d2356e36bd42df59846df3111f7 (patch)
treebf41d22bbf3fcec3a87c7ff780f42b20ba0c45b6 /rtl/core
parent642f1480854fa60c71dd06cb57c29fee0b3504e9 (diff)
Pack general control signals as struct datapath_decode
Diffstat (limited to 'rtl/core')
-rw-r--r--rtl/core/arm810.sv8
-rw-r--r--rtl/core/control/control.sv16
-rw-r--r--rtl/core/decode/decode.sv32
-rw-r--r--rtl/core/uarch.sv9
4 files changed, 35 insertions, 30 deletions
diff --git a/rtl/core/arm810.sv b/rtl/core/arm810.sv
index f804061..266832f 100644
--- a/rtl/core/arm810.sv
+++ b/rtl/core/arm810.sv
@@ -29,19 +29,15 @@ module arm810
.*
);
+ datapath_decode dec;
branch_decode dec_branch;
snd_decode dec_snd;
data_decode dec_data;
ldst_decode dec_ldst;
- logic dec_execute, dec_conditional, dec_undefined, dec_writeback, dec_update_flags;
core_decode decode
(
- .execute(dec_execute),
- .conditional(dec_conditional),
- .undefined(dec_undefined),
- .writeback(dec_writeback),
- .update_flags(dec_update_flags),
+ .ctrl(dec),
.branch_ctrl(dec_branch),
.snd_ctrl(dec_snd),
.data_ctrl(dec_data),
diff --git a/rtl/core/control/control.sv b/rtl/core/control/control.sv
index 238b353..7cfb80c 100644
--- a/rtl/core/control/control.sv
+++ b/rtl/core/control/control.sv
@@ -3,11 +3,7 @@
module core_control
(
input logic clk,
- dec_execute,
- dec_undefined,
- dec_conditional,
- dec_writeback,
- dec_update_flags,
+ input datapath_decode dec,
input branch_decode dec_branch,
input data_decode dec_data,
input snd_decode dec_snd,
@@ -82,7 +78,7 @@ module core_control
assign next_bubble =
(final_writeback && final_rd == `R15)
- || ((dec_update_flags || dec_conditional) && (final_update_flags || update_flags))
+ || ((dec.update_flags || dec.conditional) && (final_update_flags || update_flags))
|| (final_writeback && ((dec_data.uses_rn && (final_rd == dec_data.rn || dec_data.rn == `R15))
|| final_rd == dec_snd.r || dec_snd.r == `R15));
@@ -175,7 +171,7 @@ module core_control
bubble <= next_bubble;
- if(dec_execute & ~next_bubble) begin
+ if(dec.execute & ~next_bubble) begin
branch <= dec_branch.branch;
branch_target <= next_pc_visible + dec_branch.offset;
@@ -207,13 +203,13 @@ module core_control
mem_write <= !dec_ldst.load;
final_rd <= dec_data.rd;
- final_writeback <= dec_writeback;
- final_update_flags <= dec_update_flags;
+ final_writeback <= dec.writeback;
+ final_update_flags <= dec.update_flags;
end
update_flags <= final_update_flags;
writeback <= final_writeback;
- undefined <= dec_undefined;
+ undefined <= dec.undefined;
rd <= final_rd;
pc <= fetch_insn_pc;
diff --git a/rtl/core/decode/decode.sv b/rtl/core/decode/decode.sv
index da244c1..2740b70 100644
--- a/rtl/core/decode/decode.sv
+++ b/rtl/core/decode/decode.sv
@@ -3,20 +3,25 @@
module core_decode
(
- input word insn,
- input psr_flags flags,
-
- output logic execute,
- conditional,
- undefined,
- writeback,
- update_flags,
- output branch_decode branch_ctrl,
- output snd_decode snd_ctrl,
- output data_decode data_ctrl,
- output ldst_decode ldst_ctrl
+ input word insn,
+ input psr_flags flags,
+
+ output datapath_decode ctrl,
+ output branch_decode branch_ctrl,
+ output snd_decode snd_ctrl,
+ output data_decode data_ctrl,
+ output ldst_decode ldst_ctrl
);
+ logic execute, undefined, conditional, writeback, update_flags, branch;
+
+ assign ctrl.execute = execute;
+ assign ctrl.undefined = undefined;
+ assign ctrl.conditional = conditional;
+ assign ctrl.writeback = writeback;
+ assign ctrl.update_flags = update_flags;
+ assign branch_ctrl.branch = branch;
+
//TODO
logic restore_spsr;
@@ -43,8 +48,7 @@ module core_decode
.*
);
- logic branch, branch_link;
- assign branch_ctrl.branch = branch;
+ logic branch_link;
core_decode_branch group_branch
(
diff --git a/rtl/core/uarch.sv b/rtl/core/uarch.sv
index d1bdce8..3e4a470 100644
--- a/rtl/core/uarch.sv
+++ b/rtl/core/uarch.sv
@@ -59,6 +59,15 @@ typedef logic[4:0] psr_mode;
typedef struct packed
{
+ logic execute,
+ undefined,
+ conditional,
+ writeback,
+ update_flags;
+} datapath_decode;
+
+typedef struct packed
+{
alu_op op;
reg_num rn,
rd;