FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-07-2005, 01:50 AM
Robert Finch
Guest
 
Posts: n/a
Default wish list - register width specification

I have a bunch of 32 bit registers in my design, where bit slices aren't
being taken.

It would be nice if the registers could be declared with just a size spec
like

reg [32] my_reg;

rather than

reg [31:0] my_reg;


Rob



Reply With Quote
  #2 (permalink)  
Old 09-07-2005, 06:45 AM
John_H
Guest
 
Posts: n/a
Default Re: wish list - register width specification

Robert Finch wrote:

> I have a bunch of 32 bit registers in my design, where bit slices aren't
> being taken.
>
> It would be nice if the registers could be declared with just a size spec
> like
>
> reg [32] my_reg;
>
> rather than
>
> reg [31:0] my_reg;
>
>
> Rob


I see four possibilities:
reg [32:1] my_reg;
reg [31:0] my_reg;
reg [1:32] my_reg;
reg [0:31] my_reg;

I wish they'd keep it [a:b]
Reply With Quote
  #3 (permalink)  
Old 09-07-2005, 10:05 AM
Mark McDougall
Guest
 
Posts: n/a
Default Re: wish list - register width specification

Robert Finch wrote:

> I have a bunch of 32 bit registers in my design, where bit slices
> aren't being taken.
> It would be nice if the registers could be declared with just a size
> spec like
> reg [32] my_reg;


`define MY_REGISTER_RANGE 31:0

reg [`MY_REGISTER_RANGE] myRegister;

Regards,
Mark
Reply With Quote
  #4 (permalink)  
Old 09-08-2005, 04:02 PM
[email protected]
Guest
 
Posts: n/a
Default Re: wish list - register width specification

SystemVerilog has a number of ways to do this:

you CAN specify an array in SV with just a size, but that only works
for unpacked arrays (i.e. memories), so you can do:

reg [31:0] mem [1024];

however, you can declare user defined types, so:

typedef reg [31:0] rob_t;

rob_t my_reg;

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inconsistency With Format Specification with $display and $sformat Russell Fredrickson Verilog 5 09-30-2004 09:09 PM
How to vary the number and width of ports? Steven Alexander Verilog 3 05-14-2004 03:33 PM
Trying to monitor output of a register instantiates another register seanadams Verilog 1 02-11-2004 07:13 PM
integer width during synthesis Sachin Chandra Verilog 2 12-29-2003 07:19 PM
Zero width concatenation. Ron Smith Verilog 2 10-24-2003 02:35 PM


All times are GMT +1. The time now is 02:51 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved