-
Notifications
You must be signed in to change notification settings - Fork 8
Fix Snitch Cache Configuration, Update Memory Map, and Improve Simulation Support #82
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
Changes from all commits
20052c6
41d9d9e
7c01ac6
b5bf0b7
a1b85f2
b40be0a
ba259ff
99307d0
9485e38
64b940d
568e748
77eb255
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // Copyright 2024 ETH Zurich and University of Bologna. | ||
| // Solderpad Hardware License, Version 0.51, see LICENSE for details. | ||
| // SPDX-License-Identifier: SHL-0.51 | ||
| // | ||
| // Lorenzo Leone <lleone@iis.ee.ethz.ch> | ||
| // | ||
| // This module is introduced to improve the system debuggability. | ||
| // When the target synthesis is used, teh module behaves as a bypass | ||
| // for teh APB messages. | ||
| // During simulation instead, the APB messages directed to teh | ||
| // DUMP address 0x30004ffc are printed in a UART fashion on teh console. | ||
|
|
||
| module apb_dump_msg | ||
| import chimera_pkg::*; | ||
| #( | ||
| parameter logic [31:0] DumpAddr = 32'h30004ffc, | ||
| parameter int unsigned DataWidth = 32 | ||
| ) ( | ||
| input logic clk_i, | ||
| input logic rst_ni, | ||
| // From Top | ||
| output apb_resp_t apb_rsp_o, | ||
| input apb_req_t apb_req_i, | ||
| // To Top | ||
| input apb_resp_t apb_rsp_i, | ||
| output apb_req_t apb_req_o | ||
| ); | ||
|
|
||
| `ifdef SYNTHESIS | ||
| assign apb_req_o = apb_req_i; | ||
| assign apb_rsp_o = apb_rsp_i; | ||
| `else | ||
|
|
||
| logic dump; | ||
|
|
||
| assign dump = apb_req_i.psel && apb_req_i.penable && apb_req_i.pwrite&& | ||
| (apb_req_i.paddr == DumpAddr); | ||
|
|
||
| always_comb begin : gen_dump | ||
| apb_req_o = apb_req_i; | ||
| apb_rsp_o = apb_rsp_i; | ||
| // Mask teh APB request if targetting the dump address | ||
| if (dump) begin : gen_mask_req | ||
| apb_req_o.psel = 1'b0; | ||
| apb_req_o.penable = 1'b0; | ||
| apb_rsp_o.pready = 1'b1; | ||
| end | ||
| end | ||
|
|
||
|
|
||
| // pragma translate_off | ||
| always_ff @(posedge clk_i or negedge rst_ni) begin | ||
| if (!rst_ni) begin | ||
| // no state | ||
| end else if (dump) begin | ||
| for (int unsigned i = 0; i < DataWidth / 8; i++) begin | ||
| // Use strobe if present; otherwise always print all bytes. | ||
| if (apb_req_i.pstrb[i]) begin | ||
| logic [7:0] ch; | ||
| ch = apb_req_i.pwdata[i*8+:8]; | ||
| if (ch == 8'h0A) begin : gen_print_newline | ||
| $display(""); | ||
| end else begin : gen_print_char | ||
| $write("%c", ch); | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| // pragma translate_on | ||
|
|
||
| `endif | ||
| endmodule |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -244,6 +244,20 @@ module chimera_cluster | |
| typedef logic [TcdmAddrWidth-1:0] tcdm_addr_t; | ||
| `TCDM_TYPEDEF_ALL(tcdm_dma, tcdm_addr_t, data_dma_t, strb_dma_t, logic) | ||
|
|
||
| function automatic snitch_pma_pkg::rule_t [snitch_pma_pkg::NrMaxRules-1:0] get_cached_regions(); | ||
| automatic snitch_pma_pkg::rule_t [snitch_pma_pkg::NrMaxRules-1:0] cached_regions; | ||
| cached_regions = '{default: '0}; | ||
| cached_regions[0] = '{base: HyperbusRegionStart, mask: 48'hffff_1000_0000}; // Hyperbus (256 MiB) | ||
| cached_regions[1] = '{base: MemIslRegionStart, mask: 48'hffff_fff8_0000}; // Memory Island ( 512 KiB) | ||
| return cached_regions; | ||
| endfunction | ||
|
|
||
| localparam snitch_pma_pkg::snitch_pma_t SnitchPMACfg = '{ | ||
| NrCachedRegionRules: 2, | ||
| CachedRegion: get_cached_regions(), | ||
| default: 0 | ||
| }; | ||
|
|
||
| snitch_cluster #( | ||
| .PhysicalAddrWidth(Cfg.ChsCfg.AddrWidth), | ||
| .NarrowDataWidth (ClusterDataWidth), // SCHEREMO: Convolve needs this... | ||
|
|
@@ -253,15 +267,19 @@ module chimera_cluster | |
| .NarrowUserWidth (Cfg.ChsCfg.AxiUserWidth), | ||
| .WideUserWidth (Cfg.ChsCfg.AxiUserWidth), | ||
|
|
||
| .BootAddr (SnitchBootROMRegionStart), | ||
| .IntBootromEnable(0), | ||
| .AliasRegionEnable(1), | ||
| .AliasRegionBase ('h1800_0000), | ||
| .SnitchPMACfg (SnitchPMACfg), | ||
| .BootAddr (SnitchBootROMRegionStart), | ||
| .IntBootromEnable (0), | ||
|
|
||
| .NrHives (1), | ||
| .NrCores (NrCores), | ||
| .TCDMDepth (1024), | ||
| .ZeroMemorySize (64), | ||
| .ClusterPeriphSize(64), | ||
| .NrBanks (16), | ||
| // WIESEP: TCDM size = 16 * 1024 * 64 bit = 128 KiB | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can remover this comment
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep it. For me, it was not obvious how large it is, and I had to do some thinking. This way it is very clear. |
||
|
|
||
| .DMANumAxInFlight(3), | ||
| .DMAReqFifoDepth (3), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Copyright 2026 ETH Zurich and University of Bologna. | ||
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Philip wiese <wiesep@iis.ee.ethz.ch> | ||
|
|
||
| source setup.chimera_soc.tcl | ||
| source compile.tcl | ||
| source start.chimera_soc.tcl | ||
| do wave/waves.tcl | ||
| run -a |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Copyright 2025 ETH Zurich and University of Bologna. | ||
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Add a standard set of Chimera cluster signals for a given cluster_id. | ||
| # | ||
| # Usage: | ||
| # add_chimera_cluster_waves 3 | ||
| # | ||
| proc add_chimera_cluster_waves {cluster_id num_cores} { | ||
| # Base paths | ||
| set clu_base "/tb_chimera_soc/fix/dut/i_cluster_domain/gen_clusters\[${cluster_id}\]/gen_cluster_type/i_chimera_cluster/i_test_cluster" | ||
| set grp "Cluster ${cluster_id}" | ||
|
|
||
| # Cluster-level signals | ||
| add wave -noupdate -group $grp ${clu_base}/cluster_base_addr_i | ||
| add wave -noupdate -group $grp ${clu_base}/clk_i | ||
| add wave -noupdate -group $grp ${clu_base}/rst_ni | ||
|
|
||
| # Barrier (if present) | ||
| add wave -noupdate -group $grp ${clu_base}/i_snitch_barrier/barrier_i | ||
| add wave -noupdate -group $grp ${clu_base}/i_snitch_barrier/arrival_q | ||
| add wave -noupdate -group $grp ${clu_base}/i_snitch_barrier/barrier_o | ||
|
|
||
| # iCache/Hive signals (note: hive is commonly not per-core; keep under a subgroup) | ||
| # Adjust gen_hive index if needed. | ||
| add wave -noupdate -group $grp -group {iCache} ${clu_base}/gen_hive\[0\]/i_snitch_hive/* | ||
|
|
||
| # Per-core signals. | ||
| for {set core 0} {$core < $num_cores} {incr core} { | ||
| set core_base "${clu_base}/gen_core\[${core}\]/i_snitch_cc" | ||
| set core_grp "Core ${core}" | ||
|
|
||
| add wave -noupdate -group $grp -group $core_grp ${core_base}/hart_id_i | ||
| add wave -noupdate -group $grp -group $core_grp ${core_base}/i_snitch/pc_q | ||
| add wave -noupdate -group $grp -group $core_grp ${core_base}/i_snitch/wfi_q | ||
| } | ||
| } | ||
|
|
||
|
|
||
| onerror {resume} | ||
| quietly WaveActivateNextPane {} 0 | ||
| add wave -noupdate -expand -group {Global} {/tb_chimera_soc/fix/dut/soc_clk_i} | ||
| add wave -noupdate -expand -group {Global} {/tb_chimera_soc/fix/dut/clu_clk_i} | ||
| add wave -noupdate -expand -group {Global} {/tb_chimera_soc/fix/dut/rtc_i} | ||
| add wave -noupdate -expand -group {Global} {/tb_chimera_soc/fix/dut/rst_ni} | ||
| add wave -noupdate -expand -group {Global} {/tb_chimera_soc/fix/dut/uart_tx_o} | ||
| add wave -noupdate -expand -group {Global} {/tb_chimera_soc/fix/dut/uart_rx_i} | ||
|
|
||
| add wave -noupdate -expand -group {CVA6} {/tb_chimera_soc/fix/dut/i_cheshire/gen_cva6_cores[0]/i_core_cva6/hart_id_i} | ||
| add wave -noupdate -expand -group {CVA6} {/tb_chimera_soc/fix/dut/i_cheshire/gen_cva6_cores[0]/i_core_cva6/pc_commit} | ||
|
|
||
| add wave -noupdate -expand -group {Cluster Register} {tb_chimera_soc/fix/dut/i_reg_top/reg2hw} | ||
|
|
||
| # Add waves for Cluster 0 | ||
| add_chimera_cluster_waves 0 9 | ||
| # Add waves for Cluster 1 | ||
| add_chimera_cluster_waves 1 9 | ||
| # Add waves for Cluster 2 | ||
| add_chimera_cluster_waves 2 9 | ||
| # Add waves for Cluster 3 | ||
| add_chimera_cluster_waves 3 9 | ||
| # Add waves for Cluster 4 | ||
| add_chimera_cluster_waves 4 9 | ||
|
|
||
| # Finalize | ||
| update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already written at line 131
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but not with the values, this way it is clear how large it is from the beginning ;)