data/full_repos/permissive/418752214/C910_RTL_FACTORY/gen_rtl/had/rtl/ct_had_event.v
data/verilator_xmls/e593a0c2-c2db-4547-af3f-b915dc5c2e0d.xml
module ct_had_event(
  cpuclk,
  cpurst_b,
  ctrl_event_dbgenter,
  ctrl_event_dbgexit,
  event_ctrl_enter_dbg,
  event_ctrl_exit_dbg,
  event_ctrl_had_clk_en,
  forever_coreclk,
  regs_event_enter_ie,
  regs_event_enter_oe,
  regs_event_exit_ie,
  regs_event_exit_oe,
  rtu_yy_xx_dbgon,
  x_enter_dbg_req_i,
  x_enter_dbg_req_o,
  x_exit_dbg_req_i,
  x_exit_dbg_req_o
);


input        cpuclk;                
input        cpurst_b;              
input        ctrl_event_dbgenter;   
input        ctrl_event_dbgexit;    
input        forever_coreclk;       
input        regs_event_enter_ie;   
input        regs_event_enter_oe;   
input        regs_event_exit_ie;    
input        regs_event_exit_oe;    
input        rtu_yy_xx_dbgon;       
input        x_enter_dbg_req_i;     
input        x_exit_dbg_req_i;      
output       event_ctrl_enter_dbg;  
output       event_ctrl_exit_dbg;   
output       event_ctrl_had_clk_en; 
output       x_enter_dbg_req_o;     
output       x_exit_dbg_req_o;      


reg          enter_dbg_req_i;       
reg          enter_dbg_req_o;       
reg          exit_dbg_req_o;        
reg          x_enter_dbg_req_i_f;   
reg          x_enter_dbg_req_i_sync; 
reg          x_exit_dbg_req_i_f;    
reg          x_exit_dbg_req_i_sync; 


wire         cpuclk;                
wire         cpurst_b;              
wire         ctrl_event_dbgenter;   
wire         ctrl_event_dbgexit;    
wire         event_ctrl_enter_dbg;  
wire         event_ctrl_exit_dbg;   
wire         event_ctrl_had_clk_en; 
wire         forever_coreclk;       
wire         regs_event_enter_ie;   
wire         regs_event_enter_oe;   
wire         regs_event_exit_ie;    
wire         regs_event_exit_oe;    
wire         rtu_yy_xx_dbgon;       
wire         x_enter_dbg_req_i;     
wire         x_enter_dbg_req_o;     
wire         x_enter_dbg_req_o_sync; 
wire         x_exit_dbg_req_i;      
wire         x_exit_dbg_req_o;      
wire         x_exit_dbg_req_o_sync; 



















always @ (posedge forever_coreclk or negedge cpurst_b)
begin
  if (~cpurst_b) begin
    x_enter_dbg_req_i_f    <= 1'b0;
    x_enter_dbg_req_i_sync <= 1'b0;
    x_exit_dbg_req_i_f     <= 1'b0;
    x_exit_dbg_req_i_sync  <= 1'b0;
  end
  else begin
    x_enter_dbg_req_i_f    <= x_enter_dbg_req_i;
    x_enter_dbg_req_i_sync <= x_enter_dbg_req_i_f;
    x_exit_dbg_req_i_f     <= x_exit_dbg_req_i;
    x_exit_dbg_req_i_sync  <= x_exit_dbg_req_i_f;
  end
end





always @(posedge cpuclk or negedge cpurst_b)
begin
  if (!cpurst_b)
    enter_dbg_req_i <= 1'b0;
  else if (x_enter_dbg_req_i_sync & regs_event_enter_ie)
    enter_dbg_req_i <= 1'b1;
  else if (rtu_yy_xx_dbgon)
    enter_dbg_req_i <= 1'b0;
end

assign event_ctrl_enter_dbg = enter_dbg_req_i;
assign event_ctrl_exit_dbg  = x_exit_dbg_req_i_sync & regs_event_exit_ie;






always @(posedge cpuclk or negedge cpurst_b)
begin
  if (!cpurst_b)
    exit_dbg_req_o <= 1'b0;
  else
    exit_dbg_req_o <= ctrl_event_dbgexit;
end

assign x_exit_dbg_req_o_sync = exit_dbg_req_o && regs_event_exit_oe;

always @(posedge cpuclk or negedge cpurst_b)
begin
  if (!cpurst_b)
    enter_dbg_req_o <= 1'b0;
  else
    enter_dbg_req_o <= ctrl_event_dbgenter;
end

assign x_enter_dbg_req_o_sync = enter_dbg_req_o && regs_event_enter_oe;










assign x_exit_dbg_req_o  = x_exit_dbg_req_o_sync;
assign x_enter_dbg_req_o = x_enter_dbg_req_o_sync;

assign event_ctrl_had_clk_en = x_enter_dbg_req_i_sync
                            || x_exit_dbg_req_i_sync;


endmodule
module ct_had_event(
  cpuclk,
  cpurst_b,
  ctrl_event_dbgenter,
  ctrl_event_dbgexit,
  event_ctrl_enter_dbg,
  event_ctrl_exit_dbg,
  event_ctrl_had_clk_en,
  forever_coreclk,
  regs_event_enter_ie,
  regs_event_enter_oe,
  regs_event_exit_ie,
  regs_event_exit_oe,
  rtu_yy_xx_dbgon,
  x_enter_dbg_req_i,
  x_enter_dbg_req_o,
  x_exit_dbg_req_i,
  x_exit_dbg_req_o
);



input        cpuclk;                
input        cpurst_b;              
input        ctrl_event_dbgenter;   
input        ctrl_event_dbgexit;    
input        forever_coreclk;       
input        regs_event_enter_ie;   
input        regs_event_enter_oe;   
input        regs_event_exit_ie;    
input        regs_event_exit_oe;    
input        rtu_yy_xx_dbgon;       
input        x_enter_dbg_req_i;     
input        x_exit_dbg_req_i;      
output       event_ctrl_enter_dbg;  
output       event_ctrl_exit_dbg;   
output       event_ctrl_had_clk_en; 
output       x_enter_dbg_req_o;     
output       x_exit_dbg_req_o;      


reg          enter_dbg_req_i;       
reg          enter_dbg_req_o;       
reg          exit_dbg_req_o;        
reg          x_enter_dbg_req_i_f;   
reg          x_enter_dbg_req_i_sync; 
reg          x_exit_dbg_req_i_f;    
reg          x_exit_dbg_req_i_sync; 


wire         cpuclk;                
wire         cpurst_b;              
wire         ctrl_event_dbgenter;   
wire         ctrl_event_dbgexit;    
wire         event_ctrl_enter_dbg;  
wire         event_ctrl_exit_dbg;   
wire         event_ctrl_had_clk_en; 
wire         forever_coreclk;       
wire         regs_event_enter_ie;   
wire         regs_event_enter_oe;   
wire         regs_event_exit_ie;    
wire         regs_event_exit_oe;    
wire         rtu_yy_xx_dbgon;       
wire         x_enter_dbg_req_i;     
wire         x_enter_dbg_req_o;     
wire         x_enter_dbg_req_o_sync; 
wire         x_exit_dbg_req_i;      
wire         x_exit_dbg_req_o;      
wire         x_exit_dbg_req_o_sync; 



















always @ (posedge forever_coreclk or negedge cpurst_b)
begin
  if (~cpurst_b) begin
    x_enter_dbg_req_i_f    <= 1'b0;
    x_enter_dbg_req_i_sync <= 1'b0;
    x_exit_dbg_req_i_f     <= 1'b0;
    x_exit_dbg_req_i_sync  <= 1'b0;
  end
  else begin
    x_enter_dbg_req_i_f    <= x_enter_dbg_req_i;
    x_enter_dbg_req_i_sync <= x_enter_dbg_req_i_f;
    x_exit_dbg_req_i_f     <= x_exit_dbg_req_i;
    x_exit_dbg_req_i_sync  <= x_exit_dbg_req_i_f;
  end
end





always @(posedge cpuclk or negedge cpurst_b)
begin
  if (!cpurst_b)
    enter_dbg_req_i <= 1'b0;
  else if (x_enter_dbg_req_i_sync & regs_event_enter_ie)
    enter_dbg_req_i <= 1'b1;
  else if (rtu_yy_xx_dbgon)
    enter_dbg_req_i <= 1'b0;
end

assign event_ctrl_enter_dbg = enter_dbg_req_i;
assign event_ctrl_exit_dbg  = x_exit_dbg_req_i_sync & regs_event_exit_ie;






always @(posedge cpuclk or negedge cpurst_b)
begin
  if (!cpurst_b)
    exit_dbg_req_o <= 1'b0;
  else
    exit_dbg_req_o <= ctrl_event_dbgexit;
end

assign x_exit_dbg_req_o_sync = exit_dbg_req_o && regs_event_exit_oe;

always @(posedge cpuclk or negedge cpurst_b)
begin
  if (!cpurst_b)
    enter_dbg_req_o <= 1'b0;
  else
    enter_dbg_req_o <= ctrl_event_dbgenter;
end

assign x_enter_dbg_req_o_sync = enter_dbg_req_o && regs_event_enter_oe;










assign x_exit_dbg_req_o  = x_exit_dbg_req_o_sync;
assign x_enter_dbg_req_o = x_enter_dbg_req_o_sync;

assign event_ctrl_had_clk_en = x_enter_dbg_req_i_sync
                            || x_exit_dbg_req_i_sync;


endmodule