| 1 |
2 |
marcelos |
# Lattice XP2 Brevia 2 board
|
| 2 |
|
|
|
| 3 |
|
|
## General information
|
| 4 |
|
|
The Lattice Brevia 2 board is a small development board for the Lattice XP2
|
| 5 |
|
|
family of FPGAs. It has a Lattice LFXP2-5E-6 chip in a QFP 144-pin package and
|
| 6 |
|
|
also includes the following peripherals:
|
| 7 |
|
|
* An 1MBit SRAM - IDT71V124SA1
|
| 8 |
|
|
* 2MBit SPI flash - SST25VF020
|
| 9 |
|
|
* FT2232 for for FPGA programming/debugging and serial-to-USB on the second channel
|
| 10 |
|
|
* 8 LEDs
|
| 11 |
|
|
* 4 push-buttons and 4 microswitches
|
| 12 |
|
|
* a 50MHz oscillator
|
| 13 |
|
|
* Pin headers for all IOs
|
| 14 |
|
|
|
| 15 |
|
|
The DarkRISCV/darksoc builds out-of-the box using Lattice Diamond command-line,
|
| 16 |
|
|
taking about ~60% of the on-chip LUTs for the SoC demo.
|
| 17 |
|
|
|
| 18 |
|
|
## Instructions
|
| 19 |
|
|
Building and running the board has been tested on Linux only. You'll need the
|
| 20 |
|
|
following software intalled on your system:
|
| 21 |
|
|
- GNU make; Icarus Verilog; gtkwave if you want to examine the simulation output
|
| 22 |
|
|
- Lattice Diamond installed and properly licensed.
|
| 23 |
|
|
|
| 24 |
|
|
Once you have the above, edit the top-level Makefile and set
|
| 25 |
|
|
```
|
| 26 |
|
|
BOARD = lattice_brevia2_xp2
|
| 27 |
|
|
```
|
| 28 |
|
|
While there, also make sure to correctly set the paths to your other tools, eg.
|
| 29 |
|
|
CROSS, CCPATH, ICARUS
|
| 30 |
|
|
|
| 31 |
|
|
Next check *boards/lattice_brevia2_xp2/darksocv.mk* and make sure that
|
| 32 |
|
|
DIAMOND_PATH matches your environment.
|
| 33 |
|
|
|
| 34 |
|
|
Finally, execute "make" in the top-level directory. First the Icarus simulation
|
| 35 |
|
|
is executed and you should be greeted with the familiar logo. After that, the
|
| 36 |
|
|
Lattice-specific build commences and if everything goes well, after a few pages
|
| 37 |
|
|
of output, you should see
|
| 38 |
|
|
```
|
| 39 |
|
|
Saving bit stream in "darksocv_impl1.jed".
|
| 40 |
|
|
Total CPU Time: 3 secs
|
| 41 |
|
|
Total REAL Time: 3 secs
|
| 42 |
|
|
Peak Memory Usage: 1010572 MB
|
| 43 |
|
|
cp lattice_brevia2_xp2/impl1/darksocv_impl1.jed ../tmp/darksocv.bit
|
| 44 |
|
|
echo build ok.
|
| 45 |
|
|
build ok.
|
| 46 |
|
|
```
|
| 47 |
|
|
|
| 48 |
|
|
Program the board with the output JEDEC file (boards/lattice_brevia2_xp2/impl1/darksocv_impl1.jed)
|
| 49 |
|
|
file, using either the GUI Lattice Programmer or the command-line prgrcmd utility
|
| 50 |
|
|
```
|
| 51 |
|
|
LD_LIBRARY_PATH="/usr/local/diamond/3.11_x64/bin/lin64/:/usr/local/diamond/3.11_x64/ispfpga/bin/lin64/"
|
| 52 |
|
|
/usr/local/diamond/3.11_x64/bin/lin64/pgrcmd -infile lattice_brevia2_xp2.xcf
|
| 53 |
|
|
```
|
| 54 |
|
|
|
| 55 |
|
|
Connect a terminal emulator to the on-boards FT2232 second channel, for example:
|
| 56 |
|
|
```
|
| 57 |
|
|
cu -l /dev/ttyUSB1 -s 115200
|
| 58 |
|
|
```
|
| 59 |
|
|
Reset the board and enjoy!
|
| 60 |
|
|
|
| 61 |
|
|
|
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
Notes:
|
| 65 |
|
|
* No effort has been made to optimize resource utilization
|
| 66 |
|
|
* There are quite a lot of warnings during the build. No effort has been made
|
| 67 |
|
|
to clear (or even understand) them. There are probably bugs hiding there
|
| 68 |
|
|
as well.
|
| 69 |
|
|
* The default 50MHz oscillator is used as the core clock. Using a PLL, the core
|
| 70 |
|
|
could probably go faster, but this is outside the scope of the current work.
|
| 71 |
|
|
* There seems to be an issue (race condition of sorts?) with the interaction
|
| 72 |
|
|
UART/Timer/Threading. The sympthoms are either the simulation outputing '01'
|
| 73 |
|
|
or nothing at all, the actual board doing the same, the actual board not
|
| 74 |
|
|
being able to display board information (model, clock speed, etc) or the
|
| 75 |
|
|
timer not working (i.e. board stalled after 'reboot'). The easiest
|
| 76 |
|
|
work-around seems to be to remote the two ```putchar('0'+tmp);``` calls
|
| 77 |
|
|
inside src/boot.c. Again, this is only a work-around and the problem could
|
| 78 |
|
|
manifest at any point.
|
| 79 |
|
|
|