Standard library packages for bit and strings?

P

Peter Soerensen

Guest
I have used VHDL for many years now.
I believe I have a good overview over existing packages.

I think two essential packages are missing:

I will call them BIT_LOGIC and STRING.

Can anyone explain why they have not been made long ago?

STRING (simulation only)
The standard TEXTIO is very primite and simple string functions that can
convert any signal type to a string for write to std_out are missing.
I have made my own and could not do any serious testbench and simulation
work without it. But I simply do not understand why the VHDL committee
has not made a standard lib.
I would propose something like the printf functions in C.
I know it is very easy to do, when you have tryed it ones, but it is a
large step for beginners and it is a vaste or resources that we all do it.
You can get my simple lib for a start, but is very primitive compared to
the printf statement. Anyone with a SW+VHDL background got do it better
than me within a very short time.

So why use bit when we have std_logic, this may be the reason.
First properly implement bit functions should be faster to simulate than
std_logic bacause they only have 2 values compare to 9.
Okay computers are fast and this is not the major reason for slow
simulation on big designs.
But second when designs logic without any tristate function like
internal signals in FPGA and must ASIC I find it much more logical to
use bits.

BIT_LOGIC
Originally VHDL was made without packages for synthesis because it was
made for simulation only. Later when synopsis started to support
synthesis and made the synopsys packages that support std_logic but to
day I would recommend these and only use VHDL standard libs: numeric_std
and numeric_bit. However no libs support a number of functions for bits
that exits in std_logic_1164; E.g:

function "not" (1:bit) return bit;
function "and" (1,r:bit) return bit;
etc

numeric_std defines logic for unsigned and even the rising_edge(clk) but
I miss the logic functions for bit and bit_vector when you do not need
or want to see them as numeric.
 
Peter Soerensen wrote:
I have used VHDL for many years now.
I believe I have a good overview over existing packages.

I think two essential packages are missing:

I will call them BIT_LOGIC and STRING.

Can anyone explain why they have not been made long ago?

STRING (simulation only)
The standard TEXTIO is very primite and simple string functions that can
convert any signal type to a string for write to std_out are missing.
I have made my own and could not do any serious testbench and simulation
work without it. But I simply do not understand why the VHDL committee
has not made a standard lib.
I would propose something like the printf functions in C.
I know it is very easy to do, when you have tryed it ones, but it is a
large step for beginners and it is a vaste or resources that we all do it.
You can get my simple lib for a start, but is very primitive compared to
the printf statement. Anyone with a SW+VHDL background got do it better
than me within a very short time.
There's a lot more string functionality in VHDL-2008.

Also you might want to look at the Mentor SDK, which is supplied with
Modelsim. I'm not sure what it's licensing is for other simulators.

Also the company Easics used to have a package PCK_FIO which emulated
some printf-like behaviour.

<snip>
BIT_LOGIC
Originally VHDL was made without packages for synthesis because it was
made for simulation only. Later when synopsis started to support
synthesis and made the synopsys packages that support std_logic but to
day I would recommend these and only use VHDL standard libs: numeric_std
and numeric_bit. However no libs support a number of functions for bits
that exits in std_logic_1164; E.g:
Sounds like you need IEEE.numeric_bit

regards
Alan


--
Alan Fitch
Senior Consultant

Doulos – Developing Design Know-how
VHDL * Verilog * SystemVerilog * SystemC * PSL * Perl * Tcl/Tk * Project
Services

Doulos Ltd. Church Hatch, 22 Marketing Place, Ringwood, Hampshire, BH24
1AW, UK
Tel: + 44 (0)1425 471223 Email: alan.fitch@doulos.com
Fax: +44 (0)1425 471573 http://www.doulos.com

------------------------------------------------------------------------

This message may contain personal views which are not the views of
Doulos, unless specifically stated.
 
Alan Fitch wrote:
Peter Soerensen wrote:

BIT_LOGIC
Originally VHDL was made without packages for synthesis because it was
made for simulation only. Later when synopsis started to support
synthesis and made the synopsys packages that support std_logic but to
day I would recommend these and only use VHDL standard libs:
numeric_std and numeric_bit. However no libs support a number of
functions for bits that exits in std_logic_1164; E.g:


Sounds like you need IEEE.numeric_bit
Whoops, sorry I didn't notice numeric_bit in your list - which operators
trouble you? According to the VHDL-2002 standard

"The logical operators and, or, nand, nor, xor, xnor, and not are
defined for predefined types BIT and
BOOLEAN. They are also defined for any one-dimensional array type whose
element type is BIT or
BOOLEAN."

regards
Alan



--
Alan Fitch
Senior Consultant

Doulos – Developing Design Know-how
VHDL * Verilog * SystemVerilog * SystemC * PSL * Perl * Tcl/Tk * Project
Services

Doulos Ltd. Church Hatch, 22 Marketing Place, Ringwood, Hampshire, BH24
1AW, UK
Tel: + 44 (0)1425 471223 Email: alan.fitch@doulos.com
Fax: +44 (0)1425 471573 http://www.doulos.com

------------------------------------------------------------------------

This message may contain personal views which are not the views of
Doulos, unless specifically stated.
 
See link below for some C type functions.

http://bear.ces.cwru.edu/VHDL/index.html

Also see this thread that discusses some issues I found with the
packages.

http://groups.google.com/group/comp.lang.vhdl/browse_thread/thread/9bc060881f29ed78/cca9dbaded3bbbcd?hl=en#cca9dbaded3bbbcd
 
On May 18, 3:08 pm, Alan Fitch <alan.fi...@spamtrap.com> wrote:
Also the company Easics used to have a package PCK_FIO which emulated
some printf-like behaviour.

This package can be found at:
http://www.easics.com/webtools/freesics

--
Philippe Faes
http://www.sigasi.com
 
philippe.faes@gmail.com wrote:
On May 18, 3:08 pm, Alan Fitch <alan.fi...@spamtrap.com> wrote:
Also the company Easics used to have a package PCK_FIO which emulated
some printf-like behaviour.

This package can be found at:
http://www.easics.com/webtools/freesics

--
Philippe Faes
http://www.sigasi.com
Thank you Philippe and everyone else for your inputs.

best regards
Peter Sřrensen
 

Welcome to EDABoard.com

Sponsor

Back
Top