[libre-riscv-dev] spike-sv non-default element widths
Luke Kenneth Casson Leighton
lkcl at lkcl.net
Thu Oct 18 08:28:59 BST 2018
---
crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68
On Thu, Oct 18, 2018 at 8:15 AM Jacob Lifshay <programmerjake at gmail.com> wrote:
>
> On Wed, Oct 17, 2018, 22:47 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
> wrote:
>
> > ---
> > 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
> >
> actually, it's just that array values are implicitly cast to pointers and
> the [] operator is defined in terms of pointers.
pointer... ah drat, the *pointer* gets stored in the struct, doesn't it? damn.
what the heck was it. i *know* this can be done. i have vague
recollections being dredged up from memory, now, from 10 years ago...
i think... i think i saw a solution where the array was declared with
a single element, and then that length completely ignored, quite
deliberately, and over-run to arbitrary length.
yeah.
> see https://gcc.godbolt.org/z/oWbmar for why int v[] and int *v are not
> interchangable. try replacing the int v[0] with int v[] and you will get a
> compile error. Note the -xc command line option is used to switch from c++
> to c mode.
ok cool.
More information about the libre-riscv-dev
mailing list