Skip to content

Commit

Permalink
Allow cores synchronization at reset.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvan Tortorella committed Dec 7, 2023
1 parent e5b0b03 commit 160e22b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions hw/cheshire_soc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ module cheshire_soc import cheshire_pkg::*; #(
end

cva6_wrap #(
.Cfg ( Cfg ),
.Cva6Cfg ( Cva6Cfg ),
.NumHarts ( NumIntHarts ),
.AxiAddrWidth ( Cfg.AddrWidth ),
Expand All @@ -633,6 +634,7 @@ module cheshire_soc import cheshire_pkg::*; #(
.rstn_i ( rst_ni ),
.bootaddress_i ( BootAddr ),
.hart_id_i ( '0 ),
.harts_sync_req_i ( reg_reg2hw.harts_sync.q ),
.irq_i ( xeip[NumIntHarts-1:0] ),
.ipi_i ( msip[NumIntHarts-1:0] ),
.time_irq_i ( mtip[NumIntHarts-1:0] ),
Expand Down Expand Up @@ -1042,6 +1044,7 @@ module cheshire_soc import cheshire_pkg::*; #(
/////////////////////

cheshire_reg_pkg::cheshire_hw2reg_t reg_hw2reg;
cheshire_reg_pkg::cheshire_reg2hw_t reg_reg2hw;

assign reg_hw2reg = '{
boot_mode : boot_mode_i,
Expand Down Expand Up @@ -1080,6 +1083,7 @@ module cheshire_soc import cheshire_pkg::*; #(
.reg_req_i ( reg_out_req[RegOut.regs] ),
.reg_rsp_o ( reg_out_rsp[RegOut.regs] ),
.hw2reg ( reg_hw2reg ),
.reg2hw ( reg_reg2hw ),
.devmode_i ( 1'b1 )
);

Expand Down
15 changes: 13 additions & 2 deletions hw/cva6_wrap.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module cva6_wrap #(
input logic rstn_i,
input cheshire_pkg::doub_bt bootaddress_i,
input cheshire_pkg::doub_bt hart_id_i,
input logic [31:0] harts_sync_req_i,
input logic [NumHarts-1:0][1:0] irq_i,
input logic [NumHarts-1:0] ipi_i,
input logic [NumHarts-1:0] time_irq_i,
Expand Down Expand Up @@ -70,6 +71,7 @@ typedef struct packed {
axi_req_t axi_req;
} cva6_outputs_t;

logic cores_sync;
logic [NumHarts-1:0] core_setback;
cva6_inputs_t [NumHarts-1:0] sys2hmr, hmr2core;
cva6_outputs_t [NumHarts-1:0] hmr2sys, core2hmr;
Expand Down Expand Up @@ -137,12 +139,15 @@ for (genvar i = 0; i < NumHarts; i++) begin: gen_cva6_cores
);
end

assign cores_sync = (harts_sync_req_i[NumHarts-1:0] == '1) ? 1'b1 : 1'b0;

if (NumHarts > 1) begin: gen_multicore_hmr
hmr_unit #(
.NumCores ( NumHarts ),
.DMRSupported ( Cfg.Cva6DMR ),
.DMRFixed ( Cfg.Cva6DMRFixed ), // TODO: make configurable
.TMRSupported ( 0 ),
// .InterleaveGrps ( 0 ),
.RapidRecovery ( Cfg.RapidRecovery ),
.SeparateData ( 0 ),
.RfAddrWidth ( 5 ),
Expand Down Expand Up @@ -170,7 +175,12 @@ if (NumHarts > 1) begin: gen_multicore_hmr
.dmr_error_o ( /* TODO */ ), // Should this not be NumDMRCores? or NumCores?
.dmr_resynch_req_o ( /* TODO */ ),
.dmr_sw_synch_req_o ( /* TODO */ ),
.dmr_cores_synch_i ( '0 ),
// In PULP cluster we connected this to the event unit
// to receive information about cores' synchronization.
// How should we handle it here? We could use Cheshire's
// registers to write that a synchronization completed
// succesfully (??)
.dmr_cores_synch_i ( cores_sync ),

// Rapid recovery buses
.rapid_recovery_o ( /* TODO */ ),
Expand All @@ -179,7 +189,8 @@ if (NumHarts > 1) begin: gen_multicore_hmr
.sys_inputs_i ( sys2hmr ),
.sys_nominal_outputs_o ( hmr2sys ),
.sys_bus_outputs_o ( ),
.sys_fetch_en_i ( '0 ), // TODO?
// CVA6 boot does not rely on fetch enable.
.sys_fetch_en_i ( '1 ),
.enable_bus_vote_i ( '0 ), // TODO?

.core_setback_o ( core_setback ),
Expand Down

0 comments on commit 160e22b

Please sign in to comment.