OpenCores
URL https://opencores.org/ocsvn/softavrcore/softavrcore/trunk

Subversion Repositories softavrcore

[/] [softavrcore/] [trunk/] [README] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 apal
Soft AVR Core + Interfaces
2
==========================
3
 
4
Introduction
5
------------
6
 
7
This package is a full-stack implementation of the AVR 2-stage pipeline,
8
featuring synthesis for AVR2 (classic core), AVR2.5 (classic plus), AVR3
9
(with extended program memory), AVR4 (enhanced core) and AVR5 (enhanced core
10
with extended program memory). Interrupts are supported with customized number
11
of IRQ vector width.
12
 
13
The project comes with some example peripherals, such as UART, SPI, a
14
basic timer, output port and SysTick timer.
15
 
16
Synthetized and tested using various tools, including free & open source
17
packages:
18
 - iCE40HX8K-BG121 and iCE40HX8K-CT256 (on ICE40HX8K-B-EVN and custom
19
design boards): Project IceStorm: yosys-0.9, nextpnr-ice40 and icestorm
20
utilities;
21
 - iCE40HX8K-BG121 and iCE40HX8K-CT256 (on ICE40HX8K-B-EVN and custom
22
design boards): Lattice iCEcube2; and
23
 - XA7A100T-1CSG324 (on a Digilent Nexys A7 board): Xilinx Vivado 2019.1.
24
 
25
Software run by the core can seamlessly be built with the AVR-GCC
26
toolchain. This bundle includes utilities aiding the conversion from ELF
27
output to BRAM initializations (designed for iCE40 EBRs) or generic
28
synchronous ROM interface to set up the initial program memory. A
29
configurable startup code (crt0.s) is included in the package with
30
options to be matched to the synthetized core architecture.
31
 
32
Availability
33
------------
34
 
35
This package is available from https://szofi.net/pub/verilog/softavrcore/.
36
Select the softavrcore-latest.tar.gz file for the latest version. Comments
37
are welcomed! Contact: Andras Pal .
38
 
39
Getting started
40
---------------
41
 
42
 - On a Linux system, install the following toolchains and utilities:
43
        * gcc-avr
44
        * avr-libc
45
        * binutils-avr
46
        * icestorm
47
        * yosys
48
        * nextpnr-ice40
49
   then enter `make` in the main directory. This will compile the example
50
   C code (found in ./build) and then run the synthesis and place-and-route
51
   targeted for the ICE40HX8K-B-EVN board. This step is automatically following
52
   by the generation of the FPGA configuration bitstream for iCE40HX8K-CT256
53
   in the file top.bin.
54
 
55
 - On another operating systems for non-Lattice FPGA targets:
56
        * use the corresponding AVR port to compile the source and create
57
          the main.bin file. A working bash/awk is needed to automatically
58
          create the *.v files containing the flash interface for this
59
          virtual MCU. These are available on MacOS by default. On Windows, you
60
          may need to install additional components (e.g. Cygwin).
61
        * Collect the source *.v files, including the core (avr_core.v),
62
          peripherals (avr_io_*.v), flash interface (main.v), data memory
63
          (ram.v) and the top module (top.v) into a single directory _if_ your
64
          operating system does not support symlinks.
65
        * Import the top.v to your synthesis toolchain (icecube2, vivado, ...).
66
          You can use the shipped *.pcf files for Lattice tools (such as
67
          icecube2) without any further modifications. For Xilinx, you may
68
          use the file top-digilent_nexys_a7-cx7a100t.xdc as a starting point,
69
          or use it without any modifications for the Digilent Nexys A7 board.
70
 
71
By default the example code (./build/main.c) sends the following series of
72
messages via the built-in secondary UART interface of the ICE40HX8K-B-EVN
73
board at 115200 baud:
74
        [x] 0 => 0
75
        [x] 1 => 1
76
        [x] 2 => 4
77
        [x] 3 => 9
78
        [x] 4 => 16
79
        [x] 5 => 25
80
        [x] 6 => 36
81
        ...
82
Here the cadence is one message per minute. The cores and the C code expect
83
a 12MHz clock input for baud rate configuration and during the computation
84
of the timer delay.
85
 
86
You may change the contents of the main() function to switch to another
87
examples. Note also that the example is fitted for 1024 words of program code
88
(i.e. 2048 bytes of program flash memory). Change top.v and ./build/Makefile
89
accordingly for larger (or smaller) program memory configurations.
90
 
91
Known issues
92
------------
93
 
94
 - LD/ST operations work only on data memory interface, not on the I/O
95
port and the register file. GCC is not known to generate such code unless
96
register mappings are explicitly indexed with the X, Y or Z pointer registers.
97
Since registers are not available directly for C code and I/O ports are
98
defined to be constants for all of the relevant peripherals, it is not
99
expected at all and access to those areas are seamlessly translated by GCC to
100
the faster MOV, IN and OUT instructions instead of LD/ST.
101
 - SPM instruction is not supported, however, equivalent
102
self-programming interfaces can be synthetized by custom peripherals.
103
 - Watchdog is not supported, however, equivalent functionality can be
104
synthetized by custom peripherals.
105
 - Automatic interrupt acknowledgement is not supported at the moment.
106
 - Fuse bits and in-system programming are not supported. These are, in
107
practice, nearly meaningless on such an FPGA-based CPU/MCU implementation.
108
 - This soft AVR CPU is cycle compatible with the exception of the store
109
operations (LD, LDS, LDD, PUSH). These store operations runs faster by 1 cycle
110
compared to the AVR hardware. Use a preceeding or following NOP to be
111
cycle compatible with off-the-shelf AVR hardware.
112
 
113
Coming soon
114
-----------
115
 
116
 - I2C peripheral
117
 - CAN bus interface
118
 - An implementation of the AVR architecture using a 4-stage pipeline
119
 - FreeRTOS port
120
 - some more detaild documentation
121
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.