ice40: Importer for placed ice40 designs from arachne
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
ff074e4b4c
commit
0f0d9bfb00
2
ice40/.gitignore
vendored
2
ice40/.gitignore
vendored
@ -3,3 +3,5 @@
|
||||
/blinky_tb.vcd
|
||||
/picorv32.v
|
||||
/chipdbs/
|
||||
*.blif
|
||||
|
||||
|
9
ice40/picorv32_arachne.sh
Executable file
9
ice40/picorv32_arachne.sh
Executable file
@ -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
|
24
ice40/transform_arachne_loc.py
Executable file
24
ice40/transform_arachne_loc.py
Executable file
@ -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))
|
Loading…
Reference in New Issue
Block a user