[libre-riscv-dev] spike-sv non-default element widths

Luke Kenneth Casson Leighton lkcl at lkcl.net
Thu Oct 18 06:46:54 BST 2018


---
crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68

On Wed, Oct 17, 2018 at 8:47 PM Jacob Lifshay <programmerjake at gmail.com> wrote:
>
> On Wed, Oct 17, 2018, 05:06 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
> wrote:
>
> > https://libre-riscv.org/simple_v_extension/specification/#elwidth
> >
> > new section in specification on element widths, including pseudo-code.
> > comments / thoughts appreciated, am slowly working towards getting
> > this implemented.
> >
> Note that how you've written the reg_t union with pointers in it, using the
> pointers like arrays won't achieve your intended effect, they will instead
> reinterpret the value of the register as the memory address at which to
> load/store when (I assume) reading/writing from/to the registers.

 there's a trick in c where you can reference pointer as an array.
the other syntax i believe is uint8_t b[] which may be clearer

> You can
> use arrays, but that won't work for larger-than-xlen values as that makes
> the compiler insert padding for alignment purposes.

 i believe uint8_t b[] does the trick, although from my samba /
DCE/RPC days i am fairly certain that's equivalent to uint8_t *b,
anyway.

 the main thing here for the spec is clarity: keeping the pseudo-code
down to the bare minimum.  what's there is already way too long.

> You could do something
> like:
>
> https://gcc.godbolt.org/z/j9D4fo

 superb.  that will help when it comes to implementing.  i was going
to just do it the c way.

l.



More information about the libre-riscv-dev mailing list