summaryrefslogtreecommitdiff
path: root/rtl/core/control/select.sv
diff options
context:
space:
mode:
Diffstat (limited to 'rtl/core/control/select.sv')
-rw-r--r--rtl/core/control/select.sv48
1 files changed, 48 insertions, 0 deletions
diff --git a/rtl/core/control/select.sv b/rtl/core/control/select.sv
new file mode 100644
index 0000000..a073e24
--- /dev/null
+++ b/rtl/core/control/select.sv
@@ -0,0 +1,48 @@
+`include "core/uarch.sv"
+
+module core_control_select
+(
+ input logic clk,
+
+ input data_decode dec_data,
+ input snd_decode dec_snd,
+
+ input ctrl_cycle cycle,
+ next_cycle,
+ input logic issue,
+ mem_ready,
+ pop_valid,
+ input reg_num popped,
+ final_rd,
+
+ output reg_num ra,
+ rb
+);
+
+ reg_num r_shift;
+
+ always_ff @(posedge clk)
+ unique0 case(next_cycle)
+ ISSUE:
+ if(issue) begin
+ ra <= dec_data.rn;
+ rb <= dec_snd.r;
+ r_shift <= dec_snd.r_shift;
+ end
+
+ RD_INDIRECT_SHIFT:
+ rb <= r_shift;
+
+ TRANSFER:
+ if(cycle != TRANSFER || mem_ready)
+ // final_rd viene de dec_ldst.rd
+ rb <= pop_valid ? popped : final_rd;
+ endcase
+
+ initial begin
+ ra = {$bits(ra){1'b0}};
+ rb = {$bits(rb){1'b0}};
+ r_shift = {$bits(r_shift){1'b0}};
+ end
+
+endmodule