Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Writing std_logic_vector?

 
Thread Tools Search this Thread
Old 11-21-2008, 05:38 PM   #1
Default Writing std_logic_vector?


Hi

I am wondering if there is any way that I can write a
std_logic_vector(31 downto 0) into a file and there is should
be written then as a HEX value? Is there something like

val = ABC(31 downto 0);
write(s, hex'(val));

Thanks


Philipp
  Reply With Quote
Old 11-21-2008, 06:39 PM   #2
KJ
 
Posts: n/a
Default Re: Writing std_logic_vector?
On Nov 21, 12:38*pm, Philipp <Phil...@gmx.at> wrote:
> Hi
>
> I am wondering if there is any way that I can write a
> std_logic_vector(31 downto 0) into a file and there is should
> be written then as a HEX value? Is there something like
>
> * val = ABC(31 downto 0);
> * write(s, hex'(val));
>
> Thanks


Google for 'image_pkg' and Ben Cohen. That should produce a VHDL file
with a package that converts different types into a string. He has
both an 'image' and a 'heximage' function for std_logic_vector types.
Image produces a character for every bit in the vector (i.e. when
displayed/written it will look like binary). Heximage produces a
hexadecimal formatted string.
http://www.google.com/search?hl=en&q..._pkg+Ben+Cohen

Once you've got a string you can use standard text I/O facilities to
write out your file.

Kevin Jennings


KJ
  Reply With Quote
Old 11-21-2008, 07:11 PM   #3
beky4kr@gmail.com
 
Posts: n/a
Default Re: Writing std_logic_vector?
On 21 ×*ובמבר, 21:04, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
wrote:
> On Fri, 21 Nov 2008 17:38:07 +0000, Philipp <Phil...@gmx.at> wrote:
> >I am wondering if there is any way that I can write a
> >std_logic_vector(31 downto 0) into a file and there is should
> >be written then as a HEX value? Is there something like

>
> > val = ABC(31 downto 0);
> > write(s, hex'(val));

>
> KJ is right, but you could also consider using the
> std_logic_textio package - originally from Synopsys,
> but fully supported by all serious simulators and,
> indeed, now incorporated into the latest VHDL standard.
>
> library ieee;
> use ieee.std_logic_1164.all; -- as usual
> use std.textio.all; -- as usual
> use ieee.std_logic_textio.all; -- this is the new part
>
> ....
> variable v: std_logic_vector (31 downto 0);
> variable L: line;
> ....
> write(L, v); -- writes 32 characters for the 32 bits
> hwrite(L, v); -- writes 8 hex digits or Xs
>
> read() and hread() too.
>
> Note that the value or variable must be an exact multiple
> of 4 elements, or else hwrite() won't work.
> --
> Jonathan Bromley, Consultant
>
> DOULOS - Developing Design Know-how
> VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
>
> Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
> jonathan.brom...@MYCOMPANY.comhttp://www.MYCOMPANY.com
>
> The contents of this message may contain personal views which
> are not the views of Doulos Ltd., unless specifically stated.


Hi
I have a nice example of an AHB monitor. It monitors the data on an
AHB and writes a nice log.
h--p://bknpk.no-ip.biz/AHB_MON/ahb_mon_1.html

The code is available at:
h--p://bknpk.no-ip.biz/cgi-bin/InputForm_1.pl
AHB monitor.
-->file instantiation example:mcore.vhd

-->file the monitor:mon.vhd


beky4kr@gmail.com
  Reply With Quote
Old 11-24-2008, 09:09 AM   #4
Tricky
 
Posts: n/a
Default Re: Writing std_logic_vector?
On 21 Nov, 19:04, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
wrote:
> On Fri, 21 Nov 2008 17:38:07 +0000, Philipp <Phil...@gmx.at> wrote:
> >I am wondering if there is any way that I can write a
> >std_logic_vector(31 downto 0) into a file and there is should
> >be written then as a HEX value? Is there something like

>
> > *val = ABC(31 downto 0);
> > *write(s, hex'(val));

>
> KJ is right, but you could also consider using the
> std_logic_textio package - originally from Synopsys,
> but fully supported by all serious simulators and,
> indeed, now incorporated into the latest VHDL standard.
>
> library ieee;
> use ieee.std_logic_1164.all; *-- as usual
> use std.textio.all; * * * * * -- as usual
> use ieee.std_logic_textio.all; -- this is the new part
>
> ....
> * variable v: std_logic_vector (31 downto 0);
> * variable L: line;
> ....
> * write(L, v); *-- writes 32 characters for the 32 bits
> * hwrite(L, v); -- writes 8 hex digits or Xs
>
> read() and hread() too.
>
> Note that the value or variable must be an exact multiple
> of 4 elements, or else hwrite() won't work.
> --
> Jonathan Bromley, Consultant
>
> DOULOS - Developing Design Know-how
> VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
>
> Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
> jonathan.brom...@MYCOMPANY.comhttp://www.MYCOMPANY.com
>
> The contents of this message may contain personal views which
> are not the views of Doulos Ltd., unless specifically stated.


You forgot to mention ORead/OWrite if octal is your fettish.


Tricky
  Reply With Quote
Old 11-24-2008, 09:11 AM   #5
Tricky
 
Posts: n/a
Default Re: Writing std_logic_vector?
On 21 Nov, 19:04, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
wrote:
> On Fri, 21 Nov 2008 17:38:07 +0000, Philipp <Phil...@gmx.at> wrote:
> >I am wondering if there is any way that I can write a
> >std_logic_vector(31 downto 0) into a file and there is should
> >be written then as a HEX value? Is there something like

>
> > *val = ABC(31 downto 0);
> > *write(s, hex'(val));

>
> KJ is right, but you could also consider using the
> std_logic_textio package - originally from Synopsys,
> but fully supported by all serious simulators and,
> indeed, now incorporated into the latest VHDL standard.
>
> library ieee;
> use ieee.std_logic_1164.all; *-- as usual
> use std.textio.all; * * * * * -- as usual
> use ieee.std_logic_textio.all; -- this is the new part
>
> ....
> * variable v: std_logic_vector (31 downto 0);
> * variable L: line;
> ....
> * write(L, v); *-- writes 32 characters for the 32 bits
> * hwrite(L, v); -- writes 8 hex digits or Xs
>
> read() and hread() too.
>
> Note that the value or variable must be an exact multiple
> of 4 elements, or else hwrite() won't work.
> --
> Jonathan Bromley, Consultant
>
> DOULOS - Developing Design Know-how
> VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
>
> Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
> jonathan.brom...@MYCOMPANY.comhttp://www.MYCOMPANY.com
>
> The contents of this message may contain personal views which
> are not the views of Doulos Ltd., unless specifically stated.


Also, forgot to add:
Currently Hread/hwrite only works with busses that are multplies of 4
long, but I seem to remember something being mentioned that they were
dropping this restriction?


Tricky
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Complications with installing two DVD writing software in laptop Roy DVD Video 1 08-14-2007 03:09 PM
Cannot read a DVD-RAM disk in my PC recorded by a Panasonic DVD/HDD recorder dkelertas@gmail.com DVD Video 4 05-07-2006 06:00 PM
Cannot erase DVD-RW Terry Pinnell DVD Video 54 10-09-2005 10:14 PM
Alternative DVD encoding & writing software John DVD Video 160 05-05-2005 08:27 PM
Re: Nero - Writing to cache frustration John Tsalikes DVD Video 3 08-09-2003 09:01 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46