antmicro / renode-dpi-examples

Apache License 2.0
3 stars 1 forks source link

Help debugging Xcelium #3

Closed shareefj closed 2 months ago

shareefj commented 3 months ago

Hi there,

I'm in the process of trying to add Xcelium support for these examples but am getting test failures where I can't track down what's going on. So far I'm just looking at the axi_ram example and would like to know how to dump the simulator stdout/stderr to a file? There seems to be an XML file with some output but is there a nicer text file?

When running the Xcelium executable, it seems to exit straight away. The comments in axi_ram/sim.v seem to suggest that the simulator should wait until a connection event but that doesn't seem to be true? Execution passes straight through the receive_and_handle_message in renode.sv.

My modifications can be seen here: https://github.com/NuQuantum/renode-dpi-examples/tree/feature/add_xcelium_support

shareefj commented 3 months ago

I've gotten as far as adding logging support to the TCP Socket library you are using and it looks like it fails at getaddrinfo in TCPClient.cpp.

I've been running under WSL so will try on a full fat machine to double check.

shareefj commented 2 months ago

@PiotrZierhoffer I've now run this on a RHEL instance and I'm getting the same behaviour. What OS and environment are you using for your Questa testing? If you add a logger to the TCPClient, do you also see it dump errors about getaddrinfo?

Edit: I've pushed an update with logging here: https://github.com/NuQuantum/renode/tree/tcpclient_debug

The output I get is:

(.venv) [shareefj@rhel-dev renode-dpi-examples]$ grep -rs TCP robot_output.xml 
<msg timestamp="20240622 21:59:05.209" level="TRACE">Arguments: [ 'TOOL:\txrun(64)\t24.03-s001: Started on Jun 22, 2024 at 21:58:55 BST\nxrun(64): 24.03-s001: (c) Copyright 1995-2024 Cadence Design Systems, Inc.\nLoading snapshot worklib.sim:sv .................... Done\nxcelium&gt; source /opt/cadence/xcelium/2403/tools/xcelium/files/xmsimrc\nxcelium&gt; run\nAddress="127.0.0.1"\nReceiverPort=      42603\nSenderPort=      45371\n[TCPClient][Error] getaddrinfo failed : Name or service not known\n[TCPClient][Error] getaddrinfo failed : Name or service not known\n[TCPClient][Error] recv failed : not connected to a server.\nRenode at 0.000000000s: Connected using the socket based interface\nSimulation complete via $finish(1) at time 100 NS + 0\n../sim.sv:70     if (!renode.connection.is_connected()) $finish;\nxcelium&gt; exit\nTOOL:\txrun(64)\t24.03-s001: Exiting on Jun 22, 2024 at 21:58:56 BST  (total: 00:00:01)' ]</msg>
[TCPClient][Error] getaddrinfo failed : Name or service not known
[TCPClient][Error] getaddrinfo failed : Name or service not known
[TCPClient][Error] recv failed : not connected to a server.
shareefj commented 2 months ago

As a reminder, this ticket is related to https://github.com/renode/renode/pull/620

shareefj commented 2 months ago

OK, so having now run Questa to verify that your examples work, I started debugging further. The issue here seems to be how I'm passing in the IP address to Xcelium.

In your Robot code, you pass in the address to Questa here: https://github.com/antmicro/renode-dpi-examples/blob/main/robot/dpi-keywords.robot#L40

This results in a Questa command line of: vsim design_optimized -GReceiverPort=39153 -GSenderPort=38023 -GAddress=\"127.0.0.1\" ...

And because I copied the argument generation for Xcelium, the Xcelium command line is, xrun +ReceiverPort=45783 +SenderPort=44405 +Address=\"127.0.0.1\" ... which fails in my plusarg test.

So what's the correct way to avoid the Robot framework from escaping these strings when being passed in as arguments?

shareefj commented 2 months ago

Meh, the fix was as simple as to remove the quotes in the test. This all now works with Xcelium so I'll open a PR.