Skip to content

Commit b7920ad

Browse files
committed
wip: yowasp integration
1 parent 77c61b4 commit b7920ad

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

bin/silice-make.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def make(cmd_args):
4141
parser = argparse.ArgumentParser(description='silice-make is the Silice build tool')
4242
parser.add_argument('-s','--source', help="Source file to build.")
4343
parser.add_argument('-b','--board', help="Board to build for. Variant can be specified as board:variant")
44-
parser.add_argument('-t','--tool', help="Builder used (e.g. edalize, shell).")
44+
parser.add_argument('-t','--tool', help="Builder used (e.g. edalize, shell, yowasp).")
4545
parser.add_argument('-p','--pins', help="Pins used in the design, comma separated, e.g. basic,vga")
4646
parser.add_argument('-o','--outdir', help="Specify name of output directory.", default="BUILD")
4747
parser.add_argument('-l','--list_boards', help="List all available target boards.", action="store_true")
@@ -269,6 +269,7 @@ def make(cmd_args):
269269
if not os.path.exists(script):
270270
print(colored("script " + script + " not found", 'red'))
271271
sys.exit()
272+
272273
# prepare additional defines
273274
defines = ""
274275
if args.pins:
@@ -304,6 +305,20 @@ def make(cmd_args):
304305
else:
305306
os.system(command + " " + defines + " " + add_args + " --top " + args.top)
306307

308+
elif target_builder['builder'] == 'yowasp':
309+
310+
# script check
311+
script = os.path.join(board_path,target_builder['command'])
312+
if not os.path.exists(script):
313+
print(colored("script " + script + " not found", 'red'))
314+
sys.exit()
315+
# execute
316+
import importlib.util
317+
spec = importlib.util.spec_from_file_location("module_name", script)
318+
module = importlib.util.module_from_spec(spec)
319+
sys.modules["module_name"] = module
320+
spec.loader.exec_module(module)
321+
307322
elif target_builder['builder'] == 'edalize':
308323

309324
# ==== building with Edalize

frameworks/boards/icestick/board.json

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
"builder" : "shell",
3636
"command" : "icestick.sh",
3737
"description": "Custom shell scripts using yosys and nextpnr"
38+
},
39+
{
40+
"builder" : "yowasp",
41+
"command" : "icestick.py",
42+
"description": "Custom python scripts using yowasp (needs yowasp-yosys and yowasp-nextpnr-ice40"
3843
}
3944
]
4045
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import yowasp_silice
2+
import yowasp_yosys
3+
import yowasp_nextpnr_ice40
4+
5+
# test Silice
6+
yowasp_silice.run_silice(["--help"])
7+
# test Yosys
8+
yowasp_yosys.run_yosys(["--help"])
9+
# test Nextpnr
10+
yowasp_nextpnr_ice40.run_nextpnr_ice40(["--help"])

projects/blinky/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
.DEFAULT: blinky.si
33
silice-make.py -s blinky.si -b $@ -p basic -o BUILD_$(subst :,_,$@) $(ARGS)
44

5+
yowasp-icestick:
6+
silice-make.py -s blinky.si -b $(subst yowasp-,,$@) -p basic -t yowasp -o BUILD_$(subst :,_,$@) $(ARGS)
7+
58
clean:
69
rm -rf BUILD_*

0 commit comments

Comments
 (0)