summaryrefslogtreecommitdiff
path: root/rtl/core/decode/ldst/single.sv
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-10-08 15:34:46 -0600
committerAlejandro Soto <alejandro@34project.org>2022-10-08 15:34:46 -0600
commitdab6e68a8396475af5acbf53397f93c6b52e2e71 (patch)
tree7ec0ee02735a730f633190acadaca23bbd574234 /rtl/core/decode/ldst/single.sv
parenta0a12ef0c1bd6882d902a9d5938e7220e543b378 (diff)
Implement LDR/STR decode
Diffstat (limited to 'rtl/core/decode/ldst/single.sv')
-rw-r--r--rtl/core/decode/ldst/single.sv30
1 files changed, 30 insertions, 0 deletions
diff --git a/rtl/core/decode/ldst/single.sv b/rtl/core/decode/ldst/single.sv
new file mode 100644
index 0000000..5bcb638
--- /dev/null
+++ b/rtl/core/decode/ldst/single.sv
@@ -0,0 +1,30 @@
+`include "core/isa.sv"
+`include "core/uarch.sv"
+
+module core_decode_ldst_single
+(
+ input word insn,
+
+ output ldst_decode decode,
+ output logic snd_is_imm
+);
+
+ logic p, w;
+
+ assign decode.rn = insn `FIELD_LDST_SINGLE_RN;
+ assign decode.rd = insn `FIELD_LDST_SINGLE_RD;
+ assign decode.size = insn `FIELD_LDST_SINGLE_B ? LDST_BYTE : LDST_WORD;
+ assign decode.load = insn `FIELD_LDST_LD;
+ assign decode.increment = insn `FIELD_LDST_SINGLE_U;
+ assign decode.writeback = !p || w;
+ assign decode.sign_extend = 0;
+ assign decode.pre_indexed = p && w;
+ assign decode.unprivileged = !p && w;
+ assign decode.user_regs = 0;
+ assign decode.reg_list = 16'b0;
+
+ assign p = insn `FIELD_LDST_SINGLE_P;
+ assign w = insn `FIELD_LDST_SINGLE_W;
+ assign snd_is_imm = !insn `FIELD_LDST_SINGLE_REG;
+
+endmodule