diff options
Diffstat (limited to 'ice40')
-rw-r--r-- | ice40/.gitignore | 2 | ||||
-rwxr-xr-x | ice40/picorv32_arachne.sh | 9 | ||||
-rwxr-xr-x | ice40/transform_arachne_loc.py | 24 |
3 files changed, 35 insertions, 0 deletions
diff --git a/ice40/.gitignore b/ice40/.gitignore index 860619ef..55bd67ee 100644 --- a/ice40/.gitignore +++ b/ice40/.gitignore @@ -3,3 +3,5 @@ /blinky_tb.vcd /picorv32.v /chipdbs/ +*.blif + diff --git a/ice40/picorv32_arachne.sh b/ice40/picorv32_arachne.sh new file mode 100755 index 00000000..285562c1 --- /dev/null +++ b/ice40/picorv32_arachne.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -ex +rm -f picorv32.v +wget https://raw.githubusercontent.com/cliffordwolf/picorv32/master/picorv32.v +yosys -p 'synth_ice40 -nocarry -blif picorv32.blif -top top' picorv32.v picorv32_top.v +arachne-pnr -d 8k --post-place-blif picorv32_place.blif picorv32.blif +yosys picorv32_place.blif -o picorv32_place.json +./transform_arachne_loc.py picorv32_place.json > picorv32_place_nx.json +../nextpnr-ice40 --hx8k --asc picorv32.asc --json picorv32_place_nx.json diff --git a/ice40/transform_arachne_loc.py b/ice40/transform_arachne_loc.py new file mode 100755 index 00000000..14792845 --- /dev/null +++ b/ice40/transform_arachne_loc.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +import json +import sys +import re + +with open(sys.argv[1]) as f: + data = json.load(f) + +for mod, moddata in data["modules"].items(): + if "cells" in moddata: + for cell, celldata in moddata["cells"].items(): + pos = re.split('[,/]', celldata["attributes"]["loc"]) + pos = [int(_) for _ in pos] + if celldata["type"] == "ICESTORM_LC": + celldata["attributes"]["BEL"] = "X%d/Y%d/lc%d" % (pos[0], pos[1], pos[2]) + elif celldata["type"] == "SB_IO": + celldata["attributes"]["BEL"] = "X%d/Y%d/io%d" % (pos[0], pos[1], pos[2]) + elif "RAM" in celldata["type"]: + celldata["attributes"]["BEL"] = "X%d/Y%d/ram" % (pos[0], pos[1]) + elif celldata["type"] == "SB_GB": + celldata["attributes"]["BEL"] = "X%d/Y%d/gb" % (pos[0], pos[1]) + else: + assert False +print(json.dumps(data, sort_keys=True, indent=4))
\ No newline at end of file |