Libre RISC-V Mailing list Archives (accessible via public-inbox)
 help / color / Atom feed
From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Libre-RISCV General Development <libre-riscv-dev@lists.libre-riscv.org>
Subject: Re: [libre-riscv-dev] Named Records in nMigen
Date: Mon, 1 Jun 2020 11:15:12 +0100
Message-ID: <CAPweEDzf3UA9d0rbbkSY6x4omKNwpfCn+pCkJJxQwufAWAfCrw@mail.gmail.com> (raw)
In-Reply-To: <E02C3F23-49C5-4C65-8B05-AD085772FDD1@gatech.edu>

On Mon, Jun 1, 2020 at 7:29 AM Yehowshua <yimmanuel3@gatech.edu> wrote:
>
> Does anybody know if its possible to have a named records

Record.  give each bit (or bit range) a name and it is possible to
either assign (eq) to each bit (or bit range) *or* to the entire
thing.  bear in mind caveat (1) below.


> or subsignals in nMigen?

as Jock says: python slice, and use an Enum or a defined (named) constant.

bear in mind the following:

* Record is treated as a sequence of bits... *not* a sequence of
fields. several people objected to this, and whitequark to her credit
finally listened. however the replacement for Record is still under
development.

* RecordObject was created to allow for an over-ride of the behaviour
of Record, providing us with the ability to actually have something
more like python OO behaviour.

* you can use Cat on *BOTH* sides of the equation.  *PAY ATTENTION* to
the LSB-MSB ordering.  Cat is in *LSB* sequential ordering starting
from the 1st argument, where numbers, in the ENGLISH LANGUAGE, start
from the *MSB*.

   m.d.comb += Cat(mysig[0], mysig[5], mysig[6]).eq(Const(0b110, 3)

is equivalent to:

   m.d.comb += mysig[0].eq(0)
   m.d.comb += mysig[5].eq(1)
   m.d.comb += mysig[6].eq(1)

* to cope with both POWER9 LE/BE and also to help with ISA field
decoding, we created something that allows for "remapping" of fields.
it's called SignalBitRange.  this allows you to *remap* a sequence of
bits to completely different ranges.

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

      parent reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01  6:29 Yehowshua
2020-06-01  6:33 ` Yehowshua
2020-06-01  7:17   ` Jock Tanner
2020-06-01 10:15 ` Luke Kenneth Casson Leighton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPweEDzf3UA9d0rbbkSY6x4omKNwpfCn+pCkJJxQwufAWAfCrw@mail.gmail.com \
    --to=lkcl@lkcl.net \
    --cc=libre-riscv-dev@lists.libre-riscv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Libre RISC-V Mailing list Archives (accessible via public-inbox)

Archives are clonable: git clone --mirror https://inbox.libre-soc.org/libre-riscv-dev

Example config snippet for mirrors


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git