From 16d285dac3271becd7a20ccd434c8f4deceeec4a Mon Sep 17 00:00:00 2001 From: Wojciech Kosior Date: Mon, 7 Sep 2020 21:24:51 +0200 Subject: remove old version of stack machine from the project --- Makefile | 26 +- design/stack_machine_old.v | 356 --------------------- tclasm_old.tcl | 352 -------------------- tests/stack_machine_old_add/instructions.s.tcl | 20 -- tests/stack_machine_old_add/test.v | 1 - tests/stack_machine_old_add/words_to_verify.mem | 9 - .../stack_machine_old_cond_jump/instructions.s.tcl | 45 --- tests/stack_machine_old_cond_jump/test.v | 1 - .../words_to_verify.mem | 9 - tests/stack_machine_old_div/instructions.s.tcl | 23 -- tests/stack_machine_old_div/test.v | 1 - tests/stack_machine_old_div/words_to_verify.mem | 12 - tests/stack_machine_old_jump/instructions.s.tcl | 22 -- tests/stack_machine_old_jump/test.v | 1 - tests/stack_machine_old_jump/words_to_verify.mem | 2 - .../instructions.s.tcl | 109 ------- tests/stack_machine_old_load_store/test.v | 1 - .../words_to_verify.mem | 12 - tests/stack_machine_old_mul/instructions.s.tcl | 42 --- tests/stack_machine_old_mul/test.v | 1 - tests/stack_machine_old_mul/words_to_verify.mem | 19 -- .../instructions.s.tcl | 32 -- .../test.v | 1 - .../words_to_verify.mem | 1 - tests/stack_machine_old_store/instructions.s.tcl | 29 -- tests/stack_machine_old_store/test.v | 140 -------- tests/stack_machine_old_store/words_to_verify.mem | 3 - tests/stack_machine_old_sub/instructions.s.tcl | 21 -- tests/stack_machine_old_sub/test.v | 1 - tests/stack_machine_old_sub/words_to_verify.mem | 9 - tests/stack_machine_old_swap/instructions.s.tcl | 15 - tests/stack_machine_old_swap/test.v | 1 - tests/stack_machine_old_swap/words_to_verify.mem | 5 - tests/stack_machine_old_tee/instructions.s.tcl | 15 - tests/stack_machine_old_tee/test.v | 1 - tests/stack_machine_old_tee/words_to_verify.mem | 5 - 36 files changed, 1 insertion(+), 1342 deletions(-) delete mode 100644 design/stack_machine_old.v delete mode 100755 tclasm_old.tcl delete mode 100755 tests/stack_machine_old_add/instructions.s.tcl delete mode 120000 tests/stack_machine_old_add/test.v delete mode 100644 tests/stack_machine_old_add/words_to_verify.mem delete mode 100755 tests/stack_machine_old_cond_jump/instructions.s.tcl delete mode 120000 tests/stack_machine_old_cond_jump/test.v delete mode 100644 tests/stack_machine_old_cond_jump/words_to_verify.mem delete mode 100755 tests/stack_machine_old_div/instructions.s.tcl delete mode 120000 tests/stack_machine_old_div/test.v delete mode 100644 tests/stack_machine_old_div/words_to_verify.mem delete mode 100755 tests/stack_machine_old_jump/instructions.s.tcl delete mode 120000 tests/stack_machine_old_jump/test.v delete mode 100644 tests/stack_machine_old_jump/words_to_verify.mem delete mode 100755 tests/stack_machine_old_load_store/instructions.s.tcl delete mode 120000 tests/stack_machine_old_load_store/test.v delete mode 100644 tests/stack_machine_old_load_store/words_to_verify.mem delete mode 100755 tests/stack_machine_old_mul/instructions.s.tcl delete mode 120000 tests/stack_machine_old_mul/test.v delete mode 100644 tests/stack_machine_old_mul/words_to_verify.mem delete mode 100755 tests/stack_machine_old_multiinstructions_load_store/instructions.s.tcl delete mode 120000 tests/stack_machine_old_multiinstructions_load_store/test.v delete mode 120000 tests/stack_machine_old_multiinstructions_load_store/words_to_verify.mem delete mode 100755 tests/stack_machine_old_store/instructions.s.tcl delete mode 100644 tests/stack_machine_old_store/test.v delete mode 100644 tests/stack_machine_old_store/words_to_verify.mem delete mode 100755 tests/stack_machine_old_sub/instructions.s.tcl delete mode 120000 tests/stack_machine_old_sub/test.v delete mode 100644 tests/stack_machine_old_sub/words_to_verify.mem delete mode 100755 tests/stack_machine_old_swap/instructions.s.tcl delete mode 120000 tests/stack_machine_old_swap/test.v delete mode 100644 tests/stack_machine_old_swap/words_to_verify.mem delete mode 100755 tests/stack_machine_old_tee/instructions.s.tcl delete mode 120000 tests/stack_machine_old_tee/test.v delete mode 100644 tests/stack_machine_old_tee/words_to_verify.mem diff --git a/Makefile b/Makefile index 081a20e..a4c7b69 100644 --- a/Makefile +++ b/Makefile @@ -19,19 +19,6 @@ MACROASM_FLAGS := -Iinclude/ -E # It made sense to just list all of those in this variable # and then prepend stack_machine_ to each element -STACK_MACHINE_OLD_TESTS := \ - store \ - load_store \ - multiinstructions_load_store \ - add \ - sub \ - div \ - mul \ - jump \ - tee \ - swap \ - cond_jump - STACK_MACHINE_TESTS := \ store \ load_store \ @@ -59,7 +46,6 @@ TESTS := \ intercon \ slave_dispatcher \ master_arbiter \ - $(addprefix stack_machine_old_,$(STACK_MACHINE_OLD_TESTS)) \ $(addprefix stack_machine_,$(STACK_MACHINE_TESTS)) # For each of these Makefile will attempt to generate VGAdump.ppm @@ -126,7 +112,7 @@ quicktest : $(NO_VGA_TEST_TARGETS) # VGA tests take loooong time tests/%.mem : tests/%.memv $(IV) $(MACROASM_FLAGS) $^ -o $@ -%.mem : %.s.tcl tclasm_old.tcl tclasm.tcl +%.mem : %.s.tcl tclasm.tcl $< > $@ tests/self/test.vvp : tests/self/operations.mem tests/self/test.v \ @@ -221,16 +207,6 @@ tests/wrapped_stack_machine_%/test.vvp : \ -DWORDS_TO_VERIFY_COUNT=$(call FILE_LINES,$<) \ $(filter %.v,$^) -o $@ -tests/stack_machine_old_%/test.vvp : \ - tests/stack_machine_old_%/words_to_verify.mem \ - tests/stack_machine_old_%/instructions.mem \ - tests/stack_machine_old_%/test.v models/slave.v \ - design/stack_machine_old.v design/div.v include/messages.vh - $(IV) $(IVFLAGS) -s stack_machine_test \ - -DINSTRUCTIONS_COUNT=$(call FILE_LINES,$(filter %ions.mem,$^)) \ - -DWORDS_TO_VERIFY_COUNT=$(call FILE_LINES,$<) \ - $(filter %.v,$^) -o $@ - tests/soc_simple_display/test.vvp : tests/soc_simple_display/instructions.mem \ tests/soc_simple_display/test.v models/sram.v \ models/vga_display.v design/*.v include/messages.vh diff --git a/design/stack_machine_old.v b/design/stack_machine_old.v deleted file mode 100644 index d466cc8..0000000 --- a/design/stack_machine_old.v +++ /dev/null @@ -1,356 +0,0 @@ -`default_nettype none - -module stack_machine - ( - input wire ACK_I, - input wire CLK_I, - output reg [19:0] ADR_O, - input wire [15:0] DAT_I, - output reg [15:0] DAT_O, - input wire RST_I, - output reg STB_O, - output reg CYC_O, - output reg WE_O, - input wire STALL_I, - - /* non-wishbone */ - output wire finished - ); - - reg [19:0] pc; - reg [19:0] sp; - - reg [15:0] instr; - - reg [31:0] r0; - reg [31:0] r1; - reg [31:0] im; - - parameter STEP_START = 0; - parameter STEP_LOADING_INSTRUCTION = 1; - parameter STEP_PARSING_INSTRUCTION = 2; - parameter STEP_LOAD_OR_STORE = 3; - parameter STEP_PERFORM_OPERATION = 4; - reg [2:0] step; - - reg [15:0] DAT_I_latched; - reg [15:0] instruction_latched; - reg instruction_just_received; - wire [15:0] instruction; - assign instruction = instruction_just_received ? - DAT_I_latched : instruction_latched; - - /* Results of instruction parsing */ - wire shift_immediate; /* only if modify_immediate is true */ - assign shift_immediate = instruction[11]; - - /* only if shift_immediate is true */ - wire [10:0] immediate_bits_to_shift; - assign immediate_bits_to_shift = instruction[10:0]; - - /* only if shift_immediate is false */ - wire set_immediate; - assign set_immediate = instruction[10]; - - /* only if (set_immediate && !shift_immediate) is true */ - wire [31:0] immediate_value_to_set; - assign immediate_value_to_set = {{22{instruction[9]}}, instruction[9:0]}; - - /* only if (!set_immediate && !shift_immediate) is true */ - wire add_immediate; - assign add_immediate = instruction[9]; - - /* only if (add_immediate && !set_immediate && !shift_immediate) is true */ - wire [9:0] immediate_value_to_add; - assign immediate_value_to_add = instruction[8:0]; - - - wire [31:0] new_im; - assign new_im = shift_immediate ? {im[20:0], immediate_bits_to_shift} : - set_immediate ? immediate_value_to_set : - add_immediate ? im + immediate_value_to_add : im; - - - wire shift_regs; - assign shift_regs = instruction[12]; - - - wire load_or_store; - assign load_or_store = instruction[15]; - - wire [19:0] addr_to_use; /* only if load_or_store is true */ - /* The implementation is currently unable to make non-aligned accesses */ - assign addr_to_use = new_im / 2 + (immediate_addressing ? 0 : sp); - - wire load; /* only if load_or_store is true */ - assign load = instruction[14]; - - wire store; /* only if load_or_store is true */ - assign store = !load; - - wire immediate_addressing; /* only if load_or_store is true */ - assign immediate_addressing = instruction[13]; - wire sp_addressing; /* only if load_or_store is true */ - assign sp_addressing = !immediate_addressing; - - wire load_or_store_r0; /* only if load_or_store is true */ - assign load_or_store_r0 = instruction[12]; - - wire load_or_store_r1; /* only if load_or_store is true */ - assign load_or_store_r1 = !load_or_store_r0; - - - /* only if load_or_store is false */ - wire cond_jump; - assign cond_jump = instruction[14:13] == 2'b11; - - /* only if load_or_store is false */ - wire jump; - assign jump = instruction[14:13] == 2'b10; - - /* only if load_or_store is false */ - wire exchange_r1_im; - assign exchange_r1_im = instruction[14:13] == 2'b01; - - /* only if load_or_store is false */ - wire immediate_modification; - assign immediate_modification - = instruction[14:13] == 0 && - (shift_immediate || set_immediate || add_immediate); - - wire extended_instruction; /* only if load_or_store is false */ - assign extended_instruction = instruction[14:13] == 0 && ! shift_immediate && - !set_immediate && !add_immediate; - - /* only if (!load_or_store && extended_instruction) is true */ - wire [8:0] extended_instruction_bits; - 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; - parameter INSTR_ADD = 9'd3; - parameter INSTR_SET_SP = 9'd2; - parameter INSTR_HALT = 9'd1; - parameter INSTR_NOP = 9'd0; - - /* module for division */ - wire [31:0] div_quotient; - wire [31:0] div_remainder; - wire div_done; - - div - #( - .WIDTH(32) - ) div - ( - .clock(CLK_I), - .start(step == STEP_PARSING_INSTRUCTION), - .dividend(r0), - .divisor(r1), - - .quotient(div_quotient), - .remainder(div_remainder), - .done(div_done) - ); - - assign finished = !load_or_store && extended_instruction && - extended_instruction_bits == INSTR_HALT; - - - reg [15:0] second_word_to_store; - - /* - * Variables necessary to know where we are when transferring - * a sequence of words through wishbone - */ - reg first_command_sent; - reg first_ack_received; - - /* Informs us, that DAT_I_latched should be moved to r0 or r1 */ - reg load_half_of_r0; - reg load_half_of_r1; - -`ifdef SIMULATION - /* - * RST should still be used when powering up, even in benches; - * this is just to avoid undefined values - */ - initial begin - ADR_O <= 0; - STB_O <= 0; - CYC_O <= 0; - WE_O <= 0; - - r0 <= 0; - r1 <= 0; - im <= 0; - pc <= 0; - sp <= 20'h40000; - step <= STEP_START; - instruction_latched <= 0; - instruction_just_received <= 0; - end -`endif - - always @ (posedge CLK_I) begin - DAT_I_latched <= DAT_I; - - /* - * Later part of this always block sets them to 1 under certain - * conditions, which takes precedence over this assignment - */ - load_half_of_r0 <= 0; - load_half_of_r1 <= 0; - instruction_just_received <= 0; - - if (RST_I) begin - STB_O <= 0; - CYC_O <= 0; - - pc <= 0; - sp <= 20'h40000; - step <= STEP_START; - end else begin - case (step) - STEP_START : begin - ADR_O <= pc; - STB_O <= 1; - CYC_O <= 1; - WE_O <= 0; - step <= STEP_LOADING_INSTRUCTION; - pc <= pc + 1; - end - STEP_LOADING_INSTRUCTION : begin - if (!STALL_I) - STB_O <= 0; - - if (ACK_I) begin - instruction_just_received <= 1; - step <= STEP_PARSING_INSTRUCTION; - CYC_O <= 0; - end - end // case: STEP_LOADING_INSTRUCTION - STEP_PARSING_INSTRUCTION : begin - im <= new_im; - instruction_latched <= instruction; - - first_command_sent <= 0; - first_ack_received <= 0; - - if (shift_regs) - {r0, r1} <= {r1, r0}; /* magic! */ - - if (load_or_store) begin - CYC_O <= 1; - STB_O <= 1; - WE_O <= store; - ADR_O <= addr_to_use; - - /* Even if not a store, setting these won't break anything */ - DAT_O <= load_or_store_r0 ? r0[15:0] : r1[15:0]; - second_word_to_store <= load_or_store_r0 ? - r0[31:16] : r1[31:16]; - - if (load_or_store_r0) - sp <= sp + (load ? 2 : -2); - - step <= STEP_LOAD_OR_STORE; - end else begin // if (load_or_store) - if (immediate_modification) begin - step <= STEP_START; - end else if (exchange_r1_im || extended_instruction) begin - step <= STEP_PERFORM_OPERATION; - end else if (jump) begin - pc <= new_im / 2; - step <= STEP_START; - end else if (cond_jump) begin - if (r1 != 0) - pc <= new_im / 2; - - step <= STEP_START; - end else begin -`ifdef SIMULATION - $display("operation not implemented yet"); -`endif - step <= STEP_START; - end - end // else: !if(load_or_store) - end // case: STEP_PARSING_INSTRUCTION - STEP_LOAD_OR_STORE : begin - if (!STALL_I) begin - ADR_O <= ADR_O + 1; - - DAT_O <= second_word_to_store; - - if (!first_command_sent) - first_command_sent <= 1; - else - STB_O <= 0; - end // if (!STALL_I) - - if (ACK_I) begin - if (load) begin - if (load_or_store_r0) - load_half_of_r0 <= 1; - else - load_half_of_r1 <= 1; - end - - if (!first_ack_received) - first_ack_received <= 1; - else - step <= STEP_START; - end // if (ACK_I) - end // case: STEP_LOAD_OR_STORE - STEP_PERFORM_OPERATION : begin - step <= STEP_START; /* unless overwritten in case block below */ - - if (extended_instruction) begin - case (extended_instruction_bits) - INSTR_NOP : - ; - INSTR_HALT : - step <= step; /* stay in this step forever */ - INSTR_SET_SP : - sp <= im / 2; - INSTR_ADD : - r0 <= r0 + r1; - INSTR_SUB : - r0 <= r0 - r1; - INSTR_DIV : begin - {r0, r1} <= {div_quotient, div_remainder}; - if (!div_done) - step <= step; - end - INSTR_MUL : - r0 <= r0 * r1; - INSTR_TEE : - r1 <= r0; - default : begin -`ifdef SIMULATION - $display("operation not implemented yet"); -`endif - end - endcase // case (extended_instruction_bits) - end else if (exchange_r1_im) begin - {r1, im} <= {im, r1}; - end else begin -`ifdef SIMULATION - $display("operation not implemented yet"); -`endif - end - end // case: STEP_PERFORM_OPERATION - endcase // case (step) - end // else: !if(RST_I) - - if (load_half_of_r0) - r0 <= {DAT_I_latched, r0[31:16]}; - - if (load_half_of_r1) - r1 <= {DAT_I_latched, r1[31:16]}; - end // always @ (posedge CLK_I) - -endmodule // stack_machine diff --git a/tclasm_old.tcl b/tclasm_old.tcl deleted file mode 100755 index 99b01a1..0000000 --- a/tclasm_old.tcl +++ /dev/null @@ -1,352 +0,0 @@ -#!/bin/grep this[ ]script -# this script is to be sourced, not executed by itself - -# procedures starting with "__" are internal and not to be used in asm code; -# procedures starting with "_" are generalized procedures, that are not meant -# to be directly used for code translated from webasm; -# the rest are typical procedures webasm code will be mapped to - -proc __parse_binary {binary} { - set value 0 - - for {set bits_remaining $binary} \ - {"$bits_remaining" != ""} \ - {set bits_remaining [string range $bits_remaining 1 end]} { - set value [expr $value * 2] - - if [string match 1* $bits_remaining] { - incr value - } elseif [string match 0* $bits_remaining] { - # nothing - } else { - error "'$binary' cannot be parsed as a binary number" - } - } - - return $value -} - -proc __parse_number {number} { - if [string match h?* $number] { - set value 0x[string range $number 1 end] - } elseif [string match b?* $number] { - set value [__parse_binary [string range $number 1 end]] - } elseif [string match {d[0123456789]?*} $number] { - set value [string range $number 1 end] - } elseif [string match {-[0123456789]*} $number] { - set value $number - } elseif [string match {[0123456789]*} $number] { - set value $number - } else { - error "'$number' is not a properly formatted number" - } - - return $value -} - -proc __to_binary {number length {can_be_negative -neg_ok}} { - if [string equal $can_be_negative -neg_ok] { - set can_be_negative 1 - } elseif [string equal $can_be_negative -no_neg] { - set can_be_negative 0 - } else { - error "'$can_be_negative' is not a valid value for the\ - 'can_be_negative' argument" - } - - set value [__parse_number $number] - - if {$value < 0 && !$can_be_negative} { - error "value '$number' provided where negative values are not allowed" - } - - if {($can_be_negative && $value >= 2 ** ($length - 1)) || - $value >= 2 ** $length || - $value < -(2 ** ($length - 1))} { - error "value '$number' doesn't fit into $length\ - bits[expr $can_be_negative ? "{ with sign}" : "{}"]" - } - - for {set result ""} {$length > 0} {incr length -1} { - set result [expr $value % 2]$result - set value [expr $value >> 1] - } - - return $result -} - -# example: __encode_immediate im+=213 -# __encode_immediate im<<=hAB -# __encode_immediate im=im -# __encode_immediate im=-33 # negative value only allowed for im= -# __encode_immediate im<<=b1101101 -proc __encode_immediate {im_modification} { - if [string equal $im_modification im=im] { - return 000000000000 - } elseif [string match im<<=?* $im_modification] { - return 1[__to_binary [string range $im_modification 5 end] 11 -no_neg] - } elseif [string match im=?* $im_modification] { - return 01[__to_binary [string range $im_modification 3 end] 10] - } elseif [string match im+=?* $im_modification] { - return 001[__to_binary [string range $im_modification 4 end] 9 -no_neg] - } else { - error "'$im_modification' is not a valid im modification" - } -} - -# example: __encode_access_type load -# __encode_access_type store -proc __encode_access_type {type} { - if {"$type" == "load"} { - return 1 - } elseif {"$type" == "store"} { - return 0 - } else { - error "'$type' is not a valid memory access type" - } -} - -# example: __encode_addressing @im -# __encode_addressing @im+sp -proc __encode_addressing {address} { - if {"$address" == "@im"} { - return 1 - } elseif {"$address" == "@im+sp"} { - return 0 - } else { - error "'$address' is not a valid addressing" - } -} - -# example: __encode_reg r0 -# __encode_reg r1 -proc __encode_reg {register} { - if {"$register" == "r0"} { - return 1 - } elseif {"$register" == "r1"} { - return 0 - } else { - error "'$register' is not a valid register" - } -v} - -# example: __encode_memory_access load r0 @im im=d1840 -# __encode_memory_access store r1 @im+sp im<<=b1100011 -proc __encode_memory_access {type register address {im_modification im=im}} { - set type [__encode_access_type $type] - set address [__encode_addressing $address] - set register [__encode_reg $register] - set im_modification [__encode_immediate $im_modification] - return 1$type$address$register$im_modification -} - -# example: __encode_swap swap -# __encode_swap no_swap -proc __encode_swap {swap_regs} { - if {"$swap_regs" == "swap"} { - return 1 - } elseif {"$swap_regs" == "no_swap"} { - return 0 - } else { - error "got '$swap_regs' where 'swap' or 'no_swap' was expected" - } -} - -# example: __encode_swap swap -# __encode_swap no_swap -proc __encode_cond {cond} { - if {"$cond" == "cond"} { - return 1 - } elseif {"$cond" == "non-cond"} { - return 0 - } else { - error "got '$cond' where 'cond' or 'non-cond' was expected" - } -} - -# example: __encode_extended_instruction halt -# __encode_extended_instruction nop -proc __encode_extended_instruction {instruction} { - if {"$instruction" == "nop"} { - return [__to_binary 0 9] - } elseif {"$instruction" == "halt"} { - return [__to_binary 1 9] - } elseif {"$instruction" == "set_sp"} { - return [__to_binary 2 9] - } elseif {"$instruction" == "add"} { - return [__to_binary 3 9] - } elseif {"$instruction" == "sub"} { - return [__to_binary 4 9] - } elseif {"$instruction" == "div"} { - 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'" - } -} - -# example: _load r0 @im im+=2 # negative values are *not* allowed for im+= -# _load r1 @im im=im -# _load r0 @im+sp # im=im is the default if not specified -# _load r0 @im im<<=12 # 12 is the value shifted, shift is always by 11 -# _load r1 @im im=-9 # negative values are only allowed for im= -# _load r0 @im+sp im=0 # this results in using only sp for addressing -proc _load {register address {im_modification im=im}} { - puts [__encode_memory_access load $register $address $im_modification] -} - -# example: _store r0 @im im+=2 # same semantics as _load -# _store r1 @im im=im -# _store r0 @im+sp -# _store r0 @im im<<=12 -# _store r1 @im im=-9 -# _store r0 @im+sp im=0 -proc _store {register address {im_modification im=im}} { - puts [__encode_memory_access store $register $address $im_modification] -} - -# example: _jump im<<=b1101011 cond swap -# _jump im=im non-cond -proc _jump {{im_modification im=im} {cond non-cond} {swap_regs no_swap}} { - set swap_regs [__encode_swap $swap_regs] - set cond [__encode_cond $cond] - puts 01$cond$swap_regs[__encode_immediate $im_modification] -} - -# example: _cond_jump im=h16A swap -proc _cond_jump {{im_modification im=im} {swap_regs no_swap}} { - _jump $im_modification cond $swap_regs -} - -# example: _extended_instruction nop swap # it's really no longer a true nop... -# _extended_instruction halt -proc _extended_instruction {instruction {swap_regs no_swap}} { - set swap_regs [__encode_swap $swap_regs] - set no_im_modification 000 - set instruction [__encode_extended_instruction $instruction] - puts 000$swap_regs$no_im_modification$instruction -} - -# example: _immediate im+=4 swap -# _immediate im<<=hFF -# _immediate im=im # this one gives the same bit result as 'nop' -proc _immediate {im_modification {swap_regs no_swap}} { - set swap_regs [__encode_swap $swap_regs] - set im_modification [__encode_immediate $im_modification] - puts 000$swap_regs$im_modification -} - -# example: _exchange_im im<<=b10101010101 swap -proc _exchange_im {{im_modification im=im} {swap_regs no_swap}} { - set swap_regs [__encode_swap $swap_regs] - set im_modification [__encode_immediate $im_modification] - puts 001$swap_regs$im_modification -} - -proc _const {command number} { - - set value [expr [__parse_number $number] + 0] - if {$value < 2 ** 9 && $value >= -(2 ** 9)} { - $command im=$value - } elseif {$value < 2 ** 20 && $value >= -(2 ** 20)} { - _immediate im=[expr $value >> 11] - $command im<<=[expr $value & 0x7ff] - } elseif {$value < 2 ** 32 && $value >= -(2 ** 31)} { - # remove sign - set value [expr $value & (2 ** 32 - 1)] - - _immediate im<<=[expr $value >> 22] - _immediate im<<=[expr ($value >> 11) & 0x7ff] - $command im<<=[expr $value & 0x7ff] - } else { - error "number '$number' doesn't fit in 32 bits" - } -} - -# example: stack up -# stack down -proc stack {direction} { - if {"$direction" == "up"} { - _load r0 @im+sp im=4 - } elseif {"$direction" == "down"} { - _store r0 @im+sp im=0 - } else { - error "bad opcode: stack $direction" - } -} - -# example: store im<<=00000000000 -proc store {{im_modification im=im}} { - _store r1 @im $im_modification -} - -# example: load im=hDD -proc load {{im_modification im=im}} { - _load r1 @im $im_modification -} - -# example: jump # if no address is given - im is used -# jump h4FFFE -proc jump {{address im_address}} { - if {"$address" == "im_address"} { - _jump im=im - } else { - _const _jump $address - } -} - -# example: cond_jump -# cond_jump b100100110100111101 # same semantics as 'jump' -proc cond_jump {{address im_address}} { - if {"$address" == "im_address"} { - _jump im=im cond - } else { - _const _cond_jump $address - } -} - -foreach instruction {halt nop swap add sub div mul tee} { - proc $instruction {} " - _extended_instruction $instruction - " -} - -proc swap {} { - _extended_instruction nop swap -} - - -# example: exchange_im im+=15 -proc exchange_im {{im_modification im=im}} { - _exchange_im $im_modification -} - -# example: const -100249 -# const hDEADBEEF # automatically translates to multiple instructions -proc const {number} { - _const _exchange_im $number -} - -# example: immediate b11101101010000010100010 # analogous to 'const' above -proc immediate {number} { - _const _immediate $number -} - -# example: set_sp h2FFFE # analogous to 'const' and 'immediate' above -proc set_sp {number} { - immediate $number - _extended_instruction set_sp -} - -# example: store@ h57574 -proc store@ {address_number} { - _const store $address_number -} - -# example: load@ h20000 -proc load@ {address_number} { - _const load $address_number -} diff --git a/tests/stack_machine_old_add/instructions.s.tcl b/tests/stack_machine_old_add/instructions.s.tcl deleted file mode 100755 index 6894ecc..0000000 --- a/tests/stack_machine_old_add/instructions.s.tcl +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -### store 2 values to memory, load them back, add them and store the result - -set_sp h7FFFC -const 12345678 -store@ h1EEE0 -const 40302010 -store@ h1EEE4 - -load@ h1EEE0 -stack down -load@ h1EEE4 -# adding 40302010 to 12345678 should yield 52647688 -add -stack up -store@ h1EEE8 -halt diff --git a/tests/stack_machine_old_add/test.v b/tests/stack_machine_old_add/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_add/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_add/words_to_verify.mem b/tests/stack_machine_old_add/words_to_verify.mem deleted file mode 100644 index db077bc..0000000 --- a/tests/stack_machine_old_add/words_to_verify.mem +++ /dev/null @@ -1,9 +0,0 @@ -// address value - 1EEE0 614E // 12345678 in hex is BC614E - 1EEE2 BC - - 1EEE4 F5BA // 40302010 in hex is 266F5BA - 1EEE6 266 - - 1EEE8 5708 // 52647688 in hex is 3235708 - 1EEEA 323 diff --git a/tests/stack_machine_old_cond_jump/instructions.s.tcl b/tests/stack_machine_old_cond_jump/instructions.s.tcl deleted file mode 100755 index 2cce62f..0000000 --- a/tests/stack_machine_old_cond_jump/instructions.s.tcl +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -## also look at stack_machine_jump test - -## we're going to write numbers from 0 to 7 to addresses h400 - h41C - -# this will translate to 3 16-bit instructions -set_sp h7FFFC - -## set up the counter -# each of those 2 will translate to 1 16-bit instruction -const 0 -stack down - -## this is the point we later jump to, address 10 - -tee -## compute address: counter * 4 + h400 -stack down -const 4 -mul -const h400 -add -stack up -## load computed address to im -exchange_im -## save value of counter at address pointed by im -swap -store -swap -## increase counter by 1 -const 1 -add -## compare value of counter to 8 -tee -stack down -const 8 -sub -stack up -## loop if counter != 8 -cond_jump 10 - -halt diff --git a/tests/stack_machine_old_cond_jump/test.v b/tests/stack_machine_old_cond_jump/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_cond_jump/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_cond_jump/words_to_verify.mem b/tests/stack_machine_old_cond_jump/words_to_verify.mem deleted file mode 100644 index 4b77b8a..0000000 --- a/tests/stack_machine_old_cond_jump/words_to_verify.mem +++ /dev/null @@ -1,9 +0,0 @@ -// address value - 00400 0 // verify the first number written - 00402 0 - - 00408 2 // verify a number in the middle - 0040A 0 - - 0041C 7 // verify the last number - 0041E 0 diff --git a/tests/stack_machine_old_div/instructions.s.tcl b/tests/stack_machine_old_div/instructions.s.tcl deleted file mode 100755 index 8a5f5df..0000000 --- a/tests/stack_machine_old_div/instructions.s.tcl +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -### store 2 values to memory, load them back, divide one by another and store -### the result (both quotient and remainder); this is analogous to addition -### and substraction tests - -set_sp h7FFFC -const 777681520 -store@ h1EEE0 -const 3721 -store@ h1EEE4 - -load@ h1EEE0 -stack down -load@ h1EEE4 -# dividing 777681520 by 3721 should yield 208997 r 3683 -div -store@ h1EEE8 -stack up -store@ h1EEEC -halt diff --git a/tests/stack_machine_old_div/test.v b/tests/stack_machine_old_div/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_div/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_div/words_to_verify.mem b/tests/stack_machine_old_div/words_to_verify.mem deleted file mode 100644 index 8543226..0000000 --- a/tests/stack_machine_old_div/words_to_verify.mem +++ /dev/null @@ -1,12 +0,0 @@ -// address value - 1EEE0 7A70 // 777681520 in hex is 2E5A7A70 - 1EEE2 2E5A - - 1EEE4 E89 // 3721 in hex is E89 - 1EEE6 0 - - 1EEE8 E63 // 3683 in hex is E63 - 1EEEA 0 - - 1EEEC 3065 // 208997 in hex is 33065 - 1EEEE 3 diff --git a/tests/stack_machine_old_jump/instructions.s.tcl b/tests/stack_machine_old_jump/instructions.s.tcl deleted file mode 100755 index 359da35..0000000 --- a/tests/stack_machine_old_jump/instructions.s.tcl +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -## Let there be 2 pieces of code - each one storing a different value in memory -## and halting afterwards. Jump instruction should cause the second piece of -## code to execute instead of the first. We'll verify that by checking, which -## value got written. - -## Ufortunately, our assembly currently doesn't compute label addresses for us. - -# Each of those 4 instructions should get encoded into 1 16-bit word, so they -# will take 8 bytes total. Hence jump to address 8 is needed to skip them. -jump 8 -const h12 -store@ h00100 -halt - -# address 8 here -const h34 -store@ h00100 -halt diff --git a/tests/stack_machine_old_jump/test.v b/tests/stack_machine_old_jump/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_jump/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_jump/words_to_verify.mem b/tests/stack_machine_old_jump/words_to_verify.mem deleted file mode 100644 index 4fded2b..0000000 --- a/tests/stack_machine_old_jump/words_to_verify.mem +++ /dev/null @@ -1,2 +0,0 @@ -// address value - 00100 34 diff --git a/tests/stack_machine_old_load_store/instructions.s.tcl b/tests/stack_machine_old_load_store/instructions.s.tcl deleted file mode 100755 index 40a657e..0000000 --- a/tests/stack_machine_old_load_store/instructions.s.tcl +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -### another simple test - set stack to h7FFFC, store 4 numbers on stack (only 2 -### will really get written to memory, other 2 will remain in r0 and r1), -### then pop all the numbers and write them to h57574 - - -## set sp to h7FFFC (actually, lowest bit is assumed 0 and not stored there) -# 7777 FFFF F -# bits 19:11 of h7FFFC are 0111 1111 1 -_immediate im=b011111111 -# FFf FFFF CCCC -# bits 10:0 of h7FFFC are 111 1111 1100 -_immediate im<<=b11111111100 - -_extended_instruction set_sp - -## get value h01010202 into r1 -# 0000 1111 00 -# bits 31:22 of h01010202 are 0000 0001 00 -_immediate im<<=b0000000100 -# 00 1111 0000 2 -# bits 21:11 of h01010202 are 00 0001 0000 0 -_immediate im<<=b00000100000 -# 222 0000 2222 -# bits 10:0 of h01010202 are 010 0000 0010 -_exchange_im im<<=b01000000010 - -## get value h03030404 into r1 -stack down -# 0000 3333 00 -# bits 31:22 of h03030404 are 0000 0011 00 -_immediate im<<=b0000001100 -# 00 3333 0000 4 -# bits 21:11 of h03030404 are 00 0011 0000 0 -_immediate im<<=b00001100000 -# 444 0000 4444 -# bits 10:0 of h03030404 are 100 0000 0100 -_exchange_im im<<=b10000000100 - -## get value h05050606 into r1 -stack down -# 0000 5555 00 -# bits 31:22 of h05050606 are 0000 0101 00 -_immediate im<<=b0000010100 -# 00 5555 0000 6 -# bits 21:11 of h05050606 are 00 0101 0000 0 -_immediate im<<=b00010100000 -# 666 0000 6666 -# bits 10:0 of h05050606 are 110 0000 0110 -_exchange_im im<<=b11000000110 - -## get value h07070808 into r1 -stack down -# 0000 7777 00 -# bits 31:22 of h07070808 are 0000 0111 00 -_immediate im<<=b0000011100 -# 00 7777 0000 8 -# bits 21:11 of h07070808 are 00 0111 0000 1 -_immediate im<<=b00011100001 -# 888 0000 8888 -# bits 10:0 of h07070808 are 000 0000 1000 -_exchange_im im<<=b00000001000 - -## get address h57574 into im and write r1 to that address -# 5555 7777 5 -# bits 19:11 of h57574 are 0101 0111 0 -_immediate im=b010101110 -# 555 7777 4444 -# bits 10:0 of h57574 are 101 0111 0100 -store im<<=b10101110100 - -# get r0 to r1 -stack up - -## get address h57578 into im and write r1 to that address -# 5555 7777 5 -# bits 19:11 of h57578 are 0101 0111 0 -_immediate im=b010101110 -# 555 7777 8888 -# bits 10:0 of h57578 are 101 0111 1000 -store im<<=b10101111000 - -# get r0 to r1 -stack up - -## get address h5757C into im and write r1 to that address -# 5555 7777 5 -# bits 19:11 of h5757C are 0101 0111 0 -_immediate im=b010101110 -# 555 7777 CCCC -# bits 10:0 of h5757C are 101 0111 1100 -store im<<=b10101111100 - -# get r0 to r1 -stack up - -## get address h57580 into im and write r1 to that address -# 5555 7777 5 -# bits 19:11 of h57580 are 0101 0111 0 -_immediate im=b010101110 -# 555 8888 0000 -# bits 10:0 of h57580 are 101 1000 0000 -store im<<=b10110000000 - -## finish test -halt diff --git a/tests/stack_machine_old_load_store/test.v b/tests/stack_machine_old_load_store/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_load_store/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_load_store/words_to_verify.mem b/tests/stack_machine_old_load_store/words_to_verify.mem deleted file mode 100644 index 349b213..0000000 --- a/tests/stack_machine_old_load_store/words_to_verify.mem +++ /dev/null @@ -1,12 +0,0 @@ -// address value - 57574 0808 - 57576 0707 - - 57578 0606 - 5757A 0505 - - 5757C 0404 - 5757E 0303 - - 57580 0202 - 57582 0101 diff --git a/tests/stack_machine_old_mul/instructions.s.tcl b/tests/stack_machine_old_mul/instructions.s.tcl deleted file mode 100755 index 969b19a..0000000 --- a/tests/stack_machine_old_mul/instructions.s.tcl +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -### store 4 values to memory; load 2 of them back, multiply them and store the -### result; load another 2, multiply them and store the result; -### this is similar to addition and substraction tests - -set_sp h7FFFC - -## store first 2 factors -const 483091365 -store@ h1EEE0 -const 74683203 -store@ h1EEE4 - -## store other 2 factors -const 8436 -store@ h1EEEC -const -14020 -store@ h1EEF0 - -## perform the first multiplication -load@ h1EEE0 -stack down -load@ h1EEE4 -# multiplying 483091365 by 74683203 should yield 36078810479842095 -# if we take lowest 32 bits of 36078810479842095 we get 2861683503 -mul -stack up -store@ h1EEE8 - -## perform the second multiplication -load@ h1EEEC -stack down -load@ h1EEF0 -# multiplying 8436 by -14020 should yield -118272720 (which fits in 32 bits) -mul -stack up -store@ h1EEF4 - -halt diff --git a/tests/stack_machine_old_mul/test.v b/tests/stack_machine_old_mul/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_mul/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_mul/words_to_verify.mem b/tests/stack_machine_old_mul/words_to_verify.mem deleted file mode 100644 index 3095d6e..0000000 --- a/tests/stack_machine_old_mul/words_to_verify.mem +++ /dev/null @@ -1,19 +0,0 @@ -// address value - 1EEE0 63A5 // 483091365 in hex is 1CCB63A5 - 1EEE2 1CCB - - 1EEE4 9343 // 74683203 in hex is 4739343 - 1EEE6 473 - - 1EEE8 D32F // 2861683503 in hex is AA91D32F - 1EEEA AA91 - - - 1EEEC 20F4 // 8436 in hex is 20F4 - 1EEEE 0 - - 1EEF0 C93C // -14020 in hex is FFFFC93C - 1EEF2 FFFF - - 1EEF4 4D30 // -118272720 in hex is F8F34D30 - 1EEF6 F8F3 diff --git a/tests/stack_machine_old_multiinstructions_load_store/instructions.s.tcl b/tests/stack_machine_old_multiinstructions_load_store/instructions.s.tcl deleted file mode 100755 index a6316a3..0000000 --- a/tests/stack_machine_old_multiinstructions_load_store/instructions.s.tcl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -### do the same as in stack_machine_2 test, but use higher level instructions - -## set sp to h7FFFC -set_sp h7FFFC -## get value h01010202 into r1 -const h01010202 -## get value h03030404 into r1 -stack down -const h03030404 -## get value h05050606 into r1 -stack down -const h05050606 -## get value h07070808 into r1 -stack down -const h07070808 -## write r1 to address h57574 -store@ h57574 -stack up -## write r1 to address h57578 -store@ h57578 -stack up -## write r1 to address h5757C -store@ h5757C -stack up -## write r1 to address h57580 -store@ h57580 -## finish test -halt diff --git a/tests/stack_machine_old_multiinstructions_load_store/test.v b/tests/stack_machine_old_multiinstructions_load_store/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_multiinstructions_load_store/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_multiinstructions_load_store/words_to_verify.mem b/tests/stack_machine_old_multiinstructions_load_store/words_to_verify.mem deleted file mode 120000 index e82687e..0000000 --- a/tests/stack_machine_old_multiinstructions_load_store/words_to_verify.mem +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_load_store/words_to_verify.mem \ No newline at end of file diff --git a/tests/stack_machine_old_store/instructions.s.tcl b/tests/stack_machine_old_store/instructions.s.tcl deleted file mode 100755 index d7e26b0..0000000 --- a/tests/stack_machine_old_store/instructions.s.tcl +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -### simple test - write value hDEADBEEF to address h3ABCD - -## get value hDEADBEEF into r1 - -# DDDD EEEE AA -# bits 31:22 of hDEADBEEF are 1101 1110 10 -_immediate im<<=b1101111010 -# AA DDDD BBBB E -# bits 21:11 of hDEADBEEF are 10 1101 1011 1 -_immediate im<<=b10110110111 -# EEE EEEE FFFF -# bits 10:0 of hDEADBEEF are 110 1110 1111 -_exchange_im im<<=b11011101111 - -## get address h7579A into im - -# 7777 5555 7 -# bits 19:11 of h7579A are 0111 0101 0 -_immediate im=b011101010 -# 777 9999 AAAA -# bits 10:0 of h7579A are 111 1001 1010 -store im<<=b11110011010 - -## finish test -halt diff --git a/tests/stack_machine_old_store/test.v b/tests/stack_machine_old_store/test.v deleted file mode 100644 index 7e7429f..0000000 --- a/tests/stack_machine_old_store/test.v +++ /dev/null @@ -1,140 +0,0 @@ -`default_nettype none - -`include "messages.vh" - -`ifndef SIMULATION - `error_SIMULATION_not_defined -; /* Cause syntax error */ -`endif - -`ifndef INSTRUCTIONS_COUNT - `error_INSTRUCTIONS_COUNT_must_be_defined -; /* Cause syntax error */ -`endif - -`ifndef WORDS_TO_VERIFY_COUNT - `error_WORDS_TO_VERIFY_COUNT_must_be_defined -; /* Cause syntax error */ -`endif - -module stack_machine_test(); - wire M_ACK_I; - wire M_CLK_I; - wire [19:0] M_ADR_O; - wire [15:0] M_DAT_I; - wire [15:0] M_DAT_O; - wire M_RST_I; - wire M_STB_O; - wire M_CYC_O; - wire M_WE_O; - wire M_STALL_I; - - wire S_ACK_O; - wire S_CLK_I; - wire [17:0] S_ADR_I; - wire [15:0] S_DAT_I; - wire [15:0] S_DAT_O; - wire S_RST_I; - wire S_STB_I; - wire S_WE_I; - wire S_STALL_O; - - /* Non-wishbone */ - wire M_finished; - - stack_machine stack_machine - ( - .ACK_I(M_ACK_I), - .CLK_I(M_CLK_I), - .ADR_O(M_ADR_O), - .DAT_I(M_DAT_I), - .DAT_O(M_DAT_O), - .RST_I(M_RST_I), - .STB_O(M_STB_O), - .CYC_O(M_CYC_O), - .WE_O(M_WE_O), - .STALL_I(M_STALL_I), - - .finished(M_finished) - ); - - memory_slave_model - #( - .SLAVE_NR(0), - .WRITABLE(1), - .WORDS_TO_INITIALIZE(`INSTRUCTIONS_COUNT), - .INITIAL_CONTENTS_FILE("instructions.mem") - ) slave - ( - .ACK_O(S_ACK_O), - .CLK_I(S_CLK_I), - .ADR_I(S_ADR_I), - .DAT_I(S_DAT_I), - .DAT_O(S_DAT_O), - .RST_I(S_RST_I), - .STB_I(S_STB_I), - .WE_I(S_WE_I), - .STALL_O(S_STALL_O) - ); - - reg CLK; - reg RST; - - assign M_ACK_I = S_ACK_O; - assign M_CLK_I = CLK; - assign M_DAT_I = S_DAT_O; - assign M_RST_I = RST; - assign M_STALL_I = S_STALL_O; - - assign S_CLK_I = CLK; - assign S_ADR_I = M_ADR_O[17:0]; /* Ignore 2 topmost bits */ - assign S_DAT_I = M_DAT_O; - assign S_RST_I = RST; - assign S_STB_I = M_STB_O && M_CYC_O; - assign S_WE_I = M_WE_O; - - integer i, j; - reg [17:0] address; - reg [15:0] expected_value; - - reg [19:0] words_to_verify[`WORDS_TO_VERIFY_COUNT * 2 - 1 : 0]; - - initial begin - CLK <= 0; - RST <= 1; - - for (i = 0; i < 3500; i++) begin - #1; - - CLK <= ~CLK; - - if (CLK) - RST <= 0; - - if (M_finished) begin - $readmemh("words_to_verify.mem", words_to_verify, - 0, `WORDS_TO_VERIFY_COUNT * 2 - 1); - - for (j = 0; j < `WORDS_TO_VERIFY_COUNT; j++) begin - /* - * Byte-grained addresses are used in CPU, and we also use - * them in tclasm opcodes and in files with words for - * verification. Slaves and wishbone address 16-bit words, not - * single bytes. We need to drop the lowest bit here. - */ - address = words_to_verify[2 * j][19:1]; - expected_value = words_to_verify[2 * j + 1]; - if (slave.memory[address] !== expected_value) begin - `MSG(("error: expected h%x at h%x, but got h%x", - expected_value, address, slave.memory[address])); - end - end - - $finish; - end // if (M_finished) - end // for (i = 0; i < 3500; i++) - - $display("error: cpu hasn't finished its operations in 1750 ticks"); - $finish; - end // initial begin -endmodule // stack_machine_test diff --git a/tests/stack_machine_old_store/words_to_verify.mem b/tests/stack_machine_old_store/words_to_verify.mem deleted file mode 100644 index 9056a1b..0000000 --- a/tests/stack_machine_old_store/words_to_verify.mem +++ /dev/null @@ -1,3 +0,0 @@ -// address value - 7579A BEEF - 7579C DEAD diff --git a/tests/stack_machine_old_sub/instructions.s.tcl b/tests/stack_machine_old_sub/instructions.s.tcl deleted file mode 100755 index 33873ef..0000000 --- a/tests/stack_machine_old_sub/instructions.s.tcl +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -### store 2 values to memory, load them back, substract them and store the -### result; this is analogous to addition test - -set_sp h7FFFC -const 68996288 -store@ h1EEE0 -const 540904416 -store@ h1EEE4 - -load@ h1EEE0 -stack down -load@ h1EEE4 -# substracting 540904416 from 68996288 should yield -471908128 -sub -stack up -store@ h1EEE8 -halt diff --git a/tests/stack_machine_old_sub/test.v b/tests/stack_machine_old_sub/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_sub/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_sub/words_to_verify.mem b/tests/stack_machine_old_sub/words_to_verify.mem deleted file mode 100644 index cc666fa..0000000 --- a/tests/stack_machine_old_sub/words_to_verify.mem +++ /dev/null @@ -1,9 +0,0 @@ -// address value - 1EEE0 CCC0 // 68996288 in hex is 41CCCC0 - 1EEE2 41C - - 1EEE4 8BE0 // 540904416 in hex is 203D8BE0 - 1EEE6 203D - - 1EEE8 40E0 // -471908128 in hex is E3DF40E0 - 1EEEA E3DF diff --git a/tests/stack_machine_old_swap/instructions.s.tcl b/tests/stack_machine_old_swap/instructions.s.tcl deleted file mode 100755 index 536a921..0000000 --- a/tests/stack_machine_old_swap/instructions.s.tcl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -set_sp h7FFFC -const h00AD00DE -stack down -const h00EF00BE -swap -## Because values were swapped, h00AD00DE should get written, first, at lower -## address (h100) and h00EF00BE should be written next (at h104) -store@ h00100 -stack down -store@ h00104 -halt diff --git a/tests/stack_machine_old_swap/test.v b/tests/stack_machine_old_swap/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_swap/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_swap/words_to_verify.mem b/tests/stack_machine_old_swap/words_to_verify.mem deleted file mode 100644 index 669219d..0000000 --- a/tests/stack_machine_old_swap/words_to_verify.mem +++ /dev/null @@ -1,5 +0,0 @@ -// address value - 00100 DE - 00102 AD - 00104 BE - 00106 EF diff --git a/tests/stack_machine_old_tee/instructions.s.tcl b/tests/stack_machine_old_tee/instructions.s.tcl deleted file mode 100755 index 7fccd6f..0000000 --- a/tests/stack_machine_old_tee/instructions.s.tcl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env tclsh - -source tclasm_old.tcl - -set_sp h7FFFC -const hABCDEF -stack down -const hA98765 -tee -## hA98765 should now be replaced with hABCDEF - we should have -## two hABCDEF's on stack - let's store them for verification -store@ h00100 -stack up -store@ h00104 -halt diff --git a/tests/stack_machine_old_tee/test.v b/tests/stack_machine_old_tee/test.v deleted file mode 120000 index f0c3cf9..0000000 --- a/tests/stack_machine_old_tee/test.v +++ /dev/null @@ -1 +0,0 @@ -../stack_machine_old_store/test.v \ No newline at end of file diff --git a/tests/stack_machine_old_tee/words_to_verify.mem b/tests/stack_machine_old_tee/words_to_verify.mem deleted file mode 100644 index 961f9dc..0000000 --- a/tests/stack_machine_old_tee/words_to_verify.mem +++ /dev/null @@ -1,5 +0,0 @@ -// address value - 00100 CDEF - 00102 AB - 00104 CDEF - 00106 AB -- cgit v1.2.3