Skip to content

Commit

Permalink
[RTL/style] Clean up header-style RTL comments
Browse files Browse the repository at this point in the history
The rationale for aligning header comments to this style is
explained in more detail in #329.
  • Loading branch information
msfschaffner committed Nov 1, 2019
1 parent bd9ae43 commit 5546c5a
Show file tree
Hide file tree
Showing 54 changed files with 601 additions and 604 deletions.
42 changes: 21 additions & 21 deletions hw/ip/alert_handler/rtl/alert_handler.sv
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ module alert_handler (
input [alert_pkg::N_ESC_SEV-1:0] resp_ni
);

//////////////////////////////////////////////////////
// Regfile Breakout and Mapping
//////////////////////////////////////////////////////
//////////////////////////////////
// Regfile Breakout and Mapping //
//////////////////////////////////

alert_pkg::hw2reg_wrap_t hw2reg_wrap;
alert_pkg::reg2hw_wrap_t reg2hw_wrap;
Expand All @@ -52,9 +52,9 @@ module alert_handler (
.reg2hw_wrap
);

//////////////////////////////////////////////////////
// Ping Timer
//////////////////////////////////////////////////////
////////////////
// Ping Timer //
////////////////

logic [alert_pkg::N_LOC_ALERT-1:0] loc_alert_trig;

Expand All @@ -80,9 +80,9 @@ module alert_handler (
.esc_ping_fail_o ( loc_alert_trig[1] )
);

//////////////////////////////////////////////////////
// Alert Receivers
//////////////////////////////////////////////////////
/////////////////////
// Alert Receivers //
/////////////////////

