Commit b0e51b59 by Eddie Hung

Only assert on SB_MAC16 and (loosely) on SB_DFF

parent d2ddcb07
...@@ -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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment