forked from IObundle/iob-soc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.mk
152 lines (117 loc) · 3.64 KB
/
config.mk
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
######################################################################
#
# IOb-SoC Configuration File
#
######################################################################
IOBSOC_NAME:=IOBSOC
#
# PRIMARY PARAMETERS: CAN BE CHANGED BY USERS OR OVERRIDEN BY ENV VARS
#
#CPU ARCHITECTURE
DATA_W := 32
ADDR_W := 32
#FIRMWARE SIZE (LOG2)
FIRM_ADDR_W ?=15
#SRAM SIZE (LOG2)
SRAM_ADDR_W ?=15
#DDR
USE_DDR ?=0
RUN_EXTMEM ?=0
#DATA CACHE ADDRESS WIDTH (tag + index + offset)
DCACHE_ADDR_W:=24
#ROM SIZE (LOG2)
BOOTROM_ADDR_W:=12
#PRE-INIT MEMORY WITH PROGRAM AND DATA
INIT_MEM ?=1
#PERIPHERAL LIST
#must match respective submodule CORE_NAME in the core.mk file of the submodule
#PERIPHERALS:=UART
PERIPHERALS ?=UART GPIO TIMER
#RISC-V HARD MULTIPLIER AND DIVIDER INSTRUCTIONS
USE_MUL_DIV ?=1
#RISC-V COMPRESSED INSTRUCTIONS
USE_COMPRESSED ?=1
#ROOT DIRECTORY ON REMOTE MACHINES
REMOTE_ROOT_DIR ?=sandbox/iob-soc
#SIMULATION
#default simulator running locally or remotely
#check the respective Makefile in hardware/simulation/$(SIMULATOR) for specific settings
SIMULATOR ?=icarus
#BOARD
#default board running locally or remotely
#check the respective Makefile in hardware/fpga/$(BOARD) for specific settings
BOARD ?=CYCLONEV-GT-DK
#DOCUMENTATION
#default document to compile
DOC ?= pb
#IOB LIBRARY
UART_HW_DIR:=$(UART_DIR)/hardware
GPIO_HW_DIR:=$(GPIO_DIR)/hardware
####################################################################
# DERIVED FROM PRIMARY PARAMETERS: DO NOT CHANGE BELOW THIS POINT
####################################################################
ifeq ($(RUN_EXTMEM),1)
DEFINE+=$(defmacro)RUN_EXTMEM
USE_DDR=1
endif
ifeq ($(USE_DDR),1)
DEFINE+=$(defmacro)USE_DDR
endif
ifeq ($(INIT_MEM),1)
DEFINE+=$(defmacro)INIT_MEM
endif
#submodule paths
PICORV32_DIR=$(ROOT_DIR)/submodules/PICORV32
CACHE_DIR=$(ROOT_DIR)/submodules/CACHE
UART_DIR=$(ROOT_DIR)/submodules/UART
LIB_DIR=$(ROOT_DIR)/submodules/LIB
MEM_DIR=$(ROOT_DIR)/submodules/MEM
AXI_DIR=$(ROOT_DIR)/submodules/AXI
GPIO_DIR=$(ROOT_DIR)/modules/GPIO
TIMER_DIR=$(ROOT_DIR)/modules/TIMER
#sw paths
SW_DIR:=$(ROOT_DIR)/software
PC_DIR:=$(SW_DIR)/pc-emul
FIRM_DIR:=$(SW_DIR)/firmware
BOOT_DIR:=$(SW_DIR)/bootloader
#scripts paths
PYTHON_DIR=$(LIB_DIR)/software/python
#hw paths
HW_DIR=$(ROOT_DIR)/hardware
SIM_DIR=$(HW_DIR)/simulation/$(SIMULATOR)
BOARD_DIR ?=$(shell find hardware -name $(BOARD))
#doc paths
DOC_DIR=$(ROOT_DIR)/document/$(DOC)
#define macros
DEFINE+=$(defmacro)DATA_W=$(DATA_W)
DEFINE+=$(defmacro)ADDR_W=$(ADDR_W)
DEFINE+=$(defmacro)BOOTROM_ADDR_W=$(BOOTROM_ADDR_W)
DEFINE+=$(defmacro)SRAM_ADDR_W=$(SRAM_ADDR_W)
DEFINE+=$(defmacro)FIRM_ADDR_W=$(FIRM_ADDR_W)
DEFINE+=$(defmacro)DCACHE_ADDR_W=$(DCACHE_ADDR_W)
DEFINE+=$(defmacro)N_SLAVES=$(N_SLAVES) #peripherals
#address selection bits
E:=31 #extra memory bit
P:=30 #periphs
B:=29 #boot controller
DEFINE+=$(defmacro)E=$E
DEFINE+=$(defmacro)P=$P
DEFINE+=$(defmacro)B=$B
#PERIPHERAL IDs
#assign a sequential ID to each peripheral
#the ID is used as an instance name index in the hardware and as a base address in the software
N_SLAVES:=0
$(foreach p, $(PERIPHERALS), $(eval $p=$(N_SLAVES)) $(eval N_SLAVES:=$(shell expr $(N_SLAVES) \+ 1)))
$(foreach p, $(PERIPHERALS), $(eval DEFINE+=$(defmacro)$p=$($p)))
N_SLAVES_W = $(shell echo "import math; print(math.ceil(math.log($(N_SLAVES),2)))"|python3 )
DEFINE+=$(defmacro)N_SLAVES_W=$(N_SLAVES_W)
#RULES
#kill "console", the background running program seriving simulators,
#emulators and boards
CNSL_PID:=ps aux | grep $(USER) | grep console | grep python3 | grep -v grep
kill-cnsl:
@if [ "`$(CNSL_PID)`" ]; then \
kill -9 $$($(CNSL_PID) | awk '{print $$2}'); fi
gen-clean:
@rm -f *# *~
.PHONY: gen-clean kill-cnsl