2019-01-13 03:57:11 -06:00
|
|
|
state <SigBit> clock
|
|
|
|
state <bool> clock_pol clock_vld
|
|
|
|
state <SigSpec> sigA sigB sigY
|
2019-01-11 07:02:16 -06:00
|
|
|
|
|
|
|
match mul
|
|
|
|
select mul->type.in($mul)
|
|
|
|
select GetSize(mul->getPort(\A)) + GetSize(mul->getPort(\B)) > 10
|
|
|
|
select GetSize(mul->getPort(\Y)) > 10
|
|
|
|
endmatch
|
|
|
|
|
|
|
|
match ffA
|
|
|
|
select ffA->type.in($dff)
|
2019-01-13 03:57:11 -06:00
|
|
|
select nusers(port(ffA, \Q)) == 2
|
|
|
|
filter <SigSpec> port(ffA, \Q) === port(mul, \A)
|
2019-01-11 07:02:16 -06:00
|
|
|
optional
|
|
|
|
endmatch
|
|
|
|
|
|
|
|
code sigA clock clock_pol clock_vld
|
|
|
|
sigA = port(mul, \A);
|
|
|
|
|
|
|
|
if (ffA != nullptr) {
|
|
|
|
sigA = port(ffA, \D);
|
|
|
|
|
|
|
|
clock = port(ffA, \CLK).as_bit();
|
|
|
|
clock_pol = param(ffA, \CLK_POLARITY).as_bool();
|
|
|
|
clock_vld = true;
|
|
|
|
}
|
|
|
|
endcode
|
|
|
|
|
|
|
|
match ffB
|
|
|
|
select ffB->type.in($dff)
|
2019-01-13 03:57:11 -06:00
|
|
|
select nusers(port(ffA, \Q)) == 2
|
|
|
|
filter <SigSpec> port(ffB, \Q) === port(mul, \B)
|
2019-01-11 07:02:16 -06:00
|
|
|
optional
|
|
|
|
endmatch
|
|
|
|
|
2019-01-13 03:57:11 -06:00
|
|
|
code sigB clock clock_pol clock_vld
|
2019-01-11 07:02:16 -06:00
|
|
|
sigB = port(mul, \B);
|
|
|
|
|
|
|
|
if (ffB != nullptr) {
|
|
|
|
sigB = port(ffB, \D);
|
|
|
|
SigBit c = port(ffB, \CLK).as_bit();
|
|
|
|
bool cp = param(ffB, \CLK_POLARITY).as_bool();
|
|
|
|
|
|
|
|
if (clock_vld && (c != clock || cp != clock_pol))
|
|
|
|
reject;
|
|
|
|
|
|
|
|
clock = c;
|
|
|
|
clock_pol = cp;
|
|
|
|
clock_vld = true;
|
|
|
|
}
|
|
|
|
endcode
|
|
|
|
|
|
|
|
match ffY
|
|
|
|
select ffY->type.in($dff)
|
2019-01-13 03:57:11 -06:00
|
|
|
select nusers(port(ffY, \D)) == 2
|
|
|
|
filter <SigSpec> port(ffY, \D) === port(mul, \Y)
|
2019-01-11 07:02:16 -06:00
|
|
|
optional
|
|
|
|
endmatch
|
|
|
|
|
2019-01-13 03:57:11 -06:00
|
|
|
code sigY clock clock_pol clock_vld
|
2019-01-11 07:02:16 -06:00
|
|
|
sigY = port(mul, \Y);
|
|
|
|
|
|
|
|
if (ffY != nullptr) {
|
|
|
|
sigY = port(ffY, \D);
|
|
|
|
SigBit c = port(ffY, \CLK).as_bit();
|
|
|
|
bool cp = param(ffY, \CLK_POLARITY).as_bool();
|
|
|
|
|
|
|
|
if (clock_vld && (c != clock || cp != clock_pol))
|
|
|
|
reject;
|
|
|
|
|
|
|
|
clock = c;
|
|
|
|
clock_pol = cp;
|
|
|
|
clock_vld = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
accept;
|
|
|
|
endcode
|