-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.py
70 lines (51 loc) · 1.88 KB
/
configuration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#
# if file changed run `configuration-apply.py` and rebuild
#
BOARD_NAME = "tangnano20k"
# used when flashing the bitstream to the FPGA and creating the SDC file
CLOCK_FREQUENCY_HZ = 27_000_000
# frequency of clock in (signal 'clk')
CPU_FREQUENCY_HZ = 54_000_000
# frequency that CPU runs on
RAM_ADDRESS_BITWIDTH = 21
# 2 ^ 21 x 32 b = 8 MB SDRAM (according to hardware)
RAM_ADDRESSING_MODE = 2
# amount of data stored per address
# mode:
# 0: 1 B (byte addressed)
# 1: 2 B
# 2: 4 B
# 3: 8 B
UART_BAUD_RATE = 115200
# 115200 baud, 8 bits, 1 stop bit, no parity
CACHE_COLUMN_INDEX_BITWIDTH = 3
# 2 ^ 3 = 8 entries (32 B) per cache line
CACHE_LINE_INDEX_BITWIDTH = 11 # >=5 passes memory test at 60 MHz
# 2 ^ 11 * 32 B = 64 KB unified instruction and data cache
# 1 to 6 : cache implemented with SSRAM
# 7 to 11 : cache implemented with BSRAM
# 12 : exceeds resources
FLASH_TRANSFER_FROM_ADDRESS = 0x70_0000
# flash read start address
FLASH_TRANSFER_BYTE_COUNT = 0x10_0000
# number of bytes to transfer from flash at startup (1 MB)
STARTUP_WAIT_CYCLES = 1_000_000
# cycles delay at startup for flash to be initiated
#
# scripts related configuration
#
BITSTREAM_FILE = "impl/pnr/riscv.fs"
# location of the bitstream file relative to project root
#
# configure for firmware to have 1 MB at the end of the flash storage of 8 MB
#
BITSTREAM_FLASH_TO_EXTERNAL = True
# False to flash the bitstream to the internal flash, True for the external flash
BITSTREAM_FILE_MAX_SIZE_BYTES = 0x70_0000
# used to check if the bitstream size is within the allocated space
FIRMWARE_FILE = "os/os.bin"
# location of the firmware file relative to project root
FIRMWARE_FILE_MAX_SIZE_BYTES = 0x10_0000
# used to check if the firmware size is within the allocated space
FIRMWARE_FLASH_OFFSET = 0x70_0000
# used to specify the offset in the flash storage where the firmware will be written