Skip to content

Commit a0159e1

Browse files
committed
build: efinix: add Topaz support
add support for Topaz. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 904c382 commit a0159e1

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

litex/build/efinix/common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def __init__(self, i, o_p, o_n):
195195
io_pad = platform.get_pad_name(o_p) # need real pad name
196196
io_prop = platform.get_pin_properties(o_p)
197197

198-
if platform.family == "Titanium":
198+
if platform.family in ["Titanium", "Topaz"]:
199199
# _p has _P_ and _n has _N_ followed by an optional function
200200
# lvds block needs _PN_
201201
pad_split = io_pad.split('_')
@@ -240,7 +240,7 @@ def __init__(self, i_p, i_n, o):
240240
io_pad = platform.get_pad_name(i_p) # need real pad name
241241
io_prop = platform.get_pin_properties(i_p)
242242

243-
if platform.family == "Titanium":
243+
if platform.family in ["Titanium", "Topaz"]:
244244
# _p has _P_ and _n has _N_ followed by an optional function
245245
# lvds block needs _PN_
246246
pad_split = io_pad.split('_')

litex/build/efinix/dbparser.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
# Efinix Database Parser ---------------------------------------------------------------------------
2121

2222
class EfinixDbParser:
23-
def __init__(self, efinity_path, device):
23+
def __init__(self, efinity_path, device, family):
2424
self.efinity_db_path = efinity_path + '/pt/db/'
2525
self.device = device
26+
self.family = family
2627

2728
def get_device_map(self, device):
2829
with open(self.efinity_db_path + 'devicemap.csv') as f:
@@ -110,7 +111,7 @@ def get_pll_inst_from_gpio_inst(self, dmap, inst):
110111
if i == None:
111112
continue
112113
if (i == inst) or (inst + '.' in i):
113-
refclk_no = 0 if self.device[:2] != "Ti" else c.get('index')
114+
refclk_no = 0 if self.family == "Trion" else c.get('index')
114115
if c.get('index') == '3':
115116
refclk_no = 1
116117
return (p.get('name'), refclk_no)

litex/build/efinix/ifacewriter.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,13 @@ def generate_pll(self, block, partnumber, verbose=True):
319319
else:
320320
cmd += 'design.set_property("{}","CLKOUT{}_PHASE_SETTING","{}","PLL")\n'.format(name, i, clock[2] // 45)
321321

322-
# Titanium has always a feedback (local: CLK0, CORE: any output)
322+
# Titanium/Topaz has always a feedback (local: CLK0, CORE: any output)
323323
if block["version"] == "V3":
324324
feedback_clk = block["feedback"]
325325
cmd += 'design.set_property("{}", "FEEDBACK_MODE", "{}", "PLL")\n'.format(name, "LOCAL" if feedback_clk < 1 else "CORE")
326326
cmd += 'design.set_property("{}", "FEEDBACK_CLK", "CLK{}", "PLL")\n'.format(name, 0 if feedback_clk < 1 else feedback_clk)
327327

328-
# auto_calc_pll_clock is always working with Titanium and only working when feedback is unused for Trion
328+
# auto_calc_pll_clock is always working with Titanium/Topaz and only working when feedback is unused for Trion
329329
if block["feedback"] == -1 or block["version"] == "V3":
330330
cmd += "target_freq = {\n"
331331
for i, clock in enumerate(block["clk_out"]):
@@ -438,7 +438,7 @@ def generate_lvds(self, block, verbose=True):
438438
rst_pin = rst_pin.name
439439

440440
cmd.append('design.create_block("{}", block_type="{}", tx_mode="{}")'.format(name, block_type, tx_mode))
441-
if self.platform.family == "Titanium":
441+
if self.platform.family in ["Titanium", "Topaz"]:
442442
cmd.append('design.set_property("{}", "TX_DELAY", "{}", "{}")'.format(name, delay, block_type))
443443
cmd.append('design.set_property("{}", "TX_DIFF_TYPE", "LVDS", "{}")'.format(name, block_type))
444444
cmd.append('design.set_property("{}", "TX_HALF_RATE", "{}", "{}")'.format(name, half_rate, block_type))
@@ -484,7 +484,7 @@ def generate_lvds(self, block, verbose=True):
484484
delay_inc = delay_inc.name
485485

486486
cmd.append('design.create_block("{}", block_type="{}", rx_conn_type="{}")'.format(name, block_type, rx_mode))
487-
if self.platform.family == "Titanium":
487+
if self.platform.family in ["Titanium", "Topaz"]:
488488
cmd.append('design.set_property("{}", "GBUF", "", "{}")'.format(name, block_type))
489489
cmd.append('design.set_property("{}", "RX_DBG_PIN", "", "{}")'.format(name, block_type))
490490
cmd.append('design.set_property("{}", "RX_TERM_PIN", "{}", "{}")'.format(name, term, block_type))

litex/build/efinix/platform.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ def __init__(self, *args, iobank_info=None, toolchain="efinity", spi_mode="activ
3434
self.clks = {}
3535
if self.device[:2] == "Ti":
3636
self.family = "Titanium"
37+
elif self.device[:2] == "Tz":
38+
self.family = "Topaz"
3739
else:
3840
self.family = "Trion"
3941

@@ -51,7 +53,7 @@ def __init__(self, *args, iobank_info=None, toolchain="efinity", spi_mode="activ
5153
else:
5254
raise ValueError(f"Unknown toolchain {toolchain}")
5355

54-
self.parser = EfinixDbParser(self.efinity_path, self.device)
56+
self.parser = EfinixDbParser(self.efinity_path, self.device, self.family)
5557
self.pll_available = self.parser.get_block_instance_names('pll')
5658
self.pll_used = []
5759

litex/soc/cores/jtag.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def __init__(self, jtag=None, device=None, data_width=8, clock_domain="sys", cha
431431
elif device[:5] == "LFE5U":
432432
jtag = ECP5JTAG()
433433
# Efinix
434-
elif device[:2] == "Ti":
434+
elif device[:2] in ["Ti", "Tz"]:
435435
jtag = EfinixJTAG(platform)
436436
# Altera/Intel.
437437
elif AlteraJTAG.get_primitive(device) is not None:

0 commit comments

Comments
 (0)