Skip to content

Importing Black-Parrot into RTLMeter #4

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

Merged

Conversation

buhraian
Copy link

@buhraian buhraian commented Jun 30, 2025

This PR serves to include the necessary changes to import the black-parrot design into the RTLMeter framework properly. Currently, I am using ./rtlmeter run --cases black-parrot:default:hello to test the functionality, and I am planning on adding a few more test cases before we finalize the PR as well, just posting this initial version to confirm functionality.

@buhraian buhraian changed the title Add black parrot Importing Black-Parrot into RTLMeter Jun 30, 2025
@wsnyder
Copy link
Member

wsnyder commented Jul 1, 2025

@gezalore I noted the CI that auto dispatched doesn't run the designs themselves, so doesn't prove much about pulls like this. (Or at least as far as I can tell). Should that be improved?

@gezalore
Copy link
Member

gezalore commented Jul 1, 2025

@gezalore I noted the CI that auto dispatched doesn't run the designs themselves, so doesn't prove much about pulls like this. (Or at least as far as I can tell). Should that be improved?

Yes, Verialtor could not handle some of the existing designs out of the box, so have omitted that so far, we will get there.

Copy link
Member

@gezalore gezalore left a comment

Choose a reason for hiding this comment

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

Thanks for the great effort @buhraian I know this was not trivial work!

As Wilson said, the CI in this repo does not yet run Verilator itself. I ran it locally with verilator/verilator@e015805 (master), which seems to work fine. Generally if ./rtlmeter run --cases "black-parrot:*" + CI passes I'm happy, but I will check it before merging anyway.

Please instead of designs/black-parrot use designs/BlackParrot, which is consistent with the styling of the project and the existing designs.

As you mentioned, we will need some more longer workloads. Can we also have more, larger configurations? There is some interest in larger many-core simulations, which I think BlackParrot would be fairly suitable for.

I notice there are some log files written from the simulation to the run directory:

work/black-parrot/default/execute-0/hello
├── commit_0.trace
├── DUT-blackparrot.signature
├── stdout_0.txt
├── stdout_global.txt
└── vm_0.trace

They are empty, but please make sure these would not be populated during a run, benchmark file IO is not our goal here.

Comment on lines 2 to 5
- repository: https://github.com/black-parrot/black-parrot.git
revision: 45a28bf96e58f55687f8e09b2521ceada121ad95
licenses:
- LICENSE
Copy link
Member

Choose a reason for hiding this comment

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

I think both the basejump_stl and HardFloat submodules used by the BP repo have different licenses and copyright holders from the BP repo itself, if that is indeed the case please add a separate entry and license files for them, so imported code can be properly attributed to its authors. See e.g. OpenPiton for reference: https://github.com/verilator/rtlmeter/blob/main/designs/OpenPiton/descriptor.yaml

Comment on lines 51 to 52
- src/bp/bsg_parallel_in_serial_out_passthrough_dynamic.sv
- src/bp/bsg_serial_in_parallel_out_passthrough_dynamic.sv
Copy link
Member

Choose a reason for hiding this comment

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

Maybe should be in the BP section? there are already bsg_ files there.

- src/hardfloat/recFNToIN.v
- src/hardfloat/recFNToRecFN.v
- src/hardfloat/HardFloat_specialize.v
#BP Common Files
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#BP Common Files
# BlackParrot Common Files

- src/basejump_stl/bsg_cache_pkg.sv
- src/basejump_stl/bsg_noc_pkg.sv
- src/basejump_stl/bsg_wormhole_router_pkg.sv
# BP Packages
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# BP Packages
# BlackParrot Packages

- src/bp/bsg_dff_sync_read.sv
- src/bp/bsg_rom_param.sv
- src/bp/wrapper.sv
#Basejump Memory Files
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#Basejump Memory Files
# Basejump Memory Files

Though I'm not sure all the following are "Memory Files"? It's ok to strip these comments if the separation is not entirely clean.

Comment on lines 706 to 724
`ifdef TRACE_ENABLE
string dumpfile;
initial
if ($value$plusargs("bsg_trace=%s", dumpfile))
begin
$display("[BSG-INFO]: Dumping to %s", dumpfile);
`ifdef FSDB_ENABLE
$fsdbDumpfile(dumpfile);
$fsdbDumpvars(0,testbench.wrapper);
`elsif VPD_ENABLE
$vcdplusfile(dumpfile);
$vcdpluson(0,testbench.wrapper);
$vcdplusautoflushon();
`else
$dumpfile(dumpfile);
$dumpvars(0,testbench.wrapper);
`endif
end
`endif
Copy link
Member

Choose a reason for hiding this comment

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

Please delete this ifdef, to avoid confusion. __rtlmeter_top_include.vh takes care of dump control.

Comment on lines 2 to 35
#include "svdpi.h"
#include <iostream>
#include "stdlib.h"
#include <string.h>
#include <vector>

extern "C" void* cosim_init(int hartid, int ncpus, int memory_size, bool checkpoint) {
return NULL;
}

extern "C" int cosim_step(void *handle,
int hartid,
uint64_t pc,
uint32_t insn,
uint64_t wdata,
uint64_t status,
uint64_t cause) {
return 0;
}

extern "C" int cosim_trap(void *handle,
int hartid,
uint64_t pc,
uint32_t insn,
uint64_t wdata,
uint64_t status,
uint64_t cause) {
return 0;
}

extern "C" void cosim_finish(void *handle) {

}

Copy link
Member

Choose a reason for hiding this comment

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

If the expectation is that these are never called, please delete the call site and this file, in order to try to avoid C++ dead code. If these are called it's fine to leave them.

set -x
set -e
# stdout must contain ''
grep -q "All cores finished! Terminating" _execute/stdout.log
Copy link
Member

Choose a reason for hiding this comment

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

I assume this means all cores finished successfully, and e.g. not crashed. Please consider if there is a stronger check you can do here that positively proves correct termination. If this is that it's fine.

@gezalore
Copy link
Member

gezalore commented Jul 9, 2025

I have added CI to run cases on PRs and push, please rebase to main on your next update.

@gezalore gezalore changed the base branch from main to trial-black-parrot August 12, 2025 08:06
@buhraian
Copy link
Author

The latest commit addresses the following review comments:

  1. Log files are no longer written to or even populated in the first place; all tracers are turned off as well.
  2. Renamed to match BlackParrot styling, along with adding all relevant licenses.
  3. Tweaked comments in descriptor.yaml to match styling + remove unnecessary comments.
  4. Removed duplicate logging features, defaulting to RTLMeter logging.
  5. Removed dead C code for null_cosim.
  6. Added an additional check to execution post-hook to check for correctness as determined by bp_nonsynth_host.sv.

@buhraian
Copy link
Author

buhraian commented Aug 12, 2025

Seems like the error from the failed CI run stems from a recently introduced check in Verilator for dynamically-sized variables (commit 641dd75) which is how it slipped past my local runs on v5.037; I will re-run on upstream Verilator locally. I'm planning on just un-binding all the faulty profiler modules unless you would rather have the code refactored instead.

@gezalore
Copy link
Member

If it's not essential for functionality feel free to remove it

@gezalore
Copy link
Member

Thanks for the cleanups. I'm landing this on a branch on a trial basis until we can address the remaining outstanding issues.

@gezalore gezalore merged commit f4417a2 into verilator:trial-black-parrot Aug 13, 2025
95 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.

3 participants