Line 1... |
Line 1... |
SSBCC.9x8 is a free Small Stack-Based Computer Compiler with a 9-bit opcode,
|
SSBCC.9x8 is a free Small Stack-Based Computer Compiler with a 9-bit opcode,
|
8-bit data core. It creates vendor-independent, high-speed, low fabric
|
8-bit data core designed to facilitate FPGA HDL development.
|
utilization micro controllers for FPGAs. It has been used in Spartan-3A,
|
|
Spartan-6, Virtex-6, and Artix-7 FPGAs and has been built for Altera, Lattice,
|
The primary design criteria are:
|
and other Xilinx devices. It is faster and usually smaller than vendor provided
|
- high speed (to avoid timing issues)
|
processors.
|
- low fabric utilization
|
|
- vendor independent
|
|
- development tools available for all operating systems
|
|
|
|
It has been used in Spartan-3A, Spartan-6, Virtex-6, and Artix-7 FPGAs and has
|
|
been built for Altera, Lattice, and other Xilinx devices. It is faster and
|
|
usually smaller than vendor provided processors.
|
|
|
The compiler takes an architecture file that describes the micro controller
|
The compiler takes an architecture file that describes the micro controller
|
memory spaces, inputs and outputs, and peripherals and which specifies the HDL
|
memory spaces, inputs and outputs, and peripherals and which specifies the HDL
|
language and source assembly. It generates a single HDL module implementing
|
language and source assembly. It generates a single HDL module implementing
|
the entire micro controller. No user-written HDL is required to instantiate
|
the entire micro controller. No user-written HDL is required to instantiate
|
I/Os, program memory, etc.
|
I/Os, program memory, etc.
|
|
|
|
The features are:
|
|
- high speed, low fabric utilization
|
|
- vendor-independent Verilog output with a VHDL package file
|
|
- simple Forth-like assembly language (41 instructions)
|
|
- single cycle instruction execution
|
|
- automatic generation of I/O ports
|
|
- configurable instruction, data stack, return stack, and memory utilization
|
|
- extensible set of peripherals (I2C busses, UARTs, AXI4-Lite busses, etc.)
|
|
- extensible set of macros
|
|
- memory initialization file to facilitate code development without rebuilds
|
|
- simulation diagnostics to facilitate identifying code errors
|
|
- conditionally included I/Os and peripherals, functions, and assembly code
|
|
|
SSBCC has been used for the following projects:
|
SSBCC has been used for the following projects:
|
- operate a media translator from a parallel camera interface to an OMAP GPMC
|
- operate a media translator from a parallel camera interface to an OMAP GPMC
|
interface, detect and report bus errors and hardware errors, and act as an
|
interface, detect and report bus errors and hardware errors, and act as an
|
SPI slave to the OMAP
|
SPI slave to the OMAP
|
- operate two UART interfaces and multiple PWM controlled 2-lead bi-color LEDs
|
- operate two UART interfaces and multiple PWM controlled 2-lead bi-color LEDs
|
- operate and monitor the Artix-7 fabric in a Zynq system using AXI4-Lite
|
- operate and monitor the Artix-7 fabric in a Zynq system using AXI4-Lite
|
master and slave buses, I2C buses for timing-critical voltage measurements
|
master and slave buses, I2C buses for timing-critical voltage measurements
|
|
|
|
The only external tool required is Python 2.7.
|
|
|
|
|
DESCRIPTION
|
DESCRIPTION
|
================================================================================
|
================================================================================
|
|
|
The computer compiler uses an architectural description of the processor stating
|
The computer compiler uses an architectural description of the processor stating
|
the sizes of the instruction memory, data stack, and return stack; the input and
|
the sizes of the instruction memory, data stack, and return stack; the input and
|
output ports; RAM and ROM types and sizes; and peripherals.
|
output ports; RAM and ROM types and sizes; and peripherals.
|
|
|
The instructions are all single-cycle. The instructions include
|
The instructions are all single-cycle. The instructions include
|
- pushing an 8-bit value onto the data stack
|
- 4 arithmetic instructions: addition, subtraction, increment, and decrement
|
- arithmetic operations: addition, subtraction, increment, and decrement
|
- 3 bit-wise logical instructions: and, or, and exclusive or
|
- bit-wise logical operations: and, or, and exclusive or
|
- 7 shift and rotation instructions: <<0, <<1, 0>>, 1>>, <>msb, and >>lsb
|
- rotations
|
- 4 logical instructions: 0=, 0<>, -1=, -1<>
|
- logical operations: 0=, 0<>, -1=, -1<>
|
- 6 Forth-like data stack instructions: drop, dup, nip, over, push, swap
|
- Forth-like data stack operations: dup, over, swap, drop, nip
|
- 3 Forth-like return stack instructions: >r, r>, r@
|
- Forth-like return stack operations: >r, r>, r@
|
- 2 input and output
|
- input and output port operations
|
- 6 memory read and write with optional address post increment and post decrement
|
- memory read and write with optional address post increment and post decrement
|
- 2 jump and conditional jump
|
- jumps and conditional jumps
|
- 2 call and conditional call
|
- calls and conditional calls
|
- 1 function return
|
- function return
|
- 1 nop
|
|
|
The 9x8 address space is up to 8K. This is achieved by pushing the 8 lsb of the
|
The 9x8 address space is up to 8K. This is achieved by pushing the 8 lsb of the
|
target address onto the data stack immediately before the jump or call
|
target address onto the data stack immediately before the jump or call
|
instruction and by encoding the 5 msb of the address within the jump or call
|
instruction and by encoding the 5 msb of the address within the jump or call
|
instruction. The instruction immediately following a jump, call, or return is
|
instruction. The instruction immediately following a jump, call, or return is
|
Line 49... |
Line 70... |
(this is illustrated later).
|
(this is illustrated later).
|
|
|
Up to four banks of memory, either RAM or ROM, are available. Each of these can
|
Up to four banks of memory, either RAM or ROM, are available. Each of these can
|
be up to 256 bytes long, providing a total of up to 1 kB of memory.
|
be up to 256 bytes long, providing a total of up to 1 kB of memory.
|
|
|
The assembly language is Forth-like. Macros are used to encode the jump and
|
The assembly language is Forth-like. Built-in macros are used to encode the
|
call instructions and to encode the 2-bit memory bank index in memory store and
|
jump and call instructions and to encode the 2-bit memory bank index in memory
|
fetch instructions.
|
store and fetch instructions.
|
|
|
The computer compiler and assembler are written in Python 2.7. Peripherals are
|
The computer compiler and assembler are written in Python 2.7. Peripherals are
|
implemented by Python modules which generate the I/O ports and the peripheral
|
implemented by Python modules which generate the I/O ports and the peripheral
|
HDL.
|
HDL.
|
|
|
Line 63... |
Line 84... |
documented in the core/9x8/doc directory. Several examples are provided.
|
documented in the core/9x8/doc directory. Several examples are provided.
|
|
|
The computer compiler and assembler are fully functional and there are no known
|
The computer compiler and assembler are fully functional and there are no known
|
bugs.
|
bugs.
|
|
|
Features and peripherals are still being added and the documentation is
|
|
incomplete. The output HDL is currently restricted to Verilog although a VHDL
|
|
package file is automatically generated by the computer compiler.
|
|
|
|
|
|
SPEED AND RESOURCE UTILIZATION
|
SPEED AND RESOURCE UTILIZATION
|
================================================================================
|
================================================================================
|
These device speed and resource utilization results are copied from the build
|
These device speed and resource utilization results are copied from the build
|
tests. The full results are listed in core/9x8/build/uc/uc_led.9x8 which
|
tests. The full results are listed in core/9x8/build/uc/uc_led.9x8 which
|
Line 95... |
Line 112... |
particularly with lots of I/O ports and peripherals and with the constraint of
|
particularly with lots of I/O ports and peripherals and with the constraint of
|
existing with other subsystems in the FPGA fabric. What these performance
|
existing with other subsystems in the FPGA fabric. What these performance
|
numbers do provide is an estimate of the amount of slack available. For
|
numbers do provide is an estimate of the amount of slack available. For
|
example, you can't realistically expect to get 110 MHz from a processor that,
|
example, you can't realistically expect to get 110 MHz from a processor that,
|
under ideal conditions, routes and places at 125 MHz, but you can with a
|
under ideal conditions, routes and places at 125 MHz, but you can with a
|
processor that synthesizes at more than 150 MHz.
|
processor that synthesizes at 150 MHz.
|
|
|
|
|
EXAMPLE:
|
EXAMPLE:
|
================================================================================
|
================================================================================
|
|
|
Line 274... |
Line 291... |
|
|
Forth uses counted strings, which are specified here as
|
Forth uses counted strings, which are specified here as
|
|
|
C"Hello World!"
|
C"Hello World!"
|
|
|
In this case the number of characters, 12 in this example, in the string is
|
In this case the number of characters, 12, in the string is pushed onto the data
|
pushed onto the data stack after the 'H', i.e., the instruction sequence would
|
stack after the 'H', i.e., the instruction sequence would be
|
be
|
|
|
|
'!' 'd' 'l' ... 'e' 'H' 12
|
'!' 'd' 'l' ... 'e' 'H' 12
|
|
|
Finally, a lesser-counted string specified like
|
Finally, a lesser-counted string specified like
|
|
|
Line 1056... |
Line 1072... |
...
|
...
|
|
|
The following macros are provided in macros/9x8:
|
The following macros are provided in macros/9x8:
|
.push16(v) push the 16-bit (2-byte) value "v" onto the data stack with the
|
.push16(v) push the 16-bit (2-byte) value "v" onto the data stack with the
|
MSB at the top of the data stack
|
MSB at the top of the data stack
|
|
.push24(v) push the 24-bit (3-byte) value "v" onto the data stack with the
|
|
MSB at the top of the data stack
|
.push32(v) push the 32-bit (4-byte) value "v" onto the data stack with the
|
.push32(v) push the 32-bit (4-byte) value "v" onto the data stack with the
|
MSB at the top of the data stack
|
MSB at the top of the data stack
|
|
.pushByte(v,ix)
|
|
push the ix'th byte of v onto the data stack
|
|
Note: ix=0 designates the LSB
|
|
|
Directories are searched in the following order for macros:
|
Directories are searched in the following order for macros:
|
.
|
.
|
./macros
|
./macros
|
include paths specified by the '-M' command line option.
|
include paths specified by the '-M' command line option.
|
Line 1070... |
Line 1091... |
The python scripts in core/9x8/macros and macros/9x8 can be used as design
|
The python scripts in core/9x8/macros and macros/9x8 can be used as design
|
examples for user-defined macros. The assembler does some type checking based
|
examples for user-defined macros. The assembler does some type checking based
|
on the list provided when the macro is registered by the "AddMacro" method, but
|
on the list provided when the macro is registered by the "AddMacro" method, but
|
additional type checking is often warranted by the macro "emitFunction" which
|
additional type checking is often warranted by the macro "emitFunction" which
|
emits the actual assembly code. The ".fetchvector" and ".storevector" macros
|
emits the actual assembly code. The ".fetchvector" and ".storevector" macros
|
demonstrates how to design variable-length macros.
|
demonstrates how to design variable-length macros. Several macros in
|
|
core/9x8/macros illustrate designing macros with optional arguments.
|
|
|
It is not an error to repeat the ".macro MACRO_NAME" directive for user-defined
|
It is not an error to repeat the ".macro MACRO_NAME" directive for user-defined
|
macros. The assembler will issue a fatal error if a user-defined macro
|
macros. The assembler will issue a fatal error if a user-defined macro
|
conflicts with a built-in macro.
|
conflicts with a built-in macro.
|
|
|
Line 1196... |
Line 1218... |
|
|
|
|
MISCELLANEOUS
|
MISCELLANEOUS
|
================================================================================
|
================================================================================
|
|
|
|
Features and peripherals are still being added and the documentation is
|
|
incomplete. The output HDL is currently restricted to Verilog although a VHDL
|
|
package file is automatically generated by the computer compiler.
|
|
|
The "INVERT_RESET" configuration command is used to indicate an active-low reset
|
The "INVERT_RESET" configuration command is used to indicate an active-low reset
|
is input to the micro controller rather than an active-high reset.
|
is input to the micro controller rather than an active-high reset.
|
|
|
A VHDL package file is automatically generated by the computer compiler.
|
A VHDL package file is automatically generated by the computer compiler.
|