Writing to stdout in VHDL

Discussion in 'VHDL' started by moshezsb, Sep 21, 2004.

  1. moshezsb

    moshezsb Guest

    I am trying to write a debug message to stdout. It appears that the only
    way
    to do this is with the assert command.
    So, in Verilog, I would type
    $display ("mem[%d] = %d", i, mem);

    In VHDL I get something like
    assert (1=0) report "mem[" & integer'image(i) & "] = " &
    integer'image(mem)) severity note;

    Is this the only way to do this? Does textio only work on a file or can it
    be used on stdout?
    moshezsb, Sep 21, 2004
    #1
    1. Advertising

  2. moshezsb

    Steffen Netz Guest

    Hello,

    the package textio defines the files:
    INPUT
    OUTPUT.

    You can write to OUTPUT, which writes to stdout.

    S.Netz
    moshezsb wrote:
    > I am trying to write a debug message to stdout. It appears that the only
    > way
    > to do this is with the assert command.
    > So, in Verilog, I would type
    > $display ("mem[%d] = %d", i, mem);
    >
    > In VHDL I get something like
    > assert (1=0) report "mem[" & integer'image(i) & "] = " &
    > integer'image(mem)) severity note;
    >
    > Is this the only way to do this? Does textio only work on a file or can it
    > be used on stdout?
    >
    >
    Steffen Netz, Sep 21, 2004
    #2
    1. Advertising

  3. Hi,
    As Steffan noted, you do have STDOUT possibility using TEXTIO. You may
    also want to try:

    http://www.easics.com/webtools/freesics/PCK_FIO-2002.7

    They have a neat printf like package. Also a google search for "printf vhdl
    package" yielded:
    bear.ces.cwru.edu/vhdl/source/debugio_h.vhd

    HTH
    Srinivasan

    "moshezsb" <> wrote in message
    news:...
    > I am trying to write a debug message to stdout. It appears that the only
    > way
    > to do this is with the assert command.
    > So, in Verilog, I would type
    > $display ("mem[%d] = %d", i, mem);
    >
    > In VHDL I get something like
    > assert (1=0) report "mem[" & integer'image(i) & "] = " &
    > integer'image(mem)) severity note;
    >
    > Is this the only way to do this? Does textio only work on a file or can it
    > be used on stdout?
    >
    >
    Srinivasan Venkataramanan, Sep 21, 2004
    #3
  4. moshezsb

    moshezsb Guest

    Hello Steffen ,
    Thank you very much for the quick answer.
    regards,
    Moshe.F
    moshezsb, Sep 21, 2004
    #4
  5. moshezsb

    moshezsb Guest

    Hello Steffen,
    Thank you for the Quick answer.
    Regards,
    Moshe.F
    moshezsb, Sep 21, 2004
    #5
  6. moshezsb

    moshezsb Guest

    Hi Srinivasan,
    Thank you for the quick answer.
    Regards,
    Moshe.F
    moshezsb, Sep 21, 2004
    #6
  7. "moshezsb" <> wrote in message news:<>...

    > In VHDL I get something like
    > assert (1=0) report "mem[" & integer'image(i) & "] = " &
    > integer'image(mem)) severity note;
    >
    > Is this the only way to do this?


    This would do the same thing:

    report "mem("
    & integer'image(i)
    & ") = "
    & integer'image(mem(i));

    -- Mike Treseler
    Mike Treseler, Sep 21, 2004
    #7
  8. moshezsb

    Mariusz Guest

    Hello.
    Could you write sample with use package textio to write a debug message.

    Now I'm use syntax: assert report ...... as Steffen Netz.

    Thx
    Mariusz, Sep 21, 2004
    #8
  9. moshezsb

    Steffen Netz Guest

    Hy Mariusz,

    look at the example below.
    Caution the first ( commented) form of the file declaration is vhdl93,
    the second vhdl87!


    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    USE STD.TEXTIO.ALL;
    USE IEEE.STD_LOGIC_TEXTIO.ALL;

    deassemble : PROCESS (trig)
    -- FILE reportfile : text IS OUT "deassemble.ir";
    FILE reportfile : text OPEN WRITE_MODE IS "deassemble.ir";

    VARIABLE befehl: line;
    BEGIN
    IF trig'event AND trig = '1' AND trig'last_value = '0' THEN
    IF dec = '1' THEN
    write(befehl,now);
    write(befehl,string'(" -> "));
    hwrite(befehl,adr);
    write(befehl,string'(" : "));
    hwrite(befehl,ir);

    writeline(REPORTFILE,befehl); -- writes to "deassemble.ir"
    writeline(OUTPUT,befehl); -- writes to std_output
    end if;
    end process;

    regard,
    Steffen

    Mariusz wrote:
    > Hello.
    > Could you write sample with use package textio to write a debug message.
    >
    > Now I'm use syntax: assert report ...... as Steffen Netz.
    >
    > Thx
    >
    >
    Steffen Netz, Sep 22, 2004
    #9
  10. moshezsb

    Mariusz Guest

    Hello.
    Thx for sample code.
    But i have problem with writes to "deassemble.ir"

    In output window is next error
    # Error: COMP96_0093: shft_reg.vhd : (69, 14): Actual parameter types in
    subprogram call do not match subprogram formal parameter types.

    I use first and second form file declaration .

    Mariusz

    Uzytkownik "Steffen Netz" <> napisal w wiadomosci
    news:20040922102210.5ed6d964@sund35...
    >
    >
    > Hy Mariusz,
    >
    > look at the example below.
    > Caution the first ( commented) form of the file declaration is vhdl93,
    > the second vhdl87!
    >
    >
    > library IEEE;
    > use IEEE.STD_LOGIC_1164.ALL;
    > use IEEE.STD_LOGIC_ARITH.ALL;
    > USE STD.TEXTIO.ALL;
    > USE IEEE.STD_LOGIC_TEXTIO.ALL;
    >
    > deassemble : PROCESS (trig)
    > -- FILE reportfile : text IS OUT "deassemble.ir";
    > FILE reportfile : text OPEN WRITE_MODE IS "deassemble.ir";
    >
    > VARIABLE befehl: line;
    > BEGIN
    > IF trig'event AND trig = '1' AND trig'last_value = '0' THEN
    > IF dec = '1' THEN
    > write(befehl,now);
    > write(befehl,string'(" -> "));
    > hwrite(befehl,adr);
    > write(befehl,string'(" : "));
    > hwrite(befehl,ir);
    >
    > writeline(REPORTFILE,befehl); -- writes to "deassemble.ir"
    > writeline(OUTPUT,befehl); -- writes to std_output
    > end if;
    > end process;
    >
    > regard,
    > Steffen
    >
    > Mariusz wrote:
    > > Hello.
    > > Could you write sample with use package textio to write a debug

    message.
    > >
    > > Now I'm use syntax: assert report ...... as Steffen Netz.
    > >
    > > Thx
    > >
    > >

    >
    Mariusz, Sep 22, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Watson

    Writing binary to stdout

    Paul Watson, Jun 22, 2004, in forum: Python
    Replies:
    7
    Views:
    1,125
    Christos TZOTZIOY Georgiou
    Jul 9, 2004
  2. Elad
    Replies:
    0
    Views:
    397
  3. afd
    Replies:
    1
    Views:
    8,258
    Colin Paul Gloster
    Mar 23, 2007
  4. Andreas S
    Replies:
    3
    Views:
    243
    Eric Hodel
    Dec 9, 2006
  5. Replies:
    2
    Views:
    319
    A. Sinan Unur
    Dec 7, 2005
Loading...

Share This Page