diff options
-rw-r--r-- | design/stack_machine.v | 3 | ||||
-rwxr-xr-x | tclasm.tcl | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/design/stack_machine.v b/design/stack_machine.v index 1fddb18..d466cc8 100644 --- a/design/stack_machine.v +++ b/design/stack_machine.v @@ -127,6 +127,7 @@ module stack_machine assign extended_instruction_bits = instruction[8:0]; /* extended instructions */ + parameter INSTR_TEE = 9'd7; parameter INSTR_MUL = 9'd6; parameter INSTR_DIV = 9'd5; parameter INSTR_SUB = 9'd4; @@ -326,6 +327,8 @@ module stack_machine end INSTR_MUL : r0 <= r0 * r1; + INSTR_TEE : + r1 <= r0; default : begin `ifdef SIMULATION $display("operation not implemented yet"); @@ -181,6 +181,8 @@ proc __encode_extended_instruction {instruction} { return [__to_binary 5 9] } elseif {"$instruction" == "mul"} { return [__to_binary 6 9] + } elseif {"$instruction" == "tee"} { + return [__to_binary 7 9] } else { error "no such extended instruction: '$instruction'" } @@ -306,7 +308,7 @@ proc cond_jump {{address im_address}} { } } -foreach instruction {halt nop swap add sub div mul} { +foreach instruction {halt nop swap add sub div mul tee} { proc $instruction {} " _extended_instruction $instruction " |