Error in simulation


#1

Hi,

I’ve noted that I get an error in simulation when I change the form of the return of a function. If I write the fucntion this way:

func GfMult2(n uint8) uint8 {
	outVar := ((n<<1 | n>>7) ^ ((((n<<1 | n>>7) & 0x01) << 1) | (((n<<1 | n>>7) & 0x01) << 3) | (((n<<1 | n>>7) & 0x01) << 4)))
	return outVar
}

…then it works OK. If I change it to this:

func GfMult2(n uint8) uint8 {
	return  ((n<<1 | n>>7) ^ ((((n<<1 | n>>7) & 0x01) << 1) | (((n<<1 | n>>7) & 0x01) << 3) | (((n<<1 | n>>7) & 0x01) << 4)))
}

…then reco sim run errors out.

test case is here: https://github.com/foolmarks/reco_mix

Mark


#2

Hi Mark,

It looks as though we have an issue with the way we inline functions and this is causing the build to run out of memory. At the moment any single line function which directly returns the result of evaluating an expression is assumed to be simple enough to allow inlining. In this example it means the tools are attempting to inline all the nested Galois Field multiplier calls and this is generating a large amount of duplication in the data flow graphs which the tools are choking on.

We obviously need to be a bit smarter about how we identify functions that can be inlined in this way and are looking at potential improvements. In the meantime, using an intermediate variable as in your working example will prevent the function from being inlined and reduce the compilation overhead.

Chris.