logic [alert_pkg::NAlerts-1:0] alert_integfail;
logic [alert_pkg::NAlerts-1:0] alert_trig;
Expand All @@ -109,9 +109,9 @@ module alert_handler (

assign loc_alert_trig[2] = |(reg2hw_wrap.alert_en & alert_integfail);

//////////////////////////////////////////////////////
// Set alert cause bits and classify
//////////////////////////////////////////////////////
///////////////////////////////////////
// Set alert cause bits and classify //
///////////////////////////////////////

alert_handler_class i_class (
.alert_trig_i ( alert_trig ),
Expand All @@ -126,9 +126,9 @@ module alert_handler (
.class_trig_o ( hw2reg_wrap.class_trig )
);

//////////////////////////////////////////////////////
// Escalation Handling of Classes
//////////////////////////////////////////////////////
////////////////////////////////////
// Escalation Handling of Classes //
////////////////////////////////////

logic [alert_pkg::N_CLASSES-1:0] class_accum_trig;
logic [alert_pkg::N_CLASSES-1:0][alert_pkg::N_ESC_SEV-1:0] class_esc_sig_en;
Expand Down Expand Up @@ -164,9 +164,9 @@ module alert_handler (
);
end

//////////////////////////////////////////////////////
// Escalation Senders
//////////////////////////////////////////////////////
////////////////////////
// Escalation Senders //
////////////////////////

logic [alert_pkg::N_ESC_SEV-1:0] esc_sig_en;
logic [alert_pkg::N_ESC_SEV-1:0] esc_integfail;
Expand Down Expand Up @@ -195,9 +195,9 @@ module alert_handler (

assign loc_alert_trig[3] = |esc_integfail;

//////////////////////////////////////////////////////
// Assertions
//////////////////////////////////////////////////////
////////////////
// Assertions //
////////////////

// check whether all outputs have a good known state after reset
`ASSERT_KNOWN(TlKnownO_A, tl_o, clk_i, !rst_ni)
Expand Down
32 changes: 12 additions & 20 deletions hw/ip/alert_handler/rtl/alert_handler_esc_timer.sv
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ module alert_handler_esc_timer (
output alert_pkg::cstate_e esc_state_o
);

//////////////////////////////////////////////////////
// Counter
//////////////////////////////////////////////////////
/////////////
// Counter //
/////////////

alert_pkg::cstate_e state_d, state_q;

Expand All @@ -58,9 +58,9 @@ module alert_handler_esc_timer (
logic [alert_pkg::EscCntDw-1:0] thresh;
assign cnt_ge = (cnt_q >= thresh);

//////////////////////////////////////////////////////
// Main FSM
//////////////////////////////////////////////////////
//////////////
// Main FSM //
//////////////

logic [alert_pkg::N_PHASES-1:0] phase_oh;

Expand All @@ -74,7 +74,6 @@ module alert_handler_esc_timer (
thresh = timeout_cyc_i;

unique case (state_q)
////////////////////////////////////
// wait for an escalation trigger or an alert trigger
// the latter will trigger an interrupt timeout
alert_pkg::Idle: begin
Expand All @@ -91,7 +90,6 @@ module alert_handler_esc_timer (
cnt_clr = 1'b1;
end
end
////////////////////////////////////
// we are in interrupt timeout state
// in case an escalation comes in, we immediately have to
// switch over to the first escalation phase.
Expand All @@ -113,7 +111,6 @@ module alert_handler_esc_timer (
cnt_clr = 1'b1;
end
end
////////////////////////////////////
// note: autolocking the clear signal is done in the regfile
alert_pkg::Phase0: begin
phase_oh[0] = 1'b1;
Expand All @@ -130,7 +127,6 @@ module alert_handler_esc_timer (
cnt_en = 1'b1;
end
end
////////////////////////////////////
alert_pkg::Phase1: begin
phase_oh[1] = 1'b1;
thresh = phase_cyc_i[1];
Expand All @@ -146,7 +142,6 @@ module alert_handler_esc_timer (
cnt_en = 1'b1;
end
end
////////////////////////////////////
alert_pkg::Phase2: begin
phase_oh[2] = 1'b1;
thresh = phase_cyc_i[2];
Expand All @@ -162,7 +157,6 @@ module alert_handler_esc_timer (
cnt_en = 1'b1;
end
end
////////////////////////////////////
alert_pkg::Phase3: begin
phase_oh[3] = 1'b1;
thresh = phase_cyc_i[3];
Expand All @@ -177,7 +171,6 @@ module alert_handler_esc_timer (
cnt_en = 1'b1;
end
end
////////////////////////////////////
// final, terminal state after escalation.
// if clr is locked down, only a system reset
// will get us out of this state
Expand All @@ -186,7 +179,6 @@ module alert_handler_esc_timer (
state_d = alert_pkg::Idle;
end
end
////////////////////////////////////
default : state_d = alert_pkg::Idle;
endcase
end
Expand All @@ -199,9 +191,9 @@ module alert_handler_esc_timer (
assign esc_sig_en_o[k] = |(esc_map_oh[k] & phase_oh);
end

//////////////////////////////////////////////////////
// Regs
//////////////////////////////////////////////////////
///////////////
// Registers //
///////////////

// switch interrupt / escalation mode
always_ff @(posedge clk_i or negedge rst_ni) begin : p_regs
Expand All @@ -222,9 +214,9 @@ module alert_handler_esc_timer (
end
end

//////////////////////////////////////////////////////
// Assertions
//////////////////////////////////////////////////////
////////////////
// Assertions //
////////////////

// a clear should always bring us back to idle
`ASSERT(CheckClr, clr_i && state_q != alert_pkg::Timeout |=>
Expand Down
34 changes: 15 additions & 19 deletions hw/ip/alert_handler/rtl/alert_handler_ping_timer.sv
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ module alert_handler_ping_timer (
13, 8, 29, 31,
20, 6, 9, 17};

//////////////////////////////////////////////////////
// PRNG
//////////////////////////////////////////////////////
//////////
// PRNG //
//////////

logic lfsr_en;
logic [31:0] lfsr_state, perm_state;
Expand Down Expand Up @@ -90,9 +90,9 @@ module alert_handler_ping_timer (
// check if the randomly drawn ID is actually valid and the alert is enabled
assign id_vld = enable_mask[id_to_ping];

//////////////////////////////////////////////////////
// Counter
//////////////////////////////////////////////////////
/////////////
// Counter //
/////////////

logic [alert_pkg::PING_CNT_DW-1:0] cnt_d, cnt_q;
logic cnt_en, cnt_clr;
Expand All @@ -102,9 +102,9 @@ module alert_handler_ping_timer (
assign wait_ge = (cnt_q >= wait_cyc);
assign timeout_ge = (cnt_q >= ping_timeout_cyc_i);

//////////////////////////////////////////////////////
// Ping and Timeout Logic
//////////////////////////////////////////////////////
////////////////////////////
// Ping and Timeout Logic //
////////////////////////////

typedef enum logic [1:0] {Init, RespWait, DoPing} state_e;
state_e state_d, state_q;
Expand Down Expand Up @@ -139,7 +139,6 @@ module alert_handler_ping_timer (
esc_ping_fail_o = spurious_esc_ping;

unique case (state_q)
///////////////////////////
// wait until activiated
// we never return to this state
// once activated!
Expand All @@ -149,7 +148,6 @@ module alert_handler_ping_timer (
state_d = RespWait;
end
end
///////////////////////////
// wait for random amount of cycles
// draw another ID/wait count if the
// peripheral ID is not valid
Expand All @@ -165,7 +163,6 @@ module alert_handler_ping_timer (
cnt_en = 1'b1;
end
end
///////////////////////////
// send out ping request and wait for a ping
// response or a ping timeout (whatever comes first)
DoPing: begin
Expand All @@ -183,15 +180,14 @@ module alert_handler_ping_timer (
end
end
end
///////////////////////////
default : state_d = Init;
endcase

end

//////////////////////////////////////////////////////
// Flops
//////////////////////////////////////////////////////
///////////////
// Registers //
///////////////

always_ff @(posedge clk_i or negedge rst_ni) begin : p_regs
if (!rst_ni) begin
Expand All @@ -208,9 +204,9 @@ module alert_handler_ping_timer (
end
end

//////////////////////////////////////////////////////
// Assertions
//////////////////////////////////////////////////////
////////////////
// Assertions //
////////////////

// internals
`ASSERT(PingOH0, $onehot0(ping_sel), clk_i, !rst_ni)
Expand Down
18 changes: 9 additions & 9 deletions hw/ip/alert_handler/rtl/alert_handler_reg_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ package alert_handler_reg_pkg;
localparam int PHASE_DW = 2;
localparam int CLASS_DW = 2;

/////////////////////////////////////////////////////////////////////
// Typedefs for multiregs
/////////////////////////////////////////////////////////////////////
////////////////////////////
// Typedefs for multiregs //
////////////////////////////

typedef struct packed {
logic [0:0] q;
Expand Down Expand Up @@ -52,9 +52,9 @@ typedef struct packed {
logic de;
} alert_handler_hw2reg_loc_alert_cause_mreg_t;

/////////////////////////////////////////////////////////////////////
// Register to internal design logic
/////////////////////////////////////////////////////////////////////
///////////////////////////////////////
// Register to internal design logic //
///////////////////////////////////////

typedef struct packed {
struct packed {
Expand Down Expand Up @@ -333,9 +333,9 @@ typedef struct packed {
} classd_phase3_cyc;
} alert_handler_reg2hw_t;

/////////////////////////////////////////////////////////////////////
// Internal design logic to register
/////////////////////////////////////////////////////////////////////
///////////////////////////////////////
// Internal design logic to register //
///////////////////////////////////////

typedef struct packed {
struct packed {
Expand Down
Loading

0 comments on commit 5546c5a

Please sign in to comment.