summaryrefslogtreecommitdiff
path: root/instruction.h
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2019-04-14 20:05:44 +1200
committerDavid Phillips <david@sighup.nz>2019-08-03 12:43:46 +1200
commit3bf3b2a80ef21ac1ac2e43d07b1680432d66cbaf (patch)
treee4c3a4ce3d9646f9d78282a0cf8bb4a4cce2575d /instruction.h
parente5eeded02a4abe2729e675203437c79d9ee71a7a (diff)
downloadtoy-cpu-assembler-3bf3b2a80ef21ac1ac2e43d07b1680432d66cbaf.tar.xz
Remove superfluous printfs, factor reg table lookup
Diffstat (limited to 'instruction.h')
-rw-r--r--instruction.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/instruction.h b/instruction.h
index 7e1a490..323a66b 100644
--- a/instruction.h
+++ b/instruction.h
@@ -22,6 +22,13 @@ enum INST_TYPE {
#define MASK_INST_WITYPE (0x8000)
#define MASK_INST_JTYPE (0xC000)
+#define RTYPE_SIZE_BYTES 2 /* instruction fits in 16 bits */
+#define NITYPE_SIZE_BYTES 2 /* instruction fits in 16 bits */
+#define BTYPE_SIZE_BYTES 2 /* instruction fits in 16 bits */
+#define JRTYPE_SIZE_BYTES 2 /* instruction fits in 16 bits */
+#define WITYPE_SIZE_BYTES 4 /* 16-bit instruction + 16-bit immediate */
+#define JITYPE_SIZE_BYTES 4 /* 16-bit instruction + 16-bit immediate */
+
/**
* ALU operation types
* R-type and I-type take 3-bit ALU oper as bits: