|  
      
  
 
  
 
In order to test your
project, you need to assemble programs to be loaded into memory. To
do this, there is a simple assembler provided. It will take source
code that looks like the text in figure below and produces two files:
An object file and a listing for your reference. 
 
An example assembly program 
 
slbi    r1, 0
slbi    r1, 0x55
slli    r2, r1, 8
bnez    r2, .LAB3
subi    r2, r2, 1
.LAB3:
halt
 
// An example object file 
 
@0
9100
9155
a948
6a01
4a41
0000
 
// An example binary listing
(.lst file) 
 
0000 9100 slbi  r1, 0
0001 9155 slbi  r1, 0x55
0002 a948 slli  r2, r1, 8
0003 6a01 bnez  r2, .LAB3
0004 4a41 subi    r2, r2, 1
0005      .LAB3:
0005 0000 halt
 
The assembler is located here: 
/p/course/cs552-david/public/html/S12/handouts/bins/assemble.sh
 
That directory has already
been added to your PATH
variable. 
 
Say you have a source file
names "myfile.asm"; to assemble it, type: assemble.sh
myfile.asm 
 
This produces two files: The
listing file is called loadfile.lst
and the object file is the second name specified (loadfile_all.img).
For now, simply use the loadfile_all.img
file and copy it to the same location where you have memory2c.v 
 
The assembler always
produces a warning that if there are any errors, the output is not
valid. This is just a reminder -- this message itself is not an
error. 
 
See running the programs in
the WISC-SP12
simulator/debugger. 
The assembler will also
produce 4 files of the form loadfile_0,1,2,3.img.
These are binary images you can load into the four-banked memory when
you get to it. You load one of these files into each bank. 
 
Assembler Syntax
Assembly programs are
written using the semantics outlined in the WISC-SP08 ISA document. C
style comments can be used (//). Static data and labels can be used
as follows: 
 
Labels: 
 
beqz r0, .label1
.label1:
<-- code here -->
 
Static data: 
 
lbi r0, L.DataArea //load the lower half of datum
slbi r0, U.DataArea //load the upper half of datum
.DataArea
data 0x1234
data 0x5678 
  
 
  
 
  
 
 
 
 
 
   
   |