1 |
371 |
rhoads |
# Makefile for Plasma on the s3Esk
|
2 |
|
|
# For Linux development environment using free GHDL simulator and
|
3 |
|
|
# Xilinx synthesis tools.
|
4 |
|
|
# Derives from the DDRSDRAM-on-s3Esk makefile
|
5 |
|
|
#
|
6 |
|
|
# This makefile was created by me, Dan Clemmensen. I hereby place it in
|
7 |
|
|
# the public domain, releasing any rights. I retain the right to re-use
|
8 |
|
|
# this work as the basis for a derived work.
|
9 |
|
|
#
|
10 |
|
|
# Use GHDL for simulation, and then use the Xilinx tools in batch mode for
|
11 |
|
|
# synthesis and download.
|
12 |
|
|
# Before you use this makefile for the first time, you will need to build
|
13 |
|
|
# the plasma tools. After that, you can do the rest of the development
|
14 |
|
|
# using this makefile, unless you change a tool.
|
15 |
|
|
# Place this makefile and the associated ISE_scripts directory in a
|
16 |
|
|
# subdirectory of the VHDL directory. We use this approach because the Xilinx
|
17 |
|
|
# tools create a large number of temporary files in the working directory.
|
18 |
|
|
#
|
19 |
|
|
# Usage:
|
20 |
|
|
# make clean # removes derived files and directories
|
21 |
|
|
# make load # builds everthing from scratch and
|
22 |
|
|
# # loads the flash mem on the target
|
23 |
|
|
# make simtest # builds and runs as a GHDL simulation
|
24 |
|
|
# make view # displays the results of the simulation
|
25 |
|
|
|
26 |
|
|
# To help isolate problems, you may run a series of steps instead of the whole
|
27 |
|
|
# "make load." Look below to see them.
|
28 |
|
|
|
29 |
|
|
# VHDL_DIR is the top-level VHDL directory for Plasma.
|
30 |
|
|
VHDL_DIR = ..
|
31 |
|
|
# PROJ_VHDL comprises files used in both the actual target and the sim
|
32 |
|
|
PROJ_VHDL = \
|
33 |
|
|
$(VHDL_DIR)/mlite_pack.vhd \
|
34 |
|
|
$(VHDL_DIR)/plasma_3e.vhd \
|
35 |
|
|
$(VHDL_DIR)/ddr_ctrl.vhd \
|
36 |
|
|
$(VHDL_DIR)/plasma.vhd \
|
37 |
|
|
generated/ram_image.vhd \
|
38 |
|
|
$(VHDL_DIR)/uart.vhd \
|
39 |
|
|
$(VHDL_DIR)/eth_dma.vhd \
|
40 |
|
|
$(VHDL_DIR)/mlite_cpu.vhd \
|
41 |
|
|
$(VHDL_DIR)/alu.vhd \
|
42 |
|
|
$(VHDL_DIR)/bus_mux.vhd \
|
43 |
|
|
$(VHDL_DIR)/control.vhd \
|
44 |
|
|
$(VHDL_DIR)/mem_ctrl.vhd \
|
45 |
|
|
$(VHDL_DIR)/mult.vhd \
|
46 |
|
|
$(VHDL_DIR)/pipeline.vhd \
|
47 |
|
|
$(VHDL_DIR)/pc_next.vhd \
|
48 |
|
|
$(VHDL_DIR)/reg_bank.vhd \
|
49 |
|
|
$(VHDL_DIR)/shifter.vhd \
|
50 |
|
|
$(VHDL_DIR)/cache.vhd
|
51 |
|
|
|
52 |
|
|
# TARGET_VHDL comprises files used on the target but not in sim
|
53 |
|
|
TARGET_VHDL =
|
54 |
|
|
|
55 |
|
|
# SIM_VHDL comprises files used in sim but not on the target
|
56 |
|
|
# for this sim, these simulate the rest of the S3Esk board
|
57 |
|
|
SIM_DIR = $(VHDL_DIR)/simulation
|
58 |
|
|
SIM_VHDL = \
|
59 |
|
|
$(VHDL_DIR)/mt46v16m16.vhd \
|
60 |
|
|
$(VHDL_DIR)/tbench.vhd
|
61 |
|
|
|
62 |
|
|
SIM_TOP = tbench
|
63 |
|
|
GCC_PARAMS=
|
64 |
|
|
|
65 |
|
|
OBJS = $(VHDL:.vhd=.o)
|
66 |
|
|
|
67 |
|
|
# GHDL config
|
68 |
|
|
OBJDIR = obj
|
69 |
|
|
ISE_DIR=/opt/Xilinx/11.1/ISE
|
70 |
|
|
GHDL_LIBS = $(ISE_DIR)/ghdl/unisim
|
71 |
|
|
GHDL_FLAGS = --ieee=synopsys -fexplicit -P$(GHDL_LIBS)
|
72 |
|
|
GHDL_FLAGS += --workdir=$(OBJDIR) --warn-no-vital-generic
|
73 |
|
|
|
74 |
|
|
%.o: %.vhd
|
75 |
|
|
ghdl -a $(GHDL_FLAGS) $<
|
76 |
|
|
|
77 |
|
|
all: simtest
|
78 |
|
|
|
79 |
|
|
old: workdir $(OBJS)
|
80 |
|
|
|
81 |
|
|
# invocation strings for helper tools to build Xilinx BRAM memory images.
|
82 |
|
|
TOOLS = ../../tools
|
83 |
|
|
# generate the ram_image.vhd
|
84 |
|
|
generated:
|
85 |
|
|
rm -rf generated
|
86 |
|
|
mkdir generated
|
87 |
|
|
$(TOOLS)/ram_image.exe $(VHDL_DIR)/ram_xilinx.vhd $(TOOLS)/code.txt generated/ram_image.vhd
|
88 |
|
|
|
89 |
|
|
NAME=main
|
90 |
|
|
workdir:
|
91 |
|
|
mkdir -p $(OBJDIR)
|
92 |
|
|
|
93 |
|
|
clean:
|
94 |
|
|
rm -rf *.o *.cf $(OBJDIR) tb *.vcd main $(SIM_TOP) *.ghw
|
95 |
|
|
rm -f *.bit *.bgn *_pad.txt *_pad.csv *.xpi *.srp *.ngc *.par
|
96 |
|
|
rm -f *.lst *.ngd *.ngm *.pcf *.mrp *.unroutes *.pad
|
97 |
|
|
rm -f *.bld *.ncd *.twr *.drc
|
98 |
|
|
rm -rf xst $(NAME).prj
|
99 |
|
|
rm -rf generated
|
100 |
|
|
|
101 |
|
|
simtest: workdir generated
|
102 |
|
|
ghdl -i $(GHDL_FLAGS) $(PROJ_VHDL) $(SIM_VHDL)
|
103 |
|
|
ghdl -m $(GHDL_FLAGS) $(SIM_TOP)
|
104 |
|
|
sim:
|
105 |
|
|
ghdl -r $(SIM_TOP) --stop-time=10ms --wave=generated/out.ghw 2> /dev/null
|
106 |
|
|
|
107 |
|
|
view:
|
108 |
|
|
gtkwave generated/out.ghw view.sav
|
109 |
|
|
|
110 |
|
|
#Xilinx ISE actions. Uses a wrapper script named "xilinx" to run the ISE batch commands
|
111 |
|
|
|
112 |
|
|
# create an ISE project file from the list of VHDL files
|
113 |
|
|
$(NAME).prj: $(PROJ_VHDL) $(TARGET_VHDL)
|
114 |
|
|
echo $(PROJ_VHDL) $(TARGET_VHDL)|tr " " "\n">$(NAME).prj
|
115 |
|
|
|
116 |
|
|
bitfile: generated step0 step1 step2 step3 step4 step5
|
117 |
|
|
|
118 |
|
|
step0: $(NAME).prj
|
119 |
|
|
xilinx xst -ifn ISE_scripts/$(NAME).scrs -ofn $(NAME).srp
|
120 |
|
|
step1:
|
121 |
|
|
xilinx ngdbuild -nt on -uc ../spartan3e.ucf $(NAME).ngc $(NAME).ngd
|
122 |
|
|
step2:
|
123 |
|
|
xilinx map -pr b $(NAME).ngd -o $(NAME).ncd $(NAME).pcf
|
124 |
|
|
step3:
|
125 |
|
|
xilinx par -w -ol high $(NAME).ncd $(NAME).ncd $(NAME).pcf
|
126 |
|
|
step4:
|
127 |
|
|
xilinx trce -v 10 -o $(NAME).twr $(NAME).ncd $(NAME).pcf
|
128 |
|
|
step5:
|
129 |
|
|
xilinx bitgen $(NAME).ncd generated/$(NAME).bit -w #-f $(NAME).ut
|
130 |
|
|
|
131 |
|
|
generated/main.bit: bitfile
|
132 |
|
|
|
133 |
|
|
mcs: generated/main.bit
|
134 |
|
|
xilinx impact -batch ISE_scripts/makeprom.cmds
|
135 |
|
|
|
136 |
|
|
generated/main.mcs: mcs
|
137 |
|
|
|
138 |
|
|
load: generated/main.mcs
|
139 |
|
|
xilinx impact -batch ISE_scripts/loadprom.cmds
|
140 |
|
|
|
141 |
|
|
impact:
|
142 |
|
|
xilinx impact
|
143 |
|
|
ise: $(NAME).prj
|
144 |
|
|
xilinx ise
|