Hello everyone,
for my current project I need some kind of lookup-table.
Setting:
I have different CPU Modes and depending on the mode, I need to
access certain registerbanks (yeah, it's an arm-ripof)
My intentional idea was to create a dictionary where the keys are the
modes and the values are the register numbers, e.g.
>
> regbank = {
> cpumode_User : (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11,
> R12, R13, R14, PC, CPSR),
> ..... }
>
> registers = [Signal(intbv(0)[32:]) for _ in range(37)]
and then access them via registers[regbank[mode][rd]] whereas mode is
the mode (just an Signal(int)) and rd is the destionation register. R0,
R1, ... etc are ints as well
This leads to:
> Object type is not supported in this context: regbank, <type 'dict'>
Okay, I thought, then I will just outsource the tuples to variables and
make a "big" if/elif switch-case. But that don't work either :/
> AssertionError: var MYHDL2_getRegisterbank has unexpected type <class
> 'myhdl.conversion._analyze._Rom'>
or
> Object type is not supported in this context: USER, <type 'tuple'>
This is frustrating and I don't know why, because ROM works with tuples
too. So, what kind of mistake I am doing here?
My idea would also to add a section in the examples for a LUT, because I
think that is something you use from time to time.
Thanks in advance,
Marcel
Ps. here is a gist for a better overview
https://gist.github.com/punkkeks/d09e26f67d15cd2caf6a
|