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


Groups > comp.lang.forth > #1052

Re: Verilog macro issue

NNTP-Posting-Date Thu, 07 Apr 2011 17:26:55 -0500
From Chris Hinsley <chris.hinsley@gmail.com>
Newsgroups comp.lang.forth
Date Thu, 7 Apr 2011 23:26:55 +0100
Message-ID <2011040723265536787-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> <2011040313203492550-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 60
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-6W7gwD+Zdb9Pg3H55fyXHvSJOAZs8NedydrNLJfkIxJtYnNPRyCMHzPHwM8o1MSl2jHZtKCnSGWY7TB!dY+llJseibdVeMLfrXm6WyOhxl8OoIYVJJcL4nTX7SKkGu75kZCj8XEwqSFsfKArGO5keg==
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 3061
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:1052

Show key headers only | View raw


On 2011-04-03 13:20:34 +0100, Chris Hinsley said:

> 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)

I just had a very interesting and educational chat on the Verilog news 
list about this macro !

Learned loads of good things about Verilog, and my _unconventional_ use 
of Verilog macros caused some intrest.

It's apparent to me now that what I did, due to not understanding some 
finner points of Verilog, was fall back on the macro system to create a 
Forth style generating word ! And then used that word to make the 
Verilog source that I wanted. Apparently this isn't a much used or 
loved feature of Verilog, but it ties in with my thoughts on macro 
systems and how much Forth is just a macro system. !

A very good macro system I might add.

Chris

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