Uint64 supported?


#1

Hi,

reco check is giving me this message:

error[E007]: the language construct 'indexable type :uint64' is not yet supported in the compiler.

…are uint64 variables supported?

thanks,
Mark.


#2

Hi Mark,

uint64 variables are supported. Can you paste some code that reproduces the issue so we can see where this is generated?

Josh


#3

Line being flagged by reco check is: blkOut[0] = blk[0] in the rhoPi function:

func rotLeft(n uint64, count uint) uint64 {
	return (n << count) | (n >> (uint(64) - count))
}

func rhoPi(blk State) State {

	var blkOut State

	blkOut[0] = blk[0]
	blkOut[10] = rotLeft(blk[1], 1)
	blkOut[20] = rotLeft(blk[2], 62)
	blkOut[5] = rotLeft(blk[3], 28)
	blkOut[15] = rotLeft(blk[4], 27)

	blkOut[16] = rotLeft(blk[5], 36)
	blkOut[1] = rotLeft(blk[6], 44)
	blkOut[11] = rotLeft(blk[7], 6)
	blkOut[21] = rotLeft(blk[8], 55)
	blkOut[6] = rotLeft(blk[9], 20)

	blkOut[7] = rotLeft(blk[10], 3)
	blkOut[17] = rotLeft(blk[11], 10)
	blkOut[2] = rotLeft(blk[12], 43)
	blkOut[12] = rotLeft(blk[13], 25)
	blkOut[22] = rotLeft(blk[14], 39)

	blkOut[23] = rotLeft(blk[15], 41)
	blkOut[8] = rotLeft(blk[16], 45)
	blkOut[18] = rotLeft(blk[17], 15)
	blkOut[3] = rotLeft(blk[18], 21)
	blkOut[13] = rotLeft(blk[19], 8)

	blkOut[14] = rotLeft(blk[20], 18)
	blkOut[24] = rotLeft(blk[21], 2)
	blkOut[9] = rotLeft(blk[22], 61)
	blkOut[19] = rotLeft(blk[23], 56)
	blkOut[4] = rotLeft(blk[24], 14)

	return blkOut
}

Full design here:


#4

Any update on this?

thanks,
Mark.


#5

Hi Mark,

Sorry for the delay. I’m not seeing the issue you reported here. When I run a simulation of the linked code, I get the following error:

error[E017]: the type `State (alias for [25]uint64 )` is too large to be embedded into a struct.         

We detail the issue here: http://docs.reconfigure.io/support_troubleshooting.html#compiler-error-messages, but a brief summary is that for types like State, we generate a BRAM for storage, and due to limitations, the compiler can’t embed this into the function arguments.

For our next major release, we are reworking our modeling of function calls. In this new modeling, we will pass the entirety of the function arguments as a single wide register. This will effectively fix this issue.


#6

Hi Josh,

The error message in my original post came from reco check - if I try to simulate I get the same error message as you.

Do you think its possible to work around this current limitation by defining State as a golang struct instead of as an array?

Can you tell me this next major release is coming out?

thanks,
Mark


#7

Hi Mark,

Thanks for clarifying that the issue is in reco-check. We’ll investigate it.

You could feasibly work around the issue by defining the State as a struct. The threshold is that no array can be larger than 512 bytes. Changing the State to be defined as type State [5][5]uint64 allows me to pass it as an argument to functions. The MsgBlock type would need a similar change.

We expect for our next major release to happen this month, hopefully in a couple of weeks. We’ll be publishing more information about the changes coming next week.

Josh


#8

Hi Josh,

I’ve changed the types for Struct & MsgBlk to structs:

type State struct {
XY00, XY10, XY20, XY30, XY40,
XY01, XY11, XY21, XY31, XY41,
XY02, XY12, XY22, XY32, XY42,
XY03, XY13, XY23, XY33, XY43,
XY04, XY14, XY24, XY34, XY44 uint64
}

type MsgBlk224 struct {
MXY00, MXY10, MXY20, MXY30, MXY40,
MXY01, MXY11, MXY21, MXY31, MXY41,
MXY02, MXY12, MXY22, MXY32, MXY42,
MXY03, MXY13, MXY23 uint64
}

…but now I get this in reco check:

error: ...\src\crypto\sha3\sha3.go:5:2: not yet implemented: multiple names for one type


#9

Hi Mark,

I suspect if you were to specify the type for each variable that would work, e.g.

type State struct {
XY00, XY10, XY20 uint64
}

becomes:

type State struct {
XY00 uint64,
XY10 uint64,
XY20 uint64
}

Our next major release includes a better front-end which is able to handle the many-variables-one-type form.


#10

It does indeed fix it.