Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bram support #45

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions apycula/codegen.py
Expand Up @@ -37,7 +37,11 @@ def write(self, f):
f.write("inout {};\n".format(port))

for wire in self.wires:
f.write("wire {};\n".format(wire))
if isinstance(wire, tuple):
for w in wire:
f.write("wire {};\n".format(w))
else:
f.write("wire {};\n".format(wire))

# unique assignments or not
#for dest, src in self.assigns:
Expand All @@ -63,7 +67,10 @@ def write(self, f):
if not first:
f.write(",")
first = False
f.write("\n.{}({})".format(port, wire))
if isinstance(wire, tuple):
f.write("\n.{}({{{}}})".format(port, ", ".join(wire)))
else:
f.write("\n.{}({})".format(port, wire))
f.write("\n);\n")

for key, val in self.params.items():
Expand Down
12 changes: 9 additions & 3 deletions apycula/tiled_fuzzer.py
Expand Up @@ -28,8 +28,8 @@
if not gowinhome:
raise Exception("GOWINHOME not set")

# device = os.getenv("DEVICE")
device = sys.argv[1]
device = os.getenv("DEVICE")
# device = sys.argv[1]
pepijndevos marked this conversation as resolved.
Show resolved Hide resolved

params = {
"GW1NS-2": {
Expand Down Expand Up @@ -344,17 +344,23 @@ def dualmode(ttyp):
# read vendor .posp log
_cst_parser = re.compile(r"([^ ]+) (?:PLACE|CST)_R(\d+)C(\d+)\[([0-3])\]\[([A-Z])\]")
_place_parser = re.compile(r"([^ ]+) (?:PLACE|CST)_IO([TBLR])(\d+)\[([A-Z])\]")
# inst3_SDPB_SDPB CST_BSRAM_R6[0]
_bram_parser = re.compile(r"([^ ]+) (?:PLACE|CST)_BSRAM_R(\d+)\[([0-3])\]")
def read_posp(fname):
with open(fname, 'r') as f:
for line in f:
cst = _cst_parser.match(line)
place = _place_parser.match(line)
bram = _bram_parser.match(line)
if cst:
name, row, col, cls, lut = cst.groups()
yield "cst", name, int(row), int(col), int(cls), lut
elif place:
name, side, num, pin = place.groups()
yield "place", name, side, int(num), pin
elif bram:
name, row, idx = bram.groups()
yield "bram", name, int(row), int(idx)
elif line.strip() and not line.startswith('//'):
raise Exception(line)

Expand Down Expand Up @@ -432,7 +438,7 @@ def run_pnr(mod, constr, config):
pnr.write(f)

subprocess.run([gowinhome + "/IDE/bin/gw_sh", tmpdir+"/run.tcl"])
#print(tmpdir); input()
# print(tmpdir); input()
try:
return PnrResult(
*bslib.read_bitstream(tmpdir+"/impl/pnr/top.fs"),
Expand Down