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 02-19-2004, 12:42 PM
BlueDoze
Guest
 
Posts: n/a
Default VHDL attributes equivalent

I'd like to know the verilog equivalent to the following vhdl code.


entity myEntn is
port ( input : in bit_vector ( 16 downto 1);
output1 : out integer;
output2 : out integer;
output3 : out integer
);
end MyEntn;

architecture Arch of MyEntn is
begin
process ( input )
begin
output1 <= input'left;
output2 <= input'right;
output3 <= input'length;
end process;
end;


Regards,
Reply With Quote
  #2 (permalink)  
Old 02-20-2004, 01:08 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: VHDL attributes equivalent

"BlueDoze" <[email protected]> wrote in message
news:[email protected] om...
> I'd like to know the verilog equivalent to the following vhdl code.
>
> entity myEntn is
> port ( input : in bit_vector ( 16 downto 1);
> output1 : out integer;
> output2 : out integer;
> output3 : out integer
> );
> end MyEntn;
>
> architecture Arch of MyEntn is
> begin
> process ( input )
> begin
> output1 <= input'left;
> output2 <= input'right;
> output3 <= input'length;
> end process;
> end;


First the simple answer: there is no equivalent. In Verilog
you are expected to parameterise the module and then use
those parameters to *define* port widths:

module myModule (In, Out1, Out2, Out3);
parameter left = 16, right = 1;
input [left:right] In;
output [31:0] Out1, Out2, Out3;

assign Out1 = left;
assign Out2 = right;
assign Out3 = left + 1 - right;
endmodule

Second, why do this in a module rather than inline?

Third, the future is bright: SystemVerilog will offer
built-in enquiry functions to find these array attributes.

--

Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: [email protected]
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.




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



All times are GMT +1. The time now is 09:14 AM.


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