Computer Architecture Lab/WS2007/diogenes tools

Assembler Syntax edit

The Assembler of Diogenes is generated using YACC and LEX. It supports simple jump (call) labels that might either be a string or a number followed by a semicolon.

  a_label:

To jump to a label a branch instruction like brz (branch on zero) is followed by a semicolon and the label name.

  brz h0, :a_label    @ jump to "a_label" when register h0 is zero

Unlike Branches jumps (and calls) are always absolute jumps, that jump to the address stored in a register. As jump addresses are 32 Bit wide and only 8 Bit Load Immediate instructions are available on diogenes, four instructions are needed to load Jump addresses:

  ldi h0, 0x12
  lsi h0, 0x34
  lsi h0, 0x56
  lsi h0, 0x78

But the assembler supports the builtin macro LDL (Load Label) that can be used to write the above in yust one line:

  LDL h0, 0x12345678

Furthermore LDL supports the loading of 32 Bit Label Addresses:

  LDL h0, :a_label
  jump <h0>

For more details see Instruction Set and Assembler Examples.

Assembler usage edit

The assembler binary is just called asm. It reads from stdin and writes to stdout. By default it produces a file suitable for direct download via the serial link. But with the parameters -h and -b it generates its output in hexadizimal respectively ACSII-coded binary format, that were use during development of the bootloader.

  cat input.asm | ./asm > output.bin
  cat input.asm | ./asm -h > output.hex
  cat input.asm | ./asm -b > output.coe (without header, Binary ASCII)

Simulator Usage edit

The simulator expects its first parameter to be the name of a binary (downloadable) file. It generates its output to stdout, while stderr is used for debugging purposes (as far as the simulator is compiled with USE_DEBUG=1). So a common call of the simulator binary would look something like

  ./sim output.bin 2> debug.log

Example Run of the Simulator edit

UART input: "ABCD"
  $ ./sim ../examples/echo_scrambler.bin 2> t 
                             UART ad(1): 066  0x42 (B)
  -#-----#LED: 065  0x41 (A)
                             UART ad(1): 067  0x43 (C)
  -#----#-LED: 066  0x42 (B)
                             UART ad(1): 068  0x44 (D)
  -#----##LED: 067  0x43 (C)
                             UART ad(1): 069  0x45 (E)
  -#---#--LED: 068  0x44 (D)
                             UART ad(1): 011  0x0b (.)
  ----#-#-LED: 010  0x0a (.)

Simulation of the VGA port edit

The Simulator is capable of simulating the output of the VGA port. Every few emulated cycles (for example every 40000) a snapshot of the display is stored in a file called picXXXX.tga where XXXX is a n increasing number. A demonstration of this feature can be seen here.

Transfer Utility edit

We made a simple utility that sends binary files to the target. It can be found in the download section in the simulator.tar.gz file. It reads from stdin and writes /dev/USB0 which is what we use for our serial cable.

  cat output.bin | ./sendb