Commit f85ca27f authored by GuillemCabo's avatar GuillemCabo
Browse files

hold interrupts unitl reset

parent 2a76216f
...@@ -265,16 +265,31 @@ ...@@ -265,16 +265,31 @@
by how much the quota was exceeded. Interruption is only generated if the by how much the quota was exceeded. Interruption is only generated if the
MCCU is enabled MCCU is enabled
----------*/ ----------*/
wire interruption_quota_d[N_CORES-1:0];
reg interruption_quota_q[N_CORES-1:0];
for(x=0; x<N_CORES; x=x+1) begin: InterruptionQuota for(x=0; x<N_CORES; x=x+1) begin: InterruptionQuota
assign interruption_quota_o[x] = assign interruption_quota_d[x] =
!enable_i ? 1'b0: !enable_i ? 1'b0:
(ccc_suma_int[x]>{{O_D_0PAD{1'b0}},quota_int[x]})? 1'b1:1'b0; (ccc_suma_int[x]>{{O_D_0PAD{1'b0}},quota_int[x]})? 1'b1:1'b0;
end end
for(x=0; x<N_CORES; x=x+1) begin: InterruptionQuotaHold
always @(posedge clk_i) begin
if(rstn_i == 1'b0 ) begin
interruption_quota_q[x] <= '{default:'0};
end else begin
interruption_quota_q[x] <= interruption_quota_d[x] | interruption_quota_q[x];
end
end
end
assign interruption_quota_o = interruption_quota_q;
`ifdef ASSERTIONS `ifdef ASSERTIONS
always @(posedge clk_i) begin always @(posedge clk_i) begin
for(integer x=0; x<N_CORES; x=x+1) begin: InterruptionQuota for(integer x=0; x<N_CORES; x=x+1) begin: InterruptionQuota
if(quota_int[x]>ccc_suma_int[x]) if(quota_int[x]>ccc_suma_int[x])
assert (interruption_quota_o[x]==1'b0); assert (interruption_quota_d[x]==1'b0);
end end
end end
`endif `endif
...@@ -356,6 +371,7 @@ Section of Formal propperties, valid for SBY ...@@ -356,6 +371,7 @@ Section of Formal propperties, valid for SBY
assert(interruption_quota_o[k]==enable_i); assert(interruption_quota_o[k]==enable_i);
end else begin end else begin
//interruption shall be disabled regardless of enable_i //interruption shall be disabled regardless of enable_i
//TODO: if we retain the previous state (hold interrupt) this does not apply
assert(interruption_quota_o[k]==1'b0); assert(interruption_quota_o[k]==1'b0);
end end
end end
......
...@@ -6,7 +6,7 @@ then ...@@ -6,7 +6,7 @@ then
vmap work $PWD/MCCU vmap work $PWD/MCCU
vlog +acc=rn +incdir+../../hdl/ ../../hdl/*.sv tb_MCCU.sv vlog +acc=rn +incdir+../../hdl/ ../../hdl/*.sv tb_MCCU.sv
vmake MCCU/ > Makefile vmake MCCU/ > Makefile
vsim work.tb_MCCU -do "view wave -new" -do "do wave.do" -do "run 40000" vsim work.tb_MCCU -do "view wave -new" -do "do wave.do" -do "run -all"
else else
vlib MCCU vlib MCCU
vmap work $PWD/MCCU vmap work $PWD/MCCU
......
...@@ -109,6 +109,7 @@ task automatic init_sim; ...@@ -109,6 +109,7 @@ task automatic init_sim;
begin begin
int tmp =0; int tmp =0;
disable_MCCU; disable_MCCU;
reset_dut;
//rise all events //rise all events
if(events_i) begin if(events_i) begin
rise_event(0,0); rise_event(0,0);
...@@ -417,6 +418,7 @@ task automatic init_sim; ...@@ -417,6 +418,7 @@ task automatic init_sim;
task automatic get_interrupt; task automatic get_interrupt;
input core_i; input core_i;
output int unsigned value_o; output int unsigned value_o;
#CLK_PERIOD
value_o = tb_interruption_quota_o[core_i]; value_o = tb_interruption_quota_o[core_i];
$display("get quota of core: %d remaining quota: %d",core_i,value_o); $display("get quota of core: %d remaining quota: %d",core_i,value_o);
if((core_i>TB_N_CORES)) begin if((core_i>TB_N_CORES)) begin
......
...@@ -4,17 +4,20 @@ add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/clk_i ...@@ -4,17 +4,20 @@ add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/clk_i
add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/rstn_i add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/rstn_i
add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/enable_i add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/enable_i
add wave -noupdate -height 40 -radix decimal /tb_MCCU/dut_MCCU/quota_i add wave -noupdate -height 40 -radix decimal /tb_MCCU/dut_MCCU/quota_i
add wave -noupdate -height 40 -radix decimal /tb_MCCU/dut_MCCU/quota_int add wave -noupdate -height 40 -radix decimal -childformat {{{/tb_MCCU/dut_MCCU/quota_int[0]} -radix decimal} {{/tb_MCCU/dut_MCCU/quota_int[1]} -radix decimal} {{/tb_MCCU/dut_MCCU/quota_int[2]} -radix decimal} {{/tb_MCCU/dut_MCCU/quota_int[3]} -radix decimal}} -expand -subitemconfig {{/tb_MCCU/dut_MCCU/quota_int[0]} {-radix decimal} {/tb_MCCU/dut_MCCU/quota_int[1]} {-radix decimal} {/tb_MCCU/dut_MCCU/quota_int[2]} {-radix decimal} {/tb_MCCU/dut_MCCU/quota_int[3]} {-radix decimal}} /tb_MCCU/dut_MCCU/quota_int
add wave -noupdate -height 40 -radix decimal /tb_MCCU/dut_MCCU/quota_o add wave -noupdate -height 40 -radix decimal /tb_MCCU/dut_MCCU/quota_o
add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/interruption_quota_o add wave -noupdate -height 40 -expand /tb_MCCU/dut_MCCU/interruption_quota_o
add wave -noupdate -height 40 -radix unsigned -childformat {{{/tb_MCCU/dut_MCCU/events_weights_i[0]} -radix unsigned}} -expand -subitemconfig {{/tb_MCCU/dut_MCCU/events_weights_i[0]} {-height 40 -radix unsigned}} /tb_MCCU/dut_MCCU/events_weights_i add wave -noupdate -height 40 -radix unsigned -childformat {{{/tb_MCCU/dut_MCCU/events_weights_i[0]} -radix unsigned} {{/tb_MCCU/dut_MCCU/events_weights_i[1]} -radix unsigned} {{/tb_MCCU/dut_MCCU/events_weights_i[2]} -radix unsigned} {{/tb_MCCU/dut_MCCU/events_weights_i[3]} -radix unsigned}} -expand -subitemconfig {{/tb_MCCU/dut_MCCU/events_weights_i[0]} {-height 40 -radix unsigned} {/tb_MCCU/dut_MCCU/events_weights_i[1]} {-height 31 -radix unsigned} {/tb_MCCU/dut_MCCU/events_weights_i[2]} {-height 31 -radix unsigned} {/tb_MCCU/dut_MCCU/events_weights_i[3]} {-height 31 -radix unsigned}} /tb_MCCU/dut_MCCU/events_weights_i
add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/events_i add wave -noupdate -height 40 /tb_MCCU/dut_MCCU/events_i
add wave -noupdate /tb_MCCU/dut_MCCU/update_quota_i add wave -noupdate /tb_MCCU/dut_MCCU/update_quota_i
add wave -noupdate /tb_MCCU/dut_MCCU/ccc_suma_int add wave -noupdate /tb_MCCU/dut_MCCU/ccc_suma_int
add wave -noupdate /tb_MCCU/dut_MCCU/interruption_quota_d
add wave -noupdate /tb_MCCU/dut_MCCU/interruption_quota_q
add wave -noupdate -radix ascii /tb_MCCU/tb_test_name
TreeUpdate [SetDefaultTree] TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {24000 ps} 0} WaveRestoreCursors {{Cursor 1} {14000 ps} 0}
quietly wave cursor active 1 quietly wave cursor active 1
configure wave -namecolwidth 259 configure wave -namecolwidth 592
configure wave -valuecolwidth 169 configure wave -valuecolwidth 169
configure wave -justifyvalue left configure wave -justifyvalue left
configure wave -signalnamewidth 0 configure wave -signalnamewidth 0
...@@ -28,4 +31,4 @@ configure wave -griddelta 40 ...@@ -28,4 +31,4 @@ configure wave -griddelta 40
configure wave -timeline 0 configure wave -timeline 0
configure wave -timelineunits ns configure wave -timelineunits ns
update update
WaveRestoreZoom {0 ps} {76223 ps} WaveRestoreZoom {509 ps} {57774 ps}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment