Skip to content

Commit

Permalink
Updated comments in axis_slave_adapter.hpp/cpp, added multirad stes t…
Browse files Browse the repository at this point in the history
…o rad-sim-code-structure doc
  • Loading branch information
abnashkb committed Oct 13, 2024
1 parent ea2d72e commit 253e7cf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
10 changes: 10 additions & 0 deletions docs/rad-sim-code-structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ design's ``config.yml`` file. For example, if the ``config.yml`` file, had the f
adapters of both modules are operating at 1.25 ns clock period (800 MHz), while ``module_a`` has a clock period of
2.5 ns (400 MHz) and ``module_b`` has a clock period of 5.0 ns (200 MHz).

.. note::
For designs containing multiple RADs, RAD-Sim adds a portal module to the design, which allows for communication between
RADs. The clock configuration for the portal module should be added to the clock configuration file.

.. code-block:: yaml
noc_adapters:
Expand Down Expand Up @@ -200,6 +204,12 @@ and the bottom-right router has ID :math:`N^2-1` for an :math:`N \times N` mesh.
interfaces, it is possible to only write the module name and this will result in all its ports to be connected to the
same NoC router with arbitration logic between them.

.. note::
For designs containing multiple RADs, RAD-Sim adds a portal module to the design, which allows for communication between
RADs. The NoC configuration for the portal module should be added to the configuration file. AXI-S is the correct
interface type. Verify that the design configuration yaml file has a large enough NoC size to include the portal module.
Any unused NoC ID can be selected.

CMakeLists File (``CMakeLists.txt``)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is a conventional CMakeLists file that lists all your modules, top, driver, and system header and source files
Expand Down
14 changes: 7 additions & 7 deletions rad-sim/sim/noc/axis_slave_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ axis_slave_adapter::axis_slave_adapter(
axis_interfaces.init(interface_types.size());

// Node properties
_rad_id = rad_id; // TO-DO-MR-DONE: set appropriate RAD ID through constructor
//std::cout << "set rad_id in axis_slave_adapter " << name << " to: " << _rad_id << std::endl;
_rad_id = rad_id;
_portal_id = 0; //default 0, user must set correct value using AssignPortalSlaveID()
_node_id = node_id;
_network_id = network_id;
_node_period = node_period;
Expand Down Expand Up @@ -230,20 +230,18 @@ void axis_slave_adapter::InputInjection() {
booksim_flit->tail = _to_be_injected_flit._tail;
booksim_flit->type = _to_be_injected_flit._type;

// TO-DO-MR BEGIN
if (DEST_RAD(_to_be_injected_flit._dest) == _rad_id) { //not crossing to other RAD
sc_bv<AXIS_DESTW> booksim_flit_dest = DEST_LOCAL_NODE(_to_be_injected_flit._dest);
booksim_flit->dest = GetInputDestinationNode(booksim_flit_dest);
booksim_flit->dest_rad = DEST_RAD(_to_be_injected_flit._dest).to_int();
booksim_flit->dest_remote = DEST_REMOTE_NODE(_to_be_injected_flit._dest).to_int();
} else {
//std::cout << "(TO-DO-MR) _portal_id in axis_slave_adapter.cpp: " << _portal_id << std::endl;
sc_bv<AXIS_DESTW> booksim_flit_dest = _portal_id; // TO-DO-MR-DONE: set to portal node ID
//std::cout << "_portal_id in axis_slave_adapter.cpp: " << _portal_id << std::endl;
sc_bv<AXIS_DESTW> booksim_flit_dest = _portal_id;
booksim_flit->dest = GetInputDestinationNode(booksim_flit_dest);
booksim_flit->dest_rad = DEST_RAD(_to_be_injected_flit._dest).to_int();
booksim_flit->dest_remote = DEST_REMOTE_NODE(_to_be_injected_flit._dest).to_int();//to_uint();
booksim_flit->dest_remote = DEST_REMOTE_NODE(_to_be_injected_flit._dest).to_int();
}
// TO-DO-MR END

booksim_flit->dest_interface =
_to_be_injected_flit._dest_interface.to_uint();
Expand Down Expand Up @@ -281,6 +279,8 @@ void axis_slave_adapter::InputInjection() {
}
}

//For the current NoC, store the node ID of the portal module that RAD-Sim adds for multi-RAD designs.
//This is used for inter-rad communication.
void
axis_slave_adapter::AssignPortalSlaveID(int id) {
_portal_id = id;
Expand Down
4 changes: 2 additions & 2 deletions rad-sim/sim/noc/axis_slave_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

class axis_slave_adapter : public sc_module {
private:
unsigned int _rad_id; // TO-DO-MR-DONE: RAD ID of this adapter (for multi-RAD systems)
unsigned int _portal_id; //AKB ADDED FOR TO-DO-MR
unsigned int _rad_id; //RAD ID of this adapter (for multi-RAD systems)
unsigned int _portal_id; //Node ID of portal module for this RAD (for communication between RADs in multi-RAD systems)
unsigned int _node_id; // Node ID of this adapter
double _node_period, _adapter_period, _noc_period;
unsigned int _network_id;
Expand Down

0 comments on commit 253e7cf

Please sign in to comment.