Architecture
Overview
The Verisocks architecture is described in the figure below.
The verilog testbench contains one instance of the user system task
$verisocks_init()
, that launches the Verisocks PLI application.
Typically, this task would be called directly from within an initial
statement, at the beginning of the simulation (even though this could also be
done later on) in the top-level testbench.
Caution
A given testbench should contain only one single instance of the
$verisocks_init()
system task. There are some exceptions
possible, but they do not really make a lot of sense anyway
Once launched, the Verisocks PLI application works as a server, accepting connection requests from clients over a classical (BSD) TCP socket. As long as the server is running, it will accept requests which will then trigger different actions on the simulator via the VPI interface.
TCP socket
The use of a BSD TCP socket has been chosen here as a convenient form of interprocess communication (IPC) between Verisocks and a test framework client, for the sake of portability, as many possible languages and frameworks on multiple platforms are supporting such sockets “out of the box”. It also allows to potentially run the server and the client on separate machines or run and control several simulations in parallel on several different machines.
Caution
Running client and server on separate machines as well as parallel/distributed execution of test cases has not been tested yet by the author!
The protocol used for the TCP messages is described in detail in the section TCP protocol.
The $verisocks_init()
PLI system task
As described in the previous sections, running Verisocks from any Verilog
testbench only requires to use once the $verisocks_init()
system
task. This is easily done in the top-level testbench code as follows:
#define VS_PORT 5100
#define VS_TIMEOUT 120.0
//[...]
initial begin
//[...]
$verisocks_init(`VS_PORT, `VS_TIMEOUT);
//[...]
end
Caution
Only run the $verisocks_init()
once in a given testbench. It is
potentially possible to run several instances of the Verisocks server in
parallel in order to serve some specific use cases, but it is not
recommended.
Note that it is not mandatory to run this task at the very beginning of the
testbench initial
statement. Any number of statements can be run
prior to using this system task.
Arguments
Port number: This first argument is mandatory and defines the port number to be used for the TCP socket. It has to be an integer number, corresponding to a free port.
Timeout: This second argument is optional and defines the socket timeout in seconds (default value
120.0
).