From: Jacob Lifshay <programmerjake@gmail.com>
To: Libre-RISCV General Development <libre-riscv-dev@lists.libre-riscv.org>
Subject: [libre-riscv-dev] teaching the benefits of using nmigen over VHDL/Verilog
Date: Wed, 13 May 2020 10:49:55 -0700
Message-ID: <CAC2bXD7R_hA-6HhNP_kimq3YCgzUoq0o4_ch4x1bS2XUGMnwVQ@mail.gmail.com> (raw)
In-Reply-To: <CAPweEDy_hRZj4EFaViq95kyKxjFb_nfQZX1OBKg9Zvde1YTmTw@mail.gmail.com>
On Tue, May 12, 2020, 08:04 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
wrote:
> the next level up from that would be to say, "ok now do a 128-bit
> adder", and they will struggle to create efficient-looking code in
> VHDL, because they will end up cut/pasting 128 full-adders into the
> file. the point of *that* exercise being to point out to them that
> VHDL (and verilog) are *not* adequate modern languages (they never
> were), and that nmigen you can use a *python for-loop* to create - and
> link up - the 128 full-adders.
>
That may not be an adequate demonstration, since a 128-bit ripple adder can
be implemented in a few lines using the following pseudo-Verilog:
module full_adder(a, b, c_in, c_out, o);
wire [127:0] a, b, c_in, c_out, o;
assign o = a ^ b ^ c_in;
assign c_out = (a & b) | (a & c_in) | (b & c_in);
endmodule
module adder(a, b, c_in, c_out, o);
wire [127:0] a, b, o, c;
wire c_in, c_out;
full_adder fa(
.a: a,
.b: b,
.o: o,
.c_in: {c[126:0], c_in},
.c_out: c,
);
assign c_out = c[127];
endmodule
Jacob
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev
next prev parent reply index
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 10:45 [libre-riscv-dev] daily kan-ban update 12may2020 Luke Kenneth Casson Leighton
2020-05-12 14:00 ` Tobias Platen
2020-05-12 14:28 ` Michael Nolan
2020-05-12 14:53 ` Luke Kenneth Casson Leighton
2020-05-12 14:42 ` Yehowshua
2020-05-12 15:03 ` Luke Kenneth Casson Leighton
2020-05-13 17:49 ` Jacob Lifshay [this message]
2020-05-13 18:18 ` [libre-riscv-dev] teaching the benefits of using nmigen over VHDL/Verilog Luke Kenneth Casson Leighton
2020-05-13 18:51 ` Michael Nolan
2020-05-13 19:02 ` Jacob Lifshay
2020-05-13 19:54 ` 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=CAC2bXD7R_hA-6HhNP_kimq3YCgzUoq0o4_ch4x1bS2XUGMnwVQ@mail.gmail.com \
--to=programmerjake@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