--- /dev/null
+PYTHON=python3
+
+all: build/soc.bit
+
+# We need to change to the build directory because the Xilinx tools
+# tend to dump a mess of various files in the current directory.
+
+build/soc.prj build/soc.ucf:
+ $(PYTHON) build.py
+
+build/soc.ngc: build/soc.prj
+ cd build && xst -ifn ../soc.xst
+
+build/soc.ngd: build/soc.ngc build/soc.ucf
+ cd build && ngdbuild -uc soc.ucf soc.ngc
+
+build/soc.ncd: build/soc.ngd
+ cd build && map -ol high -w soc.ngd
+
+build/soc-routed.ncd: build/soc.ncd
+ cd build && par -ol high -w soc.ncd soc-routed.ncd
+
+build/soc.bit build/soc.bin: build/soc-routed.ncd
+ cd build && bitgen -g Binary:Yes -g INIT_9K:Yes -w soc-routed.ncd soc.bit
+
+load: build/soc.bit
+ jtag -n load.jtag
+
+clean:
+ rm -rf build/*
+
+.PHONY: load clean
"lm32_dcache.v", "lm32_top.v", "lm32_debug.v", "lm32_jtag.v", "jtag_cores.v",
"jtag_tap_spartan6.v"])
-os.system("rm -rf build/*")
os.chdir("build")
def str2file(filename, contents):
str2file("soc.ucf", src_ucf)
verilog_sources.append("build/soc.v")
-#raise SystemExit
-
-# xst
+# generate XST project file
xst_prj = ""
for s in verilog_sources:
xst_prj += "verilog work ../" + s + "\n"
str2file("soc.prj", xst_prj)
-str2file("soc.xst", """run
--ifn soc.prj
--top soc
--ifmt MIXED
--opt_mode SPEED
--opt_level 2
--resource_sharing no
--reduce_control_sets auto
--ofn soc.ngc
--p xc6slx45-fgg484-2""")
-os.system("xst -ifn soc.xst")
-
-# ngdbuild
-os.system("ngdbuild -uc soc.ucf soc.ngc")
-
-# map
-os.system("map -ol high -w soc.ngd")
-
-# par
-os.system("par -ol high -w soc.ncd soc-routed.ncd")
-
-# bitgen
-os.system("bitgen -g Binary:Yes -g INIT_9K:Yes -w soc-routed.ncd soc.bit")