summaryrefslogtreecommitdiffstats
path: root/tpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'tpu.h')
-rw-r--r--tpu.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/tpu.h b/tpu.h
index 98c9ad1..1fcb8d9 100644
--- a/tpu.h
+++ b/tpu.h
@@ -34,6 +34,11 @@ enum tpu_port_type {
PORT_IN = 0b01, PORT_OUT = 0b10, PORT_BIDI = 0b11
};
+union tpu_inst_op_val {
+ uint8_t lit;
+ char *label;
+};
+
struct label_map_link {
char *label;
size_t pc;
@@ -46,10 +51,7 @@ struct label_map {
struct tpu_inst_op {
enum tpu_inst_op_type type;
- union {
- uint8_t lit;
- char *label;
- };
+ union tpu_inst_op_val val;
};
struct tpu_inst {
@@ -116,9 +118,11 @@ struct tpu_inst *tpu_current_inst(struct tpu *tpu);
void tpu_init_ports(struct tpu *tpu, struct tpu_map *map);
void tpu_update_ports(struct tpu *tpu);
bool tpu_set_inst(struct tpu *tpu, uint8_t pc, enum tpu_inst_type inst,
- int op1, uint8_t op1_lit, int op2, uint8_t op2_lit);
+ int op1, union tpu_inst_op_val v1,
+ int op2, union tpu_inst_op_val v2);
bool tpu_add_inst(struct tpu *tpu, enum tpu_inst_type inst,
- int op1, uint8_t op1_lit, int op2, uint8_t op2_lit);
+ int op1, union tpu_inst_op_val v1,
+ int op2, union tpu_inst_op_val v2);
void tpu_clear_ports(struct tpu *tpu);
enum tpu_status tpu_exec_mov(struct tpu *tpu, struct tpu_inst *inst);
enum tpu_status tpu_exec(struct tpu *tpu, struct tpu_inst *inst);