diff options
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | tclasm.tcl | 85 | ||||
-rwxr-xr-x | tests/stack_machine_store/instructions.s.tcl | 58 | ||||
-rw-r--r-- | tests/stack_machine_store/test.v | 216 | ||||
-rw-r--r-- | tests/stack_machine_store/words_to_verify.mem | 3 |
5 files changed, 377 insertions, 1 deletions
@@ -32,6 +32,9 @@ STACK_MACHINE_OLD_TESTS := \ swap \ cond_jump +STACK_MACHINE_TESTS := \ + store + # Add other tests here if You need TESTS := \ self \ @@ -42,7 +45,8 @@ TESTS := \ sram_slave \ embedded_bram_slave \ soc_simple_display \ - $(addprefix stack_machine_old_,$(STACK_MACHINE_OLD_TESTS)) + $(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 # and compare it to VGAdump_expected.ppm inside that test's directory @@ -149,6 +153,16 @@ tests/vga/test.vvp : tests/vga/test.v design/vga.v models/vga_display.v \ include/messages.vh $(IV) $(IVFLAGS) -s vga_test $^ -o $@ +tests/stack_machine_%/test.vvp : \ + tests/stack_machine_%/words_to_verify.mem \ + tests/stack_machine_%/instructions.mem \ + tests/stack_machine_%/test.v models/slave.v \ + design/stack_machine.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/stack_machine_old_%/test.vvp : \ tests/stack_machine_old_%/words_to_verify.mem \ tests/stack_machine_old_%/instructions.mem \ @@ -0,0 +1,85 @@ +#!/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 low-level 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_immutables-0.2.tar.gz immutables-0.2.zip | Elvis Pranskevichus | 7 years |