Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #987

Re: Verilog macro issue

NNTP-Posting-Date Sun, 03 Apr 2011 07:20:34 -0500
From Chris Hinsley <chris.hinsley@gmail.com>
Newsgroups comp.lang.forth
Date Sun, 3 Apr 2011 13:20:34 +0100
Message-ID <2011040313203492550-chrishinsley@gmailcom> (permalink)
References <2011040219361212758-chrishinsley@gmailcom> <EbGdnVLa4s_15QrQnZ2dnUVZ8mCdnZ2d@brightview.co.uk> <2011040223012056408-chrishinsley@gmailcom> <5dGdnYypo8bZOQrQnZ2dnUVZ8s2dnZ2d@brightview.co.uk> <2011040303581035956-chrishinsley@gmailcom> <2011040312274643418-chrishinsley@gmailcom>
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Subject Re: Verilog macro issue
User-Agent Unison/2.1.4
Lines 41
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-miJBr0z5LATa306NRV6MSFguJGO7nDvdG55GdeceAXQ/wpWnybKsa9Pe9GJyhwwYsK8ph2FJD2n18wG!j+0dfh35VUfIOKKpRU6Kt4/WfR80D6hOxCCn1TZvC3P8t6Fz8fVxzjcE5BEWCuIiuoHI2w==
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2209
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!news.giganews.com.POSTED!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.forth:987

Show key headers only | View raw


Hurrah, finally, I managed it. Gee that was tough but educational. !

Thanks Jan for putting me on the path. :)

`define ENCODER(NAME, BITS)  \
module NAME(i, o);  \
	parameter WIDTH = (2 ** BITS);  \
	input [(WIDTH - 1):0] i;  \
	output [(BITS - 1):0] o;  \
	reg [(BITS - 1):0] r;  \
	genvar row;  \
	generate  \
	begin  \
		for (row = 0; row < BITS; row = row + 1)  \
		begin : G  \
			always  \
			begin  \
				integer start;  \
				integer range;  \
				r[row] = 0;  \
				for (start = (2 ** row); start < WIDTH; start = start + (2 ** row) 
+ (2 ** row))  \
				begin  \
					for (range = start; range < (start + (2 ** row)); range = range + 1)  \
					begin  \
						r[row] = (r[row] | i[range]);  \
					end  \
				end  \
			end  \
			assign o[row] = r[row];  \
		end  \
	end  \
	endgenerate  \
endmodule

`ENCODER(enc1, 1)
`ENCODER(enc2, 2)
`ENCODER(enc3, 3)
`ENCODER(enc4, 4)
`ENCODER(enc5, 5)

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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