Skip to content

Heterogeneous Multicore#135

Open
yim13 wants to merge 93 commits into
masterfrom
heterogeneous_multicore
Open

Heterogeneous Multicore#135
yim13 wants to merge 93 commits into
masterfrom
heterogeneous_multicore

Conversation

@yim13

@yim13 yim13 commented Dec 11, 2025

Copy link
Copy Markdown

This adds heterogeneous multicore configuration feature with extensions and caches, riscv-tests pm environment support from tb_core.cc and run_riscv_tests.py, clock gating, and C multicore tests.

For riscv-tests to be run correctly, pull requests in riscv-test/ and riscv-test/env rvb branch needs to be applied.

Seongjoong Yim and others added 30 commits October 28, 2025 14:08
Small edits to adjust to updated pkg file
* riscbusiness: split buses into front and back sides

quartus randomly assigned to all of the split bus signals in each
instantiation of the caches causing a large number of build errors. This
splits the bus into a front side that connects back_side<->RISCVBusiness
and a back side that connects RISCVBusiness<->bus controller.

* [misc] fixing failing riscv-tests

* component_defines: rename address_translation_enabled to address_translation

Helps deal with quartus not properly supporting generate compile time
instantiation

* misc: various fixes for quartus

* [cleanup] renaming supervisor_enabled to supervisor, fixing build issues

---------

Co-authored-by: William Cunningham <wrcunnin@purdue.edu>
* [misc] initial commits to fixing aft-dev FPGA build

* [misc] fixing riscv-test failures

- includes updates to tb_core.cc, changed virtual to debug.
- includes updates to riscv-test isa and env patches
- multicore (2-harts) now passes integer and multiplication virtual and physical tests, and atomic physical
- (virtual atomic tests don't work due to amo_emu.c)

* riscv-tests-env.patch: ignore pointer cast warning

---------

Co-authored-by: Devin Singh <drsingh2518@icloud.com>

@wrcunnin wrcunnin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How exhaustive has your testing been? Just want to make sure that if you max out one core (like 2KB caches, 2 way associative, 4-word blocks, 64 entry BTB) and weaken another (256B caches, 1 way, 2-word block, 16 entry BTB, etc.) that in the package and waveforms this is what actually gets generated.

Can you also link your presentations here?

Comment thread docs/src/multicore.md
- `xlen`
- Bus type and endianness
- Cache block sizes
- Supervisor and address translation settings

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think we should loop TLB size into the per-core configuration. It would make more sense so we can put it with the other caching structures. I can help with this.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@cole-nelson should we merge this with the normal core config script?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Definitely needs to be merged into old core config

Comment thread Makefile

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

see my comment on hetero_config_core.py. this may get reverted depending on that.

Comment thread docs/src/multicore.md

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Any diagrams to include with this? Would be good to have visuals for an example heterogeneous core layout with clock gating.

Comment thread docs/src/multicore.md
- [ ] 2 stage pipeline RV32EAC little core

## Current architecture plan for the Dual-core processor with MESI Coherence
![Plan](../fig/mc_arch_idea.png)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@cole-nelson we should get this updated to use the diagram you used for AFTx08 presentation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

go ahead and revert this as well

Comment thread tb_core.cc

if(num_harts > 1) {
// write to memory about required extension info
memory.write(tohost_address + 64, 1 << (extension - 'A'), 0xFF);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why not use FROMHOST_OFFSET here?

Comment thread tb_core.cc
}

if(use_tohost_multi) {
if(tohost_address <= addr <= tohost_address + FROMHOST_OFFSET && (addr - tohost_address) % tohost_stride == 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@cole-nelson i'm no c++ whiz, is this functionally sound?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nope. Needs to be tohost_address <= addr && addr <= (tohost_address + FROMHOST_OFFSET) && (addr - tohost_address) % tohost_stride == 0

Comment thread tb_core.cc
std::cout << "\t--debug : Allows debug strings to print from cores. Changes tohost-address functionality" << std::endl;
std::cout << "\t--notrace: Indicate to not generate a waveform file. Speeds up simulation incredibly." << std::endl;
std::cout << "\t--num-harts : Number of cores for multicore test. Defaults to 1." << std::endl;
std::cout << "\t--extension : RISC-V extension required for the core to run the test. Running pm env tests require this flag to run correctly." << std::endl;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

add something like <sim-time> for --max-sim-time. we need to clarify that we have a field that is to come after it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

delete this, we generally give these files the extension .dump and our .gitignore picks it up.

@devins2518 devins2518 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To be done before merging:

  • Rebase onto master
  • Revert to example.yml (actually I think core_configuration.yml is a better name)
  • Update riscv-tests SHA
  • Update AFT and ensure that this doesn't break anything there

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Definitely needs to be merged into old core config

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Instead of passing the HART_ID everywhere, could we instead create a struct to pass relevant args through the hierarchy?

Something like

typedef struct {
    bool RV32M;
    ...
} isa_config_t;

typedef struct { ... } cache_config_t;

typedef struct {
    int HART_ID;
    isa_config_t isa_config;
    cache_config_t cache_config;
    ...
} core_config_t;

const core_config_t HART0_CONFIG = '{
    ...
};
const core_config_t HART1_CONFIG = '{
    ...
};

const core_config_t CONFIGS[NUM_HARTS] = {HART0_CONFIG, HART1_CONFIG};

...

RISCVBusiness #(.CONFIG(CONFIGS[HART_ID])) hart (...);

Now the caches will take in a cache_config_t to handle configuration. I think it'll create a stronger link between the config and instantiations and hopefully avoid any potential foot guns from not using a core config parameter.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yeah should replace component_selection_defines.vh

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What does extension_idx_t do?

.product(product),
.finished(mul_finished)
);
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think it's probably cleaner if we use enums to define the possibilities instead of strings. Then it becomes a switch on known values. Could be future work though

Comment thread tb_core.cc
}

if(use_tohost_multi) {
if(tohost_address <= addr <= tohost_address + FROMHOST_OFFSET && (addr - tohost_address) % tohost_stride == 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nope. Needs to be tohost_address <= addr && addr <= (tohost_address + FROMHOST_OFFSET) && (addr - tohost_address) % tohost_stride == 0

Comment thread tb_core.cc
Comment on lines +173 to +175
// if (addr == FROMHOST_ADDR) {
// return 1;
// }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Delete

Comment thread tb_core.cc
std::cout << "\t--debug : Allows debug strings to print from cores. Changes tohost-address functionality" << std::endl;
std::cout << "\t--notrace: Indicate to not generate a waveform file. Speeds up simulation incredibly." << std::endl;
std::cout << "\t--num-harts : Number of cores for multicore test. Defaults to 1." << std::endl;
std::cout << "\t--extension : RISC-V extension required for the core to run the test. Running pm env tests require this flag to run correctly." << std::endl;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What is the purpose of --extension?

.core_clk_en(core_clk_en)
);

assign pipeline_clk = CLK & core_clk_en;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Little sketch to me

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we even support standalone RISCVBusiness for FPGA?

@devins2518

Copy link
Copy Markdown

Tests failing for me with updated riscv-tests (hetero-multicore branch)

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.

4 participants