Skip to the content.
Documentation top

VisUAL2 Testbenches

To get started quickly go through the Tutorial.

Visual2 allows predefined tests written in a testbench file to be run on an assembler file. Each test will

There are two ways to run a testbench tb.s on an assembly file myprog.s.

  1. Load tb.s and myprog.s with no other .s file. Run Test -> Run All Tests
  2. Load tb.s and myprog.s with no other .s file. View the tab containing tb.s. Click Run.

When a testbench is run it will go through its tests and mark each test (with red or green lines in the testbench tab) to say whether it has passed or failed. If a test fails no additional tests will be checked.

Debugging Tested Code

Writing Testbenches

Syntax

A .s file loaded into VisUAL2 is considered a testbench if it starts with the line:

##TESTBENCH  other characters form comment

Tests

Subsequent lines make up a sequence of 1 or more Tests. Each Test consists of lines that specify inputs and outputs used in testing an assembler program, and other test parameters, and starts with a single-line Test header prefixed by #.

Within the lines of a test each line is parsed separately. Order of lines does not matter.

#TEST 1 ; this test does something
<lines of Test 1>
#TEST 2
<lines of test 2>

Tutorial

##TESTBENCH

#TEST 1
IN R0 is 1
IN R1 is 2
OUT R2 is 3
IN R3 ptr 1,2,3,7,11
IN R4 ptr 6,10,88,100,900

#TEST 2
IN R0 is 10
IN R1 is 200
OUT R2 is 210
IN R3 ptr 1,2,3,7,11
IN R4 ptr 6,10,88,100,900