Libre RISC-V Mailing list Archives (accessible via public-inbox)
 help / color / Atom feed
From: Jock Tanner <tanner.of.kha@gmail.com>
To: Libre-RISCV General Development <libre-riscv-dev@lists.libre-riscv.org>
Subject: Re: [libre-riscv-dev] Named Records in nMigen
Date: Mon, 01 Jun 2020 17:17:33 +1000
Message-ID: <d170ca7ac79cc2bd2d422153af771919c9d35ce6.camel@gmail.com> (raw)
In-Reply-To: <0C1DDF53-BB1C-4191-A850-31410BA4734B@gatech.edu>

Yehowshua,

In case you or anybody else come back to this question eventually: it
is possible to define a subsignal using built-in `slice()`. For
example, if the bits 4-7 of your instruction defines a source register,
you can do something similar to

  INSTR_SRC = slice(4, 8)

  # ...

  m.d.comb += self.src_reg.eq(instr[INSTR_SRC])

... or even wrap slices in standard `enum.Enum`:

  class InstrFormat(Enum):
    dst = slice(4)
    src = slice(4, 8)
    # ...

  m.d.comb += self.src_reg.eq(instr[InstrFormat.src])

Hope it helps.

On Mon, 2020-06-01 at 02:33 -0400, Yehowshua wrote:
> Actually - scratch that - I got it working fine.
> 
> Yehowshua
> 
> _______________________________________________
> libre-riscv-dev mailing list
> libre-riscv-dev@lists.libre-riscv.org
> http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev


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

  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 [this message]
2020-06-01 10:15 ` Luke Kenneth Casson Leighton

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=d170ca7ac79cc2bd2d422153af771919c9d35ce6.camel@gmail.com \
    --to=tanner.of.kha@gmail.com \
    --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