Tonic is a programmable hardware architecture for the transport logic, i.e., reliable data delivery and congestion control. All the design files in this repository are available for use under the 3-clause BSD License.
- src/ - source files
- tonic.v (Tonic's top-level)
- dd_engine/ (Data Delivery Engine)
- cr_engine/ (Credit Engine)
- user_defined_logic/
- Other components used by the engines (e.g., RAM, bitmap operations, etc.)
- include/ system-wide constants
- tb/ - testbench files
- config/ (.yaml files for configuring simulations and test parameters)
- sim/ (simulation files for Tonic, including a mock receiver in C)
- tools/ (scripts for running simulations and tests)
- build/ - temporary build files. The output of the build and simulation goes in this directory.
- csim/ - Tonic's cycle-accurate simulator in C++.
Note: Some directories are empty as they are being ported into the new infrastructre.
Before running any scripts, make sure to setup the environment variables by running
source settings.sh
All the simulations and tests are executed through the tools/runtest
script.
./tools/runtest --type [sim|unit|system] \
--config path_of_config_file_from_config_root.yaml \
[--debug]
Notes:
- The
system
andunit
options are not included yet and therefore cannot be used for now. - The
sim
option simulates the module that is designated in the config file using the initial parameters specified in the same file. Currently, we have simulation files fortonic
, for which you can specify a protocol and initial parameters. See below for more information on the format of the configuration file. - Note that path_of_the_config_file_from_config_root.yaml is not the full path to the config file. It is the path to the file starting from
tb/config
. - The
debug
option is used to send a flag to simulation files to print debugging information. Please seetb/sim/dd_engine/sim_top.v
for an example.
Configuration files are in YAML format. Here is the basic structure of a configuration file.
module_name:
params:
module_specific_param1: val1
module_specific_param2: val2
...
specs:
sim_cycles: val
# sim_specific_params
sim_specific_param1: val1
sim_specific_param2: val2
...
Notes
module_name
is, in most cases, the name of the top-level module for the test. Exception are top-level modules such astonic
anddd_engine
that include one or more of the programmable modules (i.e.,user_defined_incoming
anduser_defined_timeout
). In those cases,module_name
should betop_level_module/protocol_name
. For instance, to testtonic
withreno
, themodule_name
should betonic/reno
.- All the relevant simulations and test files for
module_name
(except for the source files) should be intb/test_type/module_name
, wheretest_type
is either ofsim
,unit
, andsystem
. params
is for specifying module-specific parameters. Fortonic
, these areinit_wnd_size
andinit_rtx_timer_amnt
. As another example, if one were to write a unit test for thefifo
module used in Tonic, these paramters could include its depth and width.specs
are parameters used for customizing the simulation:sim_cycles
specifies how many cycles to run the test for and should be specified in all configuration files.- For end-to-end simulations for
tonic
, the following options are required (Seetb/config/
for examples).active_flow_cnt
,receiver
,loss_prob
(represented in X in thousands), andrtt
are only used for end-to-end simulations fortonic
.
active_flow_cnt: val (total number of flows to simulate)
receiver: True/False (whether the simulations requires a mock receiver)
loss_prob: X (the resulting loss probability will be X/1000)
rtt: val (in nanoseconds)
cr_type: val (type of the credit engine, 0 -> cwnd, 1 -> rate, 2 -> tokens)
...
- For top-level modules such as
tonic
anddd_engine
that include one or more of the programmable modules, the following simulation variables should be specified as well:
user_context_w: val (number of bits used for protocol-specific state)
init_user_context: val (in hex, the initial value for protocol-specific state)
send_dd_context: 0 or 1 (whether to send protocol-specific state to cr engine. 0 for all cwnd-based protocols)
The current version of the code does not include the implementation of the rate-based and grant-based credit engine. Thus, as of now, only protocols that use congestion window as means of handling credit can be simulated.
The current version of the code includes four example protocols in src/user_defined_logic/
, all some variant of TCP: Reno, two different implementations of New Reno one based on RFC 6582, and an implementation of selective acknowledgment based on RFC 6675. To add your own protocol proto
, create user_defined_logic/proto
folder and implement user_defined_incomig.v
and user_defined_timeout.v
, following the input/output interface of the examples. Then create tb/sim/tonic/proto
and follow the example in tb/sim/tonic
to add protocol specific receiver behavior and simulation files.