Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTL Co-Simulation #21

Merged
merged 12 commits into from
Dec 1, 2023
Merged

RTL Co-Simulation #21

merged 12 commits into from
Dec 1, 2023

Conversation

geotrieu
Copy link
Collaborator

@geotrieu geotrieu commented Nov 22, 2023

Summary of Changes:

  • RTL MVM module compatible with the new mlp_int8 example
  • Changed mlp_int8 example to support co-simulation of MVM modules (native SysC/Verilated RTL)
  • Changed gen_testcase.py to support this new format when generating layer_mvm_config
  • Added numerous timing mechanisms to the add, rtl_add designs
  • Patched Verilator Warnings bug stemming from "-Wextra and -pedantic" by explicitly specifying Verilator is a SYSTEM library
  • Patched several memory leaks from the rtl_add design
  • Updated generate_port_mappings and generate_wrapper scripts to support multiple AXI-S ports
  • Updated tests to cover new cases for aforementioned scripts
  • Patched several bugs with the Verilog parser library related to erroneously parsing inputs and outputs in comments
  • Added failsafe check in RAD-Sim to ensure a module is instantiated if routed on the NoC (prevents seg fault)
  • Added CI Test for testing Verilator (mlp_int8 example)

@@ -31,6 +31,8 @@ void add_driver::source() {
client_valid.write(false);
wait();
rst.write(false);
start_cycle = GetSimulationCycle(1.0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why the clock period is hardcoded to 1ns here?
I think it should be set to the driver clock period from the config.yml file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I replaced it all with the "sim_driver_period" parameter

rad-sim/example-designs/add/add_driver.cpp Outdated Show resolved Hide resolved
rad-sim/example-designs/mlp_int8/mlp_driver.cpp Outdated Show resolved Hide resolved
rad-sim/example-designs/mlp_int8/mlp_driver.cpp Outdated Show resolved Hide resolved
std::vector<unsigned int> num_mvms;
unsigned int num_layers;
std::string num_mvms_layer, num_mvms_rtl_layer;
std::string layer_mvms;
line_stream >> num_layers;
num_mvms.resize(num_layers);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this variable name (and other related ones) to explicitly mention it is for SystemC MVMs (e.g. num_mvms_systemc)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this also might apply to other files that have similar configuration parsing code (e.g. mlp_driver)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion, I renamed all the ambiguous names to specify sysc, and also renamed the system c MVM module to sysc_mvm so its more clear

rad-sim/example-designs/rtl_add/rtl_add_driver.cpp Outdated Show resolved Hide resolved
rad-sim/example-designs/rtl_add/rtl_add_driver.cpp Outdated Show resolved Hide resolved
@@ -5,7 +5,9 @@
from pathlib import Path
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a critical file that I can see people needing to change later for different reasons, but it is very lightly commented. Could you add high-level comments at the top of the file and then detailed comments on different sections to explain what is going on in it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments describing functionality at the top, and also some comments at each function block.

@@ -6,22 +6,27 @@
import argparse
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is also lightly commented. I think this is a critical script that should be heavily commented for future modifications/extensions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments describing the functionality. Most code in this file is actually either in plain English (value assertions with messages), or simply lines of code writing C++ code. I tried not to put too many comments there since it doesnt help that much

@@ -8,6 +8,9 @@

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a high-level comment at the top of this file to explain why it is needed and when it is used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

@andrewboutros andrewboutros merged commit fd857b9 into main Dec 1, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants