You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The AConv failure is due to the numeric type operators not being simplified during elaboration. The conversion function aExpr is expecting PrimSelect to have constant numeric type arguments, but the argument containing Prelude.SizeOf is unreduced.
This can be fixed by changing the following line in TCheck.tiField1:
-- XXX disable expanding of type synonyms until failures with TLM
-- XXX (type synonyms which drop parameters) is resolved
-- XXX (tcon_ps, ft) <- expPrimTCons (expandSyn ft0)
(tcon_ps, ft) <- expPrimTCons ft0
to be this:
(tcon_ps, ft) <- expPrimTCons (expandSyn ft0)
However, as the comment says, when we expand synonyms here, it causes AHB/Axi libraries (now in the bsc-contrib repo) to fail to compile. (Specifically, the functions getAHBSize, fromAHBSize, getAxiSize, and fromAxiSize.) This is because there are functions with prototypes like this:
function AHBSize getAHBSize(TLMBurstSize#(`TLM_PRM) incr);
function TLMBurstSize#(`TLM_PRM) fromAHBSize(AHBSize size);
The problem here is that the type alias drops many of the type variable. These definitions only work if type inference can unify against the alias with all its types -- when the alias synonym is expanded away, type inference fails. The TLMBurstSize type would need to be a true newtype (and not a macro) for this to work. BSC is being held back from expanding synonyms, to make this code work (mostly). I think that the TLM code should be rewritten, and BSC's expandSyn should be reinstated.
The TLM code can be changed to just use Bit#(n) (or Bit#(burst_size)) instead of TLMBurstSize#(`TLM_PRM). Or TLMBurstSize can be written as a real type, either by supporting actual newtype in BSC, or with a workaround like this:
This is bug 1720 in Bluespec Inc's pre-GitHub bug database.
Note that there is also an expandSyn in CtxRed that has been commented out, because of the TLM packages. That relates to an example that is filed as bug 1729 in Bluespec's database. Rather than make this issue entry longer, I'll file that as a separate issue here, too.
It's also possible that bsc.bsv-examples/AzureIP/TestDMA.bsv fails to compile, when one or both of these expansions are introduced.
The text was updated successfully, but these errors were encountered:
The testsuite example
bsc.typechecker/primtcons/ExpSizeOf_FieldSyn.bsv
leads to this internal error:The AConv failure is due to the numeric type operators not being simplified during elaboration. The conversion function
aExpr
is expectingPrimSelect
to have constant numeric type arguments, but the argument containingPrelude.SizeOf
is unreduced.This can be fixed by changing the following line in
TCheck.tiField1
:to be this:
However, as the comment says, when we expand synonyms here, it causes AHB/Axi libraries (now in the
bsc-contrib
repo) to fail to compile. (Specifically, the functionsgetAHBSize
,fromAHBSize
,getAxiSize
, andfromAxiSize
.) This is because there are functions with prototypes like this:where:
The problem here is that the type alias drops many of the type variable. These definitions only work if type inference can unify against the alias with all its types -- when the alias synonym is expanded away, type inference fails. The
TLMBurstSize
type would need to be a truenewtype
(and not a macro) for this to work. BSC is being held back from expanding synonyms, to make this code work (mostly). I think that the TLM code should be rewritten, and BSC'sexpandSyn
should be reinstated.The TLM code can be changed to just use
Bit#(n)
(orBit#(burst_size)
) instead ofTLMBurstSize#(`TLM_PRM)
. OrTLMBurstSize
can be written as a real type, either by supporting actualnewtype
in BSC, or with a workaround like this:This is bug 1720 in Bluespec Inc's pre-GitHub bug database.
Note that there is also an
expandSyn
inCtxRed
that has been commented out, because of the TLM packages. That relates to an example that is filed as bug 1729 in Bluespec's database. Rather than make this issue entry longer, I'll file that as a separate issue here, too.It's also possible that
bsc.bsv-examples/AzureIP/TestDMA.bsv
fails to compile, when one or both of these expansions are introduced.The text was updated successfully, but these errors were encountered: