Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #1159
| From | Chris Hinsley <chris.hinsley@gmail.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Date | 2011-04-11 20:16 +0100 |
| Message-ID | <2011041120165770637-chrishinsley@gmailcom> (permalink) |
| References | <2011040219361212758-chrishinsley@gmailcom> |
| Subject | Re: Verilog macro issue |
Here's what I ended up with after my chat on the Verilog news group. Many thanks to Johnathon Bromley for his crash tutoring on Verilog. :) module enc(i, o); parameter OUT_BITS = 2; localparam IN_BITS = 1 << OUT_BITS; input [IN_BITS-1:0] i; output [OUT_BITS-1:0] o; reg [OUT_BITS-1:0] o; always @(*) begin integer n; o = 0; for (n = 0; n < IN_BITS; n += 1) if (i[n]) o |= n; end endmodule This turns into very nice hardware in Quartus. Chris
Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread
Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-02 19:36 +0100
Re: Verilog macro issue Jan Coombs <jan_2011-02@murray-microft.co.uk> - 2011-04-02 20:26 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-02 20:31 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-02 20:43 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-02 21:36 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-02 22:12 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-02 23:01 +0100
Re: Verilog macro issue Jan Coombs <jan_2011-02@murray-microft.co.uk> - 2011-04-02 23:33 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-03 03:58 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-03 12:27 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-03 13:20 +0100
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-07 23:26 +0100
Re: Verilog macro issue Jan Coombs <jan_2011-02@murray-microft.co.uk> - 2011-04-10 23:20 +0100
Re: Verilog macro issue rickman <gnuarm@gmail.com> - 2011-04-11 10:36 -0700
Re: Verilog macro issue Chris Hinsley <chris.hinsley@gmail.com> - 2011-04-11 20:16 +0100
csiph-web