
6.5. SOFTWARE IMPLEMENTATION
65
purpose register space in group 24 (the gr oup is selected with bit 15 - 11 of a special
purpose register address), the three addresses for the three special purpose registers in
the vlx unit is shown in table 6.2. If you feel like adding more special purpose registers
you are free to do so, you are also free to remap the special purpose registers, e.g. if
you want to use a 64 bit buffer instead of intended 32 bit version. Although if you
remap the special purpose registers you have to specify the new mapping in your lab
report. In case you do a remapping of the special purpose registers, you have to map
your new registers to group 24 (or any other group free for custom use see [6], but this
requires more extensive modifications in other modules of the processor).
Register Name Register Function SPR address
bit_reg_wr_pos next free bit position in the bit buffer 0xc000
bit_reg buffers 32 bit, written to memory when full 0xc001
vlx_addr_o next address to write a full buffer to 0xc002
Table 6.2: VLX register specification
Write your RTL code inside the
‘ifdef OR1200_SBIT_IMPL ... ‘endif
regions, this
makes it easy for you to identify your code and you can also easily remove your hard-
ware from the design.
6.4.1 Constructing the Hardware
Some general advise, worth repeating, when building the hardware is to always know
what you are building when writing the Verilog code. In general, you should have a
clear picture of the RTL design, before you start writing the HDL code.
A good design methodology is to do hierarchical design, i.e. create and instantiate
a number of modules. Each module can then be tested with a separate test bench before
integrating them. You are encouraged to use the suggested architecture discussed in
section 6.3 but of course you are free to come up with an architecture of your own.
6.5 Software Implementation
When you think that your hardware works it is time to put the new instruction to use.
6.5.1 Running the Instruction
If you have built the hardware correctly it should now be possible to use the new
instruction in your program. However the compiler does not know anything about the
new instruction. So either you have to modify the compiler or you can use in-line
assembler in your C program.
The in-line assembler directive allows you to insert assembly code verbatim into
the object file. A short example is shown in Listing 6.1. This and the rest of the text
will show you what you need to know for this task.
Listing 6.1: Inline assembler example.
asm v o l a t i l e ( a s s e m b l e r t e m p l a t e
Comentarios a estos manuales