VHDL attributes equivalent

B

BlueDoze

Guest
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,
 
"BlueDoze" <bluedoze@yahoo.com> wrote in message
news:a53ecee3.0402190342.7f52719e@posting.google.com...
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: jonathan.bromley@doulos.com
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.
 

Welcome to EDABoard.com

Sponsor

Back
Top