Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kestrel Collaboration
Kestrel LiteX
migen
Commits
c05fc0c6
Commit
c05fc0c6
authored
6 years ago
by
whitequark
Browse files
Options
Download
Email Patches
Plain Diff
build/lattice/icestorm: add fine grained clock constraint support.
Only works in nextpnr, of course.
parent
0c57a44f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
migen/build/lattice/icestorm.py
migen/build/lattice/icestorm.py
+15
-10
No files found.
migen/build/lattice/icestorm.py
View file @
c05fc0c6
...
...
@@ -12,10 +12,6 @@ from migen.build import tools
from
migen.build.lattice
import
common
def
_format_constraint
(
c
):
pass
def
_build_pcf
(
named_sc
,
named_pc
):
r
=
""
for
sig
,
pins
,
others
,
resname
in
named_sc
:
...
...
@@ -29,6 +25,13 @@ def _build_pcf(named_sc, named_pc):
return
r
def
_build_pre_pack
(
vns
,
freq_cstrs
):
r
=
""
for
sig
in
freq_cstrs
:
r
+=
"""ctx.addClock("{}", {})
\n
"""
.
format
(
vns
.
get_name
(
sig
),
freq_cstrs
[
sig
])
return
r
def
_build_script
(
source
,
build_template
,
build_name
,
pnr_pkg_opts
,
icetime_pkg_opts
,
freq_constraint
):
if
sys
.
platform
in
(
"win32"
,
"cygwin"
):
...
...
@@ -115,7 +118,7 @@ class LatticeIceStormToolchain:
self
.
nextpnr_build_template
=
[
"yosys -q -l {build_name}.rpt {build_name}.ys"
,
"nextpnr-ice40 {pnr_pkg_opts} --pcf {build_name}.pcf --json {build_name}.json --asc {build_name}.txt --
f
re
q {freq_constraint}
"
,
"nextpnr-ice40 {pnr_pkg_opts} --pcf {build_name}.pcf --json {build_name}.json --asc {build_name}.txt --
p
re
-pack {build_name}_pre_pack.py
"
,
"icepack {build_name}.txt {build_name}.bin"
]
...
...
@@ -157,6 +160,13 @@ class LatticeIceStormToolchain:
pnr_pkg_opts
=
"-d "
+
self
.
get_size_string
(
series_size
)
+
\
" -P "
+
package
icetime_pkg_opts
=
"-P "
+
package
+
" -d "
+
series_size
if
use_nextpnr
:
tools
.
write_to_file
(
build_name
+
"_pre_pack.py"
,
_build_pre_pack
(
v_output
.
ns
,
self
.
freq_constraints
))
# icetime can only handle a single global constraint, so we test against the fastest
# clock; though imprecise, if the global design satisfies the fastest clock, we can
# be sure all other constraints are satisfied.
freq_constraint
=
str
(
max
(
self
.
freq_constraints
.
values
(),
default
=
0.0
))
...
...
@@ -216,11 +226,6 @@ class LatticeIceStormToolchain:
filename
))
return
"
\n
"
.
join
(
read_files
)
# icetime can only handle a single global constraint. Pending more
# finely-tuned analysis features in arachne-pnr and IceStorm, save
# all the constraints in a dictionary and test against the fastest clk.
# Though imprecise, if the global design satisfies the fastest clock,
# we can be sure all other constraints are satisfied.
def
add_period_constraint
(
self
,
platform
,
clk
,
period
):
new_freq
=
1000.0
/
period
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment