I am writing Chisel code for what I am told to be a type of funnel shifter. Basically it gets inputs of size m bits and sends outputs of size n bits where m and n can have any relationship or not.
I am saving the m bit words in a buffer and then need to dynamically index into the buffer to get n bits. Similarly for writing, I must write at the boundary of n rather than m to not have a sort of fragmentation. For this I am using read_pointer and write_pointer registers.and need to select bits from the buffer using the pointers as indices.
But Chisel is not allowing me to use a register as an index value into another register. How can I do this ? THe code is as -
when (io.pull && !(io.empty))
{
when ((buffer_rp +& out_word_size.U) <= (buffer_size-1).U ) // No wraparound
{
io.data_out := buffer (buffer_rp + (out_word_size - 1).U, buffer_rp)
}
.otherwise // Wraparound
{
}
}
The error message I get is -
cmd24.sc:87: overloaded method value apply with alternatives: (x: BigInt,y: BigInt)chisel3.UInt (x: Int,y: Int)chisel3.UInt cannot be applied to (chisel3.UInt, chisel3.UInt) io.data_out := buffer (buffer_rp + (out_word_size - 1).U, buffer_rp) ^Compilation Failed
Thanks