Skip to content

Commit 167fbeb

Browse files
committed
Initial support for Libero programming
1 parent a90c1f4 commit 167fbeb

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

pyfpga/libero.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def _configure(self):
2121
self.conf['tool'] = tool
2222
self.conf['make_cmd'] = f'{tool} SCRIPT:{tool}.tcl'
2323
self.conf['make_ext'] = 'tcl'
24-
self.conf['prog_bit'] = None
25-
self.conf['prog_cmd'] = None
26-
self.conf['prog_ext'] = None
24+
self.conf['prog_bit'] = 'pdd'
25+
self.conf['prog_cmd'] = f'{tool} SCRIPT:{tool}-prog.tcl'
26+
self.conf['prog_ext'] = 'tcl'
2727

2828
def _make_custom(self):
2929
info = get_info(self.data.get('part', 'mpf100t-1-fcg484'))
@@ -33,9 +33,6 @@ def _make_custom(self):
3333
self.data['package'] = info['package']
3434
self.data['prange'] = info['prange']
3535

36-
def _prog_custom(self):
37-
raise NotImplementedError('Libero programming not supported yet')
38-
3936

4037
# pylint: disable=duplicate-code
4138

@@ -97,7 +94,8 @@ def get_info(part):
9794
'e': 'EXT',
9895
'i': 'IND',
9996
'm': 'MIL',
100-
't1': 'TGrade1'
97+
't1': 'TGrade1',
98+
't2': 'TGrade2'
10199
}
102100
prange = 'COM'
103101
for suffix, name in pranges.items():

pyfpga/templates/libero-prog.jinja

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
{#
12
#
2-
# Copyright (C) 2015-2024 PyFPGA Project
3+
# Copyright (C) 2024 PyFPGA Project
34
#
45
# SPDX-License-Identifier: GPL-3.0-or-later
56
#
67
#}
78

8-
# open_project -file {$TEMPDIR/libero.prjx}
9-
# run_tool -name {CONFIGURE_CHAIN} -script {$TEMPDIR/flashpro.tcl}
10-
# run_tool -name {PROGRAMDEVICE}
11-
12-
# set flashpro_programmer "configure_flashpro5_prg -vpump {ON} \
13-
# -clk_mode {free_running_clk} -programming_method {spi_slave} \
14-
# -force_freq {OFF} -freq {4000000}"
9+
if { [catch {open_project {{ project }}/{{ project }}.prjx} ] } {
10+
open_project {{ project }}.prjx
11+
}
12+
run_tool -name {PROGRAMDEVICE}

pyfpga/templates/openflow-prog.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{#
12
#
23
# Copyright (C) 2020-2024 PyFPGA Project
34
#

0 commit comments

Comments
 (0)