From ecf72a544c75868e1f7ad87f8641217a3823c57e Mon Sep 17 00:00:00 2001 From: Daniel Koitka Date: Thu, 22 Jun 2023 10:23:36 +1000 Subject: [PATCH] vp20compiler: Add ARL Support Can now use address relative indexing with passed in data --- tools/vp20compiler/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/vp20compiler/main.c b/tools/vp20compiler/main.c index e7c761280..0c0ff763b 100644 --- a/tools/vp20compiler/main.c +++ b/tools/vp20compiler/main.c @@ -420,7 +420,10 @@ void translate(const char* str) vsh_set_field(vsh_ins, FLD_ILU, ILU_LIT); ilu = true; break; - + case OPCODE_ARL: + vsh_set_field(vsh_ins, FLD_MAC, MAC_ARL); + mac = true; + break; default: assert(false); } @@ -463,6 +466,9 @@ void translate(const char* str) vsh_set_field(vsh_ins, FLD_OUT_ORB, OUTPUT_C); // TODO: the index needs ajustment? vsh_set_field(vsh_ins, FLD_OUT_ADDRESS, ins.DstReg.Index); + } else if (ins.DstReg.File == PROGRAM_ADDRESS) + { + //no need to do anything, setting the MAC_ARL is all that's necessary } else { assert(false); } @@ -499,7 +505,10 @@ void translate(const char* str) struct prog_src_register reg = ins.SrcReg[j]; if (reg.File != PROGRAM_UNDEFINED) { // printf(" - in %d\n", j); - assert(!reg.RelAddr); //TODO: A0 rel + if(reg.RelAddr) + { + vsh_set_field(vsh_ins, FLD_A0X, 1); + } if (reg.File == PROGRAM_TEMPORARY) { vsh_set_field(vsh_ins, mux_field[j], PARAM_R); vsh_set_field(vsh_ins, reg_field[j], reg.Index);