diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-07-24 20:12:26 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-07-24 20:12:26 +0200 |
| commit | 29894d56e144223629e558070cbc52080e21342e (patch) | |
| tree | 26d2fbbd2094d57b49fca4d202b9b34908013f34 /tpu.h | |
| parent | 5835917f57d4dc04b406c8e3e06bf3b046d709e3 (diff) | |
| download | tis100-29894d56e144223629e558070cbc52080e21342e.tar.gz tis100-29894d56e144223629e558070cbc52080e21342e.zip | |
Fully implement tokenizer and port value passing
Diffstat (limited to 'tpu.h')
| -rw-r--r-- | tpu.h | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -62,19 +62,20 @@ struct tpu_port { struct tpu *dst_tpu; enum tpu_port_type type; struct tpu_port *dst_port; - bool write, read; - uint8_t val; - bool attached; + bool attached, reading; + int in, out; }; struct tpu { + enum tpu_status status; struct label_map labels; struct tpu_port ports[4]; + int read_port; uint8_t acc, bak; size_t x, y; int last; - size_t pc; + uint8_t pc; struct tpu_inst insts[TPU_MAX_INST]; size_t inst_cnt; }; @@ -98,8 +99,13 @@ void tpu_init(struct tpu *tpu); void tpu_deinit(struct tpu *tpu); 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); bool tpu_add_inst(struct tpu *tpu, enum tpu_inst_type inst, int op1, uint8_t op1_lit, int op2, uint8_t op2_lit); +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); void tpu_step(struct tpu *tpu); |
