scalaspinalhdl

combine logical expression for StaticMemeoryTranslatorPlugin used in VexRiscv


I want to use 2 static memory regions for a vexriscv soc using SpinalHdl.

Having very little experience with SpinalHdl and Scala, so maybe I miss a small detail.

This gives an exception during cpu-generation.

[error] Exception in thread "main" java.lang.AssertionError: assertion failed: ??? vexriscv.MemoryTranslator
[error]     at scala.Predef$.assert(Predef.scala:170)
[error]     at spinal.core.package$.assert(core.scala:467) .....

This gives me a scale error about expanding the fuction :

[error] /home/svhb/dev/JifHybrid/cpu/VexRiscv/src/main/scala/vexriscv/demo/VexRiscv_vdw_1.scala:125:36: missing parameter type for expanded function ((x$1) => x$1.msb)
[error]                   ioRange      = ( _.msb )  || ( _(31 downto 16) === 0x0001 )
[error]                                    ^
[error] one error found

Can someone point me in the right direction?


Solution

  • Just like I thought, it's my lack of knowledge on the scala syntax itself.

    I must fully specify the function to do some extra logic expressions on the iorange function!

    new StaticMemoryTranslatorPlugin(
         ioRange      = a => (a.msb) || (a(31 downto 16) === 0x0001)
      )
    

    instead of just using : ioRange = ( _.msb ) || ( _(31 downto 16) === 0x0001 )

    Have a nice day;)