d?ffmux -> d?ffcemux

This commit is contained in:
Eddie Hung 2019-09-10 18:52:54 -07:00
parent 8b8a68b38a
commit 86700c2bea
1 changed files with 33 additions and 34 deletions

View File

@ -14,7 +14,7 @@ state <SigSpec> argQ argD
state <bool> ffenpol state <bool> ffenpol
udata <SigSpec> dffD dffQ udata <SigSpec> dffD dffQ
udata <SigBit> dffclock udata <SigBit> dffclock
udata <Cell*> dff dffmux udata <Cell*> dff dffcemux
udata <bool> dffenpol udata <bool> dffenpol
match dsp match dsp
@ -60,8 +60,8 @@ code argQ ffAD ffADmux ffADenpol sigA clock
if (dff) { if (dff) {
ffAD = dff; ffAD = dff;
clock = dffclock; clock = dffclock;
if (dffmux) { if (dffcemux) {
ffADmux = dffmux; ffADmux = dffcemux;
ffADenpol = dffenpol; ffADenpol = dffenpol;
} }
sigA = dffD; sigA = dffD;
@ -109,8 +109,8 @@ code argQ ffA ffAmux ffAenpol sigA clock ffAD ffADmux ffADenpol
if (dff) { if (dff) {
ffA = dff; ffA = dff;
clock = dffclock; clock = dffclock;
if (dffmux) { if (dffcemux) {
ffAmux = dffmux; ffAmux = dffcemux;
ffAenpol = dffenpol; ffAenpol = dffenpol;
} }
sigA = dffD; sigA = dffD;
@ -134,8 +134,8 @@ code argQ ffB ffBmux ffBenpol sigB clock
if (dff) { if (dff) {
ffB = dff; ffB = dff;
clock = dffclock; clock = dffclock;
if (dffmux) { if (dffcemux) {
ffBmux = dffmux; ffBmux = dffcemux;
ffBenpol = dffenpol; ffBenpol = dffenpol;
} }
sigB = dffD; sigB = dffD;
@ -150,8 +150,8 @@ code argQ ffD ffDmux ffDenpol sigD clock
if (dff) { if (dff) {
ffD = dff; ffD = dff;
clock = dffclock; clock = dffclock;
if (dffmux) { if (dffcemux) {
ffDmux = dffmux; ffDmux = dffcemux;
ffDenpol = dffenpol; ffDenpol = dffenpol;
} }
sigD = dffD; sigD = dffD;
@ -166,8 +166,8 @@ code argD ffM ffMmux ffMenpol sigM sigP clock
if (dff) { if (dff) {
ffM = dff; ffM = dff;
clock = dffclock; clock = dffclock;
if (dffmux) { if (dffcemux) {
ffMmux = dffmux; ffMmux = dffcemux;
ffMenpol = dffenpol; ffMenpol = dffenpol;
} }
sigM = dffQ; sigM = dffQ;
@ -223,8 +223,8 @@ code argD ffP ffPmux ffPenpol sigP clock
if (dff) { if (dff) {
ffP = dff; ffP = dff;
clock = dffclock; clock = dffclock;
if (dffmux) { if (dffcemux) {
ffPmux = dffmux; ffPmux = dffcemux;
ffPenpol = dffenpol; ffPenpol = dffenpol;
} }
sigP = dffQ; sigP = dffQ;
@ -257,8 +257,8 @@ code argQ ffC ffCmux ffCenpol sigC clock
if (dff) { if (dff) {
ffC = dff; ffC = dff;
clock = dffclock; clock = dffclock;
if (dffmux) { if (dffcemux) {
ffCmux = dffmux; ffCmux = dffcemux;
ffCenpol = dffenpol; ffCenpol = dffenpol;
} }
sigC = dffD; sigC = dffD;
@ -301,9 +301,9 @@ code argQ
dff = ff; dff = ff;
dffD = argQ; dffD = argQ;
dffD.replace(port(ff, \Q), port(ff, \D)); dffD.replace(port(ff, \Q), port(ff, \D));
// Only search for ffmux if ff.Q has at // Only search for ffcemux if argQ has at
// least 3 users (ff, dsp, ffmux) and // least 3 users (ff, <upstream>, ffcemux) and
// its ff.D only has two (ff, ffmux) // its ff.D only has two (ff, ffcemux)
if (!(nusers(argQ) >= 3 && nusers(dffD) == 2)) if (!(nusers(argQ) >= 3 && nusers(dffD) == 2))
argQ = SigSpec(); argQ = SigSpec();
} }
@ -313,30 +313,30 @@ code argQ
} }
endcode endcode
match ffmux match ffcemux
if !argQ.empty() if !argQ.empty()
select ffmux->type.in($mux) select ffcemux->type.in($mux)
index <SigSpec> port(ffmux, \Y) === port(ff, \D) index <SigSpec> port(ffcemux, \Y) === port(ff, \D)
filter GetSize(port(ffmux, \Y)) >= GetSize(dffD) filter GetSize(port(ffcemux, \Y)) >= GetSize(dffD)
slice offset GetSize(port(ffmux, \Y)) slice offset GetSize(port(ffcemux, \Y))
filter offset+GetSize(dffD) <= GetSize(port(ffmux, \Y)) filter offset+GetSize(dffD) <= GetSize(port(ffcemux, \Y))
filter port(ffmux, \Y).extract(offset, GetSize(dffD)) == dffD filter port(ffcemux, \Y).extract(offset, GetSize(dffD)) == dffD
choice <IdString> AB {\A, \B} choice <IdString> AB {\A, \B}
filter offset+GetSize(argQ) <= GetSize(port(ffmux, \Y)) filter offset+GetSize(argQ) <= GetSize(port(ffcemux, \Y))
filter port(ffmux, AB).extract(offset, GetSize(argQ)) == argQ filter port(ffcemux, AB).extract(offset, GetSize(argQ)) == argQ
define <bool> pol (AB == \A) define <bool> pol (AB == \A)
set ffenpol pol set ffenpol pol
semioptional semioptional
endmatch endmatch
code code
if (ffmux) { if (ffcemux) {
dffmux = ffmux; dffcemux = ffcemux;
dffenpol = ffenpol; dffenpol = ffenpol;
dffD = port(ffmux, dffenpol ? \B : \A); dffD = port(ffcemux, dffenpol ? \B : \A);
} }
else else
dffmux = nullptr; dffcemux = nullptr;
endcode endcode
// ####################### // #######################
@ -375,12 +375,12 @@ endmatch
code argD code argD
if (ffmux) { if (ffmux) {
dffmux = ffmux; dffcemux = ffmux;
dffenpol = ffenpol; dffenpol = ffenpol;
argD = port(ffmux, \Y); argD = port(ffmux, \Y);
} }
else else
dffmux = nullptr; dffcemux = nullptr;
endcode endcode
match ff_enable match ff_enable
@ -406,7 +406,6 @@ code
dff = ff_enable; dff = ff_enable;
else else
dff = ff; dff = ff;
log_dump("ffM", dff, dffmux);
if (dff) { if (dff) {
dffQ = port(dff, \Q); dffQ = port(dff, \Q);