first Hint:
GHDL can read files. I am use this input often in my testbenchs.
The following process inside a testbench handles the file input.




  process
    constant file_name : string := "request.hex";
    file in_file       : f_byte open read_mode is file_name;

--variable in_line,out_line: line;
    variable good : boolean;
    variable a    : character;
    variable I    : integer := 0;

  begin
    wr_en <= '0';
    wait for 100 ns;
    --while (not endfile(in_file)) loop
    while i < 2000 loop
      I     := I+1;
      wait until clk = '1';
      wr_en <= '1';
      if not endfile (in_file) then
        read(in_file, a);
      else wr_en <= '0';
      end if;
data_in <= std_logic_vector(to_unsigned(character'pos(a), 8)); --very tricky the conversation


    end loop;
    wr_en <= '0';

  end process;



the second hint
is only for Linux. A serial port interface with VHPI and connect with socat two ttys.
This is very tricky.

the third hint
    use a softcore for your interpreter.


René Doß

On 02/27/2014 09:02 AM, Svenn Are Bjerkem wrote:
Hi,
this is probably slightly off-topic, but maybe related.

The FPGA I am programming with VHDL is to be tested. It communicates with the outside world through UART. I send a command, receive a command and react to that command by sending a different command, or in the case of error, resend the previous command. The commands are long ASN.1 coded octet strings.

Currently I use Tcl to have the serial port in an event loop to be able to react asynchronously to the results coming from the FPGA. Writing the state-machine is a bit awkward, and it frustrates me that I can write a hardware FSM fairly easy in VHDL, but not in any programming language that I know (c, tcl, python)

I guess it is not easy to bind a serial port to ghdl and rely on the concurrency in VHDL to read, interpret and send commands the way I do in FPGA hardware, so my question is if there is a programming language which would help me that I don't know about yet. Hopefully it should run on both windows and Linux, but Linux-only is fine. Windows-only is not so fine, but ok. Assume that I have only knowledge (and not deep knowledge) of c, tcl, python, vhdl and ghdl.

Any comments welcome.

--
Svenn


_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to