W
walala
Dear all,
I am facing a problem about resource(adder or multiplier) reuse in VHDL...
The target is to compute ZZ=XX*A' (8x8 matrix multiplication). I do matrix
multiplication row by row: using "count"(a counter increasing one at each
cycle) as row index, from 0 to 7. t1, t2, t3, t4, t5, t6, t7, t8 are
temporary variables.
It seems from the code that it needs a lot of adders/multipliers, ... how
can I infer the resource re-use in my VHDL code? Which VHDL style can I use
to get minimum adder/multiplier?
Is there anything relate to Synopsys DC?
Thank you very much,
-Walala
------------------------------------------------------------
-- A'=
-- 91 91 91 91 91 91 91 91
-- 126 106 71 25 -25 -71 -106 -126
-- 118 49 -49 -118 -118 -49 49 118
-- 106 -25 -126 -71 71 126 25 -106
-- 91 -91 -91 91 91 -91 -91 91
-- 71 -126 25 106 -106 -25 126 -71
-- 49 -118 118 -49 -49 118 -118 49
-- 25 -71 106 -126 126 -106 71 -25
if count<8 then
--ZZ(k)(0):
91*XX(k)(0)+126*XX(k)(1)+118*XX(k)(2)+106*XX(k)(3)+91*XX(k)(4)+71*XX(k)(5)+4
9*XX(k)(6)+25*XX(k)(7)
--ZZ(k)(7):
91*XX(k)(0)-126*XX(k)(1)+118*XX(k)(2)-106*XX(k)(3)+91*XX(k)(4)-71*XX(k)(5)+4
9*XX(k)(6)-25*XX(k)(7)
t1:=91*XX(count)(0)+118*XX(count)(2)+91*XX(count)(4)+49*XX(count)(6);
t2:=126*XX(count)(1)+106*XX(count)(3)+71*XX(count)(5)+25*XX(count)(7);
ZZ(count)(0)<=t1+t2;
ZZ(count)(7)<=t1-t2;
--ZZ(k)(1):
91*XX(k)(0)+106*XX(k)(1)+49*XX(k)(2)-25*XX(k)(3)-91*XX(k)(4)-126*XX(k)(5)-11
8*XX(k)(6)-71*XX(k)(7)
--ZZ(k)(6):
91*XX(k)(0)-106*XX(k)(1)+49*XX(k)(2)+25*XX(k)(3)-91*XX(k)(4)+126*XX(k)(5)-11
8*XX(k)(6)+71*XX(k)(7)
t3:=91*XX(count)(0)+49*XX(count)(2)-91*XX(count)(4)-118*XX(count)(6);
t4:=106*XX(count)(1)-25*XX(count)(3)-126*XX(count)(5)-71*XX(count)(7);
ZZ(count)(1)<=t3+t4;
ZZ(count)(6)<=t3-t4;
--ZZ(k)(2):
91*XX(k)(0)+71*XX(k)(1)-49*XX(k)(2)-126*XX(k)(3)-91*XX(k)(4)+25*XX(k)(5)+118
*XX(k)(6)+106*XX(k)(7)
--ZZ(k)(5):
91*XX(k)(0)-71*XX(k)(1)-49*XX(k)(2)+126*XX(k)(3)-91*XX(k)(4)-25*XX(k)(5)+118
*XX(k)(6)-106*XX(k)(7)
t5:=91*XX(count)(0)-49*XX(count)(2)-91*XX(count)(4)+118*XX(count)(6);
t6:=71*XX(count)(1)-126*XX(count)(3)+25*XX(count)(5)+106*XX(count)(7);
ZZ(count)(2)<=t5+t6;
ZZ(count)(5)<=t5-t6;
--ZZ(k)(3):
91*XX(k)(0)+25*XX(k)(1)-118*XX(k)(2)-71*XX(k)(3)+91*XX(k)(4)+106*XX(k)(5)-49
*XX(k)(6)-126*XX(k)(7)
--ZZ(k)(4):
91*XX(k)(0)-25*XX(k)(1)-118*XX(k)(2)+71*XX(k)(3)+91*XX(k)(4)-106*XX(k)(5)-49
*XX(k)(6)+126*XX(k)(7)
t7:=91*XX(count)(0)-118*XX(count)(2)+91*XX(count)(4)-49*XX(count)(6);
t8:=25*XX(count)(1)-71*XX(count)(3)+106*XX(count)(5)-126*XX(count)(7);
ZZ(count)(3)<=t7+t8;
ZZ(count)(4)<=t7-t8;
end if;
I am facing a problem about resource(adder or multiplier) reuse in VHDL...
The target is to compute ZZ=XX*A' (8x8 matrix multiplication). I do matrix
multiplication row by row: using "count"(a counter increasing one at each
cycle) as row index, from 0 to 7. t1, t2, t3, t4, t5, t6, t7, t8 are
temporary variables.
It seems from the code that it needs a lot of adders/multipliers, ... how
can I infer the resource re-use in my VHDL code? Which VHDL style can I use
to get minimum adder/multiplier?
Is there anything relate to Synopsys DC?
Thank you very much,
-Walala
------------------------------------------------------------
-- A'=
-- 91 91 91 91 91 91 91 91
-- 126 106 71 25 -25 -71 -106 -126
-- 118 49 -49 -118 -118 -49 49 118
-- 106 -25 -126 -71 71 126 25 -106
-- 91 -91 -91 91 91 -91 -91 91
-- 71 -126 25 106 -106 -25 126 -71
-- 49 -118 118 -49 -49 118 -118 49
-- 25 -71 106 -126 126 -106 71 -25
if count<8 then
--ZZ(k)(0):
91*XX(k)(0)+126*XX(k)(1)+118*XX(k)(2)+106*XX(k)(3)+91*XX(k)(4)+71*XX(k)(5)+4
9*XX(k)(6)+25*XX(k)(7)
--ZZ(k)(7):
91*XX(k)(0)-126*XX(k)(1)+118*XX(k)(2)-106*XX(k)(3)+91*XX(k)(4)-71*XX(k)(5)+4
9*XX(k)(6)-25*XX(k)(7)
t1:=91*XX(count)(0)+118*XX(count)(2)+91*XX(count)(4)+49*XX(count)(6);
t2:=126*XX(count)(1)+106*XX(count)(3)+71*XX(count)(5)+25*XX(count)(7);
ZZ(count)(0)<=t1+t2;
ZZ(count)(7)<=t1-t2;
--ZZ(k)(1):
91*XX(k)(0)+106*XX(k)(1)+49*XX(k)(2)-25*XX(k)(3)-91*XX(k)(4)-126*XX(k)(5)-11
8*XX(k)(6)-71*XX(k)(7)
--ZZ(k)(6):
91*XX(k)(0)-106*XX(k)(1)+49*XX(k)(2)+25*XX(k)(3)-91*XX(k)(4)+126*XX(k)(5)-11
8*XX(k)(6)+71*XX(k)(7)
t3:=91*XX(count)(0)+49*XX(count)(2)-91*XX(count)(4)-118*XX(count)(6);
t4:=106*XX(count)(1)-25*XX(count)(3)-126*XX(count)(5)-71*XX(count)(7);
ZZ(count)(1)<=t3+t4;
ZZ(count)(6)<=t3-t4;
--ZZ(k)(2):
91*XX(k)(0)+71*XX(k)(1)-49*XX(k)(2)-126*XX(k)(3)-91*XX(k)(4)+25*XX(k)(5)+118
*XX(k)(6)+106*XX(k)(7)
--ZZ(k)(5):
91*XX(k)(0)-71*XX(k)(1)-49*XX(k)(2)+126*XX(k)(3)-91*XX(k)(4)-25*XX(k)(5)+118
*XX(k)(6)-106*XX(k)(7)
t5:=91*XX(count)(0)-49*XX(count)(2)-91*XX(count)(4)+118*XX(count)(6);
t6:=71*XX(count)(1)-126*XX(count)(3)+25*XX(count)(5)+106*XX(count)(7);
ZZ(count)(2)<=t5+t6;
ZZ(count)(5)<=t5-t6;
--ZZ(k)(3):
91*XX(k)(0)+25*XX(k)(1)-118*XX(k)(2)-71*XX(k)(3)+91*XX(k)(4)+106*XX(k)(5)-49
*XX(k)(6)-126*XX(k)(7)
--ZZ(k)(4):
91*XX(k)(0)-25*XX(k)(1)-118*XX(k)(2)+71*XX(k)(3)+91*XX(k)(4)-106*XX(k)(5)-49
*XX(k)(6)+126*XX(k)(7)
t7:=91*XX(count)(0)-118*XX(count)(2)+91*XX(count)(4)-49*XX(count)(6);
t8:=25*XX(count)(1)-71*XX(count)(3)+106*XX(count)(5)-126*XX(count)(7);
ZZ(count)(3)<=t7+t8;
ZZ(count)(4)<=t7-t8;
end if;