Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yosys-tests
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yosys-tests
Commits
b0e51b59
Commit
b0e51b59
authored
Aug 01, 2019
by
Eddie Hung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only assert on SB_MAC16 and (loosely) on SB_DFF
parent
d2ddcb07
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
architecture/synth_ice40_dsp/assert_area.py
+16
-8
No files found.
architecture/synth_ice40_dsp/assert_area.py
View file @
b0e51b59
...
@@ -4,19 +4,27 @@ import glob
...
@@ -4,19 +4,27 @@ import glob
import
re
import
re
import
os
import
os
re_mux
=
re
.
compile
(
r'mul_(\d+)(s?)_(\d+)(s?)_
A?B?P?
_A?B?P?\.v'
)
re_mux
=
re
.
compile
(
r'mul_(\d+)(s?)_(\d+)(s?)_
(A?B?P?)
_A?B?P?\.v'
)
for
fn
in
glob
.
glob
(
'*.v'
):
for
fn
in
glob
.
glob
(
'*.v'
):
m
=
re_mux
.
match
(
fn
)
m
=
re_mux
.
match
(
fn
)
if
not
m
:
continue
if
not
m
:
continue
A
,
B
=
map
(
int
,
m
.
group
(
1
,
3
))
A
,
B
=
map
(
int
,
m
.
group
(
1
,
3
))
X
=
(
A
+
15
)
//
16
Asigned
,
Bsigned
=
m
.
group
(
2
,
4
)
Y
=
(
B
+
15
)
//
16
Areg
=
'A'
in
m
.
group
(
5
)
Breg
=
'B'
in
m
.
group
(
5
)
Preg
=
'P'
in
m
.
group
(
5
)
X
=
(
A
+
14
)
//
16
Y
=
(
B
+
14
)
//
16
count_MAC
=
X
*
Y
count_MAC
=
X
*
Y
count_CARRY
=
0
count_DFF
=
0
if
X
>
1
and
Y
>
1
:
# TODO: Tighter bounds on count_DFF
count_CARRY
=
X
+
Y
-
16
if
A
%
16
==
1
or
B
%
16
==
1
:
count_DFF
+=
A
+
B
if
Preg
:
count_DFF
+=
A
+
B
# TODO: Assert on number of SB_CARRY and SB_LUT too
bn
,
_
=
os
.
path
.
splitext
(
fn
)
bn
,
_
=
os
.
path
.
splitext
(
fn
)
...
@@ -24,7 +32,7 @@ for fn in glob.glob('*.v'):
...
@@ -24,7 +32,7 @@ for fn in glob.glob('*.v'):
print
(
'''
print
(
'''
`ifndef _AUTOTB
`ifndef _AUTOTB
module __test ;
module __test ;
wire [4095:0] assert_area = "cd {0}; select t:SB_MAC16 -assert-count {1}; select t:SB_
CARRY -assert-count {2}; select t:SB_LUT -assert-count {2}; select t:* t:SB_MAC16 t:SB_CARRY t:SB_LUT
%
D
%
D
%
D -assert-none
";
wire [4095:0] assert_area = "cd {0}; select t:SB_MAC16 -assert-count {1}; select t:SB_
DFF* -assert-max {2}
";
endmodule
endmodule
`endif
`endif
'''
.
format
(
os
.
path
.
splitext
(
fn
)[
0
],
count_MAC
,
count_
CARRY
),
file
=
f
)
'''
.
format
(
os
.
path
.
splitext
(
fn
)[
0
],
count_MAC
,
count_
DFF
),
file
=
f
)
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