Connecting of IP core simulated in GHDL to pseudoterminal viaUART-like interface

Discussion in 'VHDL' started by Wojciech M. Zabolotny, Jun 2, 2011.

  1. When working with simulated soft CPUs to be implemented in FPGA,
    I often needed a possibility to connect terminal emulator
    (e.g. Minicom) or my own program to serial port of the simulated
    IP core.

    Finally I've found a solution, which seems to be good enough
    to share it with others.

    I use the pseudoterminal (ptmx) found in Linux to establish
    communication between GHDL simulator and my terminal program.
    However GHDL does not offer functions needed to control
    pseudoterminals, therefore I've prepared a small C library
    (ghdl_pty.c) providing necessary functions via VPI.
    Additionally I needed to provide nonblocking reading from
    the pseudoterminal, to avoid stopping of simulation when no
    data is available this functionality is also implemented
    in ghdl_pty.c, in function ghdl_pty_read.

    From the VHDL side, my pseudo UART is visible as:

    component ghdl_uart
    port (
    data_out : out std_logic_vector(7 downto 0);
    data_in : in std_logic_vector(7 downto 0);
    dav : out std_logic; -- received data available
    ready : out std_logic; -- there is free space in transmit buffer
    empty : out std_logic; -- the transmit buffer is empty
    rd : in std_logic; -- asynchronous read strobe
    wr : in std_logic -- asynchronous write strobe
    );
    end component;

    When new data arrives, "dav" goes high. To read the data, you should
    set "rd" to '1' and the data will be visible on "data_out".
    If no more data are in the input queue, "dav" goes low.

    If you want to write data, you put them on "data_in", and rise "wr".
    The data are transmitted to the output queue, and later transmitted
    to the pseudoterminal.

    Full sources, published as public domain are available on
    alt.sources usenet group, in thread "Pseudo UART allowing to connect
    via pseudoterminal to GHDL simulated IP core"
    ( news:<>
    http://http://groups.google.com/group/alt.sources/msg/bc8eb919101839ba )

    You can find more information in the "desc.txt" file available in the
    archive contained in the alt.sources message.

    I hope, that the emulated UART will be useful for you.

    Wojciech M. Zabolotny
    wzab<at>ise.pw.edu.pl
     
    Wojciech M. Zabolotny, Jun 2, 2011
    #1
    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. stan k.
    Replies:
    1
    Views:
    699
    John C. Bollinger
    Sep 23, 2003
  2. Jochus
    Replies:
    3
    Views:
    510
  3. Sean Berry
    Replies:
    2
    Views:
    382
    David M. Cooke
    Apr 26, 2004
  4. tc

    simulated samba server

    tc, Mar 15, 2005, in forum: Python
    Replies:
    6
    Views:
    555
  5. Sam
    Replies:
    0
    Views:
    266
Loading...

Share This Page