Skip to content

Commit

Permalink
Working diff fasm test for mini LiteX.
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
  • Loading branch information
litghost committed Dec 14, 2019
1 parent fe36765 commit ea1d610
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 5 deletions.
8 changes: 4 additions & 4 deletions xc7/fasm2bels/bram_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ def make_target_feature(feature):
elif 'RAMB18_Y0.READ_WIDTH_A_2' in set_features:
READ_WIDTH_A = 4
elif 'RAMB18_Y0.READ_WIDTH_A_4' in set_features:
READ_WIDTH_A = 8
READ_WIDTH_A = 9
elif 'RAMB18_Y0.READ_WIDTH_A_9' in set_features:
READ_WIDTH_A = 18
elif 'RAMB18_Y0.READ_WIDTH_A_18' in set_features:
Expand All @@ -796,7 +796,7 @@ def make_target_feature(feature):
elif 'RAMB18_Y0.READ_WIDTH_B_2' in set_features:
READ_WIDTH_B = 4
elif 'RAMB18_Y0.READ_WIDTH_B_4' in set_features:
READ_WIDTH_B = 8
READ_WIDTH_B = 9
elif 'RAMB18_Y0.READ_WIDTH_B_9' in set_features:
READ_WIDTH_B = 18
elif 'RAMB18_Y0.READ_WIDTH_B_18' in set_features:
Expand Down Expand Up @@ -829,7 +829,7 @@ def make_target_feature(feature):
elif 'RAMB18_Y0.WRITE_WIDTH_A_2' in set_features:
WRITE_WIDTH_A = 4
elif 'RAMB18_Y0.WRITE_WIDTH_A_4' in set_features:
WRITE_WIDTH_A = 8
WRITE_WIDTH_A = 9
elif 'RAMB18_Y0.WRITE_WIDTH_A_9' in set_features:
WRITE_WIDTH_A = 18
elif 'RAMB18_Y0.WRITE_WIDTH_A_18' in set_features:
Expand All @@ -842,7 +842,7 @@ def make_target_feature(feature):
elif 'RAMB18_Y0.WRITE_WIDTH_B_2' in set_features:
WRITE_WIDTH_B = 4
elif 'RAMB18_Y0.WRITE_WIDTH_B_4' in set_features:
WRITE_WIDTH_B = 8
WRITE_WIDTH_B = 9
elif 'RAMB18_Y0.WRITE_WIDTH_B_9' in set_features:
WRITE_WIDTH_B = 18
elif 'RAMB18_Y0.WRITE_WIDTH_B_18' in set_features:
Expand Down
8 changes: 8 additions & 0 deletions xc7/fasm2bels/fasm2bels.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ def main():
net_map = load_net_list(conn, args.rr_graph, args.route_file)
top.set_net_map(net_map)

if args.part:
with open(os.path.join(args.db_root, args.part + '.json')) as f:
part_data = json.load(f)
top.set_io_banks(part_data['iobanks'])

if args.eblif:
with open(args.eblif) as f:
parsed_eblif = eblif.parse_blif(f)
Expand Down Expand Up @@ -313,6 +318,9 @@ def main():
for l in top.output_disabled_drcs():
print(l, file=f)

for l in top.output_extra_tcl():
print(l, file=f)


if __name__ == "__main__":
main()
15 changes: 15 additions & 0 deletions xc7/fasm2bels/hclk_ioi3_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ def process_hclk_ioi3(conn, top, tile, features):
have_idelayctrl = True
break

if 'VREF' in f.feature:
# HCLK_IOI3_X113Y26.VREF.V_675_MV
tile, vref_str, vref_value = f.feature.split('.')
assert vref_str == 'VREF', f
v_str, value, mv_str = vref_value.split('_')
assert v_str == 'V', f
assert mv_str == 'MV', f

iobank = top.find_iobank(tile.split('_')[-1])

top.add_extra_tcl_line(
'set_property INTERNAL_VREF 0.{VREF} [get_iobanks {iobank}]'.
format(VREF=value, iobank=iobank)
)

if not have_idelayctrl:
return

Expand Down
18 changes: 18 additions & 0 deletions xc7/fasm2bels/verilog_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,15 @@ def __init__(self, db, grid, conn, name="top"):
# .cname value.
self.cname_map = {}

# Extra TCL lines (e.g. VREF)
self.extra_tcl = []

# IO bank lookup (if part was provided).
self.iobank_lookup = {}

def add_extra_tcl_line(self, tcl_line):
self.extra_tcl.append(tcl_line)

def set_iostandard_defs(self, defs):
self.iostandard_defs = defs

Expand Down Expand Up @@ -1703,3 +1712,12 @@ def add_to_cname_map(self, parsed_eblif):

def lookup_cname(self, pin, idx, net):
return self.cname_map.get((pin, idx, net))

def output_extra_tcl(self):
return self.extra_tcl

def set_io_banks(self, iobanks):
self.iobank_lookup = dict((v, int(k)) for k, v in iobanks.items())

def find_iobank(self, hclk_ioi3_tile):
return self.iobank_lookup[hclk_ioi3_tile]
1 change: 0 additions & 1 deletion xc7/tests/soc/litex/mini/minilitex.xdc
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
set_property INTERNAL_VREF 0.675 [get_iobanks 34]
1 change: 1 addition & 0 deletions xc7/tests/soc/litex/mini/minilitex_arty.v
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,7 @@ VexRiscv VexRiscv(
.iBusWishbone_WE(vexriscv_ibus_we)
);

(* LOC="PLLE2_ADV_X1Y1" *)
PLLE2_ADV #(
.CLKFBOUT_MULT(4'd8),
.CLKIN1_PERIOD(10.0),
Expand Down

0 comments on commit ea1d610

Please sign in to comment.