// ================================================================ // NVDLA Open Source Project // // Copyright(c) 2016 - 2017 NVIDIA Corporation. Licensed under the // NVDLA Open Hardware License; Check "LICENSE" which comes with // this distribution for more information. // ================================================================ // File Name: NV_NVDLA_NOCIF_DRAM_READ_IG_spt.v `include "simulate_x_tick.vh" // ================================================================ // NVDLA Open Source Project // // Copyright(c) 2016 - 2017 NVIDIA Corporation. Licensed under the // NVDLA Open Hardware License; Check "LICENSE" which comes with // this distribution for more information. // ================================================================ // File Name: NV_NVDLA_define.h /////////////////////////////////////////////////// // //#if ( NVDLA_PRIMARY_MEMIF_WIDTH == 512 ) // #define LARGE_MEMBUS //#endif //#if ( NVDLA_PRIMARY_MEMIF_WIDTH == 64 ) // #define SMALL_MEMBUS //#endif module NV_NVDLA_NOCIF_DRAM_READ_IG_spt ( nvdla_core_clk //|< i ,nvdla_core_rstn //|< i ,arb2spt_req_valid //|< i ,arb2spt_req_ready //|> o ,arb2spt_req_pd //|< i ,spt2cvt_req_valid //|> o ,spt2cvt_req_ready //|< i ,spt2cvt_req_pd //|> o ); // // NV_NVDLA_NOCIF_DRAM_READ_IG_spt_ports.v // input nvdla_core_clk; input nvdla_core_rstn; input arb2spt_req_valid; /* data valid */ output arb2spt_req_ready; /* data return handshake */ input [32 +10:0] arb2spt_req_pd; output spt2cvt_req_valid; /* data valid */ input spt2cvt_req_ready; /* data return handshake */ output [32 +10:0] spt2cvt_req_pd; reg is_2nd_req; reg [32 +10:0] p2_pipe_data; reg [32 +10:0] p2_pipe_rand_data; reg p2_pipe_rand_ready; reg p2_pipe_rand_valid; reg p2_pipe_ready; reg p2_pipe_ready_bc; reg [32 +10:0] p2_pipe_skid_data; reg p2_pipe_skid_ready; reg p2_pipe_skid_valid; reg p2_pipe_valid; reg p2_skid_catch; reg [32 +10:0] p2_skid_data; reg p2_skid_ready; reg p2_skid_ready_flop; reg p2_skid_valid; reg [32 +10:0] spt2cvt_req_pd; reg spt2cvt_req_valid; reg spt_out_rdy; wire [2:0] end_offset; wire end_offset_c; wire [32 -1:0] first_req_addr; wire [2:0] first_req_size; wire is_cross_256byte_boundary; wire req_accept; wire [32 -1:0] second_req_addr; wire [2:0] second_req_size; wire [32 -1:0] spt2cvt_addr; wire [3:0] spt2cvt_axid; wire spt2cvt_ftran; wire spt2cvt_ltran; wire spt2cvt_odd; wire [2:0] spt2cvt_size; wire spt2cvt_swizzle; wire [32 +10:0] spt_out_pd; wire spt_out_vld; wire [32 -1:0] spt_req_addr; wire [3:0] spt_req_axid; wire spt_req_ftran; wire spt_req_ltran; wire spt_req_odd; wire [2:0] spt_req_offset; wire [32 +10:0] spt_req_pd; wire spt_req_rdy; wire [2:0] spt_req_size; wire spt_req_swizzle; wire spt_req_vld; // synoff nets // monitor nets // debug nets // tie high nets // tie low nets // no connect nets // not all bits used nets // todo nets NV_NVDLA_NOCIF_DRAM_READ_IG_SPT_pipe_p1 pipe_p1 ( .nvdla_core_clk (nvdla_core_clk) //|< i ,.nvdla_core_rstn (nvdla_core_rstn) //|< i ,.arb2spt_req_pd (arb2spt_req_pd[32 +10:0]) //|< i ,.arb2spt_req_valid (arb2spt_req_valid) //|< i ,.spt_req_rdy (spt_req_rdy) //|< w ,.arb2spt_req_ready (arb2spt_req_ready) //|> o ,.spt_req_pd (spt_req_pd[32 +10:0]) //|> w ,.spt_req_vld (spt_req_vld) //|> w ); //my $wi = eval(32 +10+1); //&eperl::pipe(" -wid $wi -vo spt_req_vld -do spt_req_pd -ri arb2spt_req_ready -di arb2spt_req_pd -vi arb2spt_req_valid -ro spt_req_rdy"); assign spt_req_rdy = spt_out_rdy & (!is_cross_256byte_boundary || (is_cross_256byte_boundary & is_2nd_req)); // PKT_UNPACK_WIRE( cvt_read_cmd , spt_req_ , spt_req_pd ) assign spt_req_axid[3:0] = spt_req_pd[3:0]; assign spt_req_addr[32 -1:0] = spt_req_pd[32 -1+4:4]; assign spt_req_size[2:0] = spt_req_pd[32 +6:32 +4]; assign spt_req_swizzle = spt_req_pd[32 +7]; assign spt_req_odd = spt_req_pd[32 +8]; assign spt_req_ltran = spt_req_pd[32 +9]; assign spt_req_ftran = spt_req_pd[32 +10]; `ifdef SPYGLASS_ASSERT_ON `else // spyglass disable_block NoWidthInBasedNum-ML // spyglass disable_block STARC-2.10.3.2a // spyglass disable_block STARC05-2.1.3.1 // spyglass disable_block STARC-2.1.4.6 // spyglass disable_block W116 // spyglass disable_block W154 // spyglass disable_block W239 // spyglass disable_block W362 // spyglass disable_block WRN_58 // spyglass disable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `ifdef ASSERT_ON `ifdef FV_ASSERT_ON `define ASSERT_RESET nvdla_core_rstn `else `ifdef SYNTHESIS `define ASSERT_RESET nvdla_core_rstn `else `ifdef ASSERT_OFF_RESET_IS_X `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b0 : nvdla_core_rstn) `else `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b1 : nvdla_core_rstn) `endif // ASSERT_OFF_RESET_IS_X `endif // SYNTHESIS `endif // FV_ASSERT_ON // VCS coverage off wire cond_zzz_assert_always_1x = (spt_req_addr[4:0] == 0); nv_assert_always #(0,0,"lower 5 LSB should always be 0") zzz_assert_always_1x (.clk(nvdla_core_clk), .reset_(`ASSERT_RESET), .test_expr(cond_zzz_assert_always_1x)); // spyglass disable W504 SelfDeterminedExpr-ML // VCS coverage on `undef ASSERT_RESET `endif // ASSERT_ON `ifdef SPYGLASS_ASSERT_ON `else // spyglass enable_block NoWidthInBasedNum-ML // spyglass enable_block STARC-2.10.3.2a // spyglass enable_block STARC05-2.1.3.1 // spyglass enable_block STARC-2.1.4.6 // spyglass enable_block W116 // spyglass enable_block W154 // spyglass enable_block W239 // spyglass enable_block W362 // spyglass enable_block WRN_58 // spyglass enable_block WRN_61 `endif // SPYGLASS_ASSERT_ON assign spt_req_offset = spt_req_addr[3 +2:3]; assign {end_offset_c,end_offset[2:0]} = spt_req_offset + spt_req_size; //:my $i = log(64/8)/log(2); //:if ($i == 3) { //: print qq( //: assign is_cross_256byte_boundary = 1'b0; //:); //:} else { //: print qq( //: assign is_cross_256byte_boundary = spt_req_vld & end_offset_c; //: ); //:} //| eperl: generated_beg (DO NOT EDIT BELOW) assign is_cross_256byte_boundary = 1'b0; //| eperl: generated_end (DO NOT EDIT ABOVE) //assign is_cross_256byte_boundary = spt_req_vld & end_offset_c; assign first_req_size = (is_cross_256byte_boundary) ? (7 - spt_req_offset) : spt_req_size; assign first_req_addr = spt_req_addr; // second_* is useful only when is_2nd_req needed //assign second_req_addr = {spt_req_addr[39:8],{8{1'b0}}}; reg [32 -1:0] second_req_addr_i; //: my $i; //: $i = (log(64/8)/log(2)) + 1; //:print qq( //: always @(spt_req_addr) begin //: second_req_addr_i = spt_req_addr; //: second_req_addr_i[$i:0] = 0; //: end //:); //| eperl: generated_beg (DO NOT EDIT BELOW) always @(spt_req_addr) begin second_req_addr_i = spt_req_addr; second_req_addr_i[4:0] = 0; end //| eperl: generated_end (DO NOT EDIT ABOVE) //assign second_req_addr = {spt_req_addr[32 -1:8],{8{1'b0}}}; assign second_req_addr = second_req_addr_i; assign second_req_size = end_offset; // only usefull when 2nd req is needed always @(posedge nvdla_core_clk or negedge nvdla_core_rstn) begin if (!nvdla_core_rstn) begin is_2nd_req <= 1'b0; end else begin if (req_accept) begin if (is_2nd_req) begin is_2nd_req <= 0; end else if (is_cross_256byte_boundary) begin is_2nd_req <= 1; end end end end assign spt2cvt_addr = (is_2nd_req) ? second_req_addr : first_req_addr; assign spt2cvt_size = (is_2nd_req) ? second_req_size : first_req_size; assign spt2cvt_swizzle = spt_req_swizzle; assign spt2cvt_odd = spt_req_odd; assign spt2cvt_ltran = spt_req_ltran; assign spt2cvt_ftran = spt_req_ftran; //assign spt2cvt_user_size = spt_req_user_size; //stepheng,remove assign spt2cvt_axid = spt_req_axid; assign req_accept = spt_out_vld & spt_out_rdy; assign spt_out_vld = spt_req_vld; // PKT_PACK_WIRE( cvt_read_cmd , spt2cvt_ , spt_out_pd ) assign spt_out_pd[3:0] = spt2cvt_axid[3:0]; assign spt_out_pd[32 -1+4:4] = spt2cvt_addr[32 -1:0]; assign spt_out_pd[32 +6:32 +4] = spt2cvt_size[2:0]; assign spt_out_pd[32 +7] = spt2cvt_swizzle ; assign spt_out_pd[32 +8] = spt2cvt_odd ; assign spt_out_pd[32 +9] = spt2cvt_ltran ; assign spt_out_pd[32 +10] = spt2cvt_ftran ; //## pipe (2) randomizer `ifndef SYNTHESIS reg p2_pipe_rand_active; `endif always @( `ifndef SYNTHESIS p2_pipe_rand_active or `endif spt_out_vld or p2_pipe_rand_ready or spt_out_pd ) begin `ifdef SYNTHESIS p2_pipe_rand_valid = spt_out_vld; spt_out_rdy = p2_pipe_rand_ready; p2_pipe_rand_data = spt_out_pd; `else // VCS coverage off p2_pipe_rand_valid = (p2_pipe_rand_active)? 1'b0 : spt_out_vld; spt_out_rdy = (p2_pipe_rand_active)? 1'b0 : p2_pipe_rand_ready; p2_pipe_rand_data = (p2_pipe_rand_active)? 'bx : spt_out_pd; // VCS coverage on `endif end `ifndef SYNTHESIS // VCS coverage off //// randomization init integer p2_pipe_stall_cycles; integer p2_pipe_stall_probability; integer p2_pipe_stall_cycles_min; integer p2_pipe_stall_cycles_max; initial begin p2_pipe_stall_cycles = 0; p2_pipe_stall_probability = 0; p2_pipe_stall_cycles_min = 1; p2_pipe_stall_cycles_max = 10; `ifndef SYNTH_LEVEL1_COMPILE if ( $value$plusargs( "NV_NVDLA_NOCIF_READ_IG_spt_pipe_rand_probability=%d", p2_pipe_stall_probability ) ) ; // deprecated else if ( $value$plusargs( "default_pipe_rand_probability=%d", p2_pipe_stall_probability ) ) ; // deprecated if ( $value$plusargs( "NV_NVDLA_NOCIF_READ_IG_spt_pipe_stall_probability=%d", p2_pipe_stall_probability ) ) ; else if ( $value$plusargs( "default_pipe_stall_probability=%d", p2_pipe_stall_probability ) ) ; if ( $value$plusargs( "NV_NVDLA_NOCIF_READ_IG_spt_pipe_stall_cycles_min=%d", p2_pipe_stall_cycles_min ) ) ; else if ( $value$plusargs( "default_pipe_stall_cycles_min=%d", p2_pipe_stall_cycles_min ) ) ; if ( $value$plusargs( "NV_NVDLA_NOCIF_READ_IG_spt_pipe_stall_cycles_max=%d", p2_pipe_stall_cycles_max ) ) ; else if ( $value$plusargs( "default_pipe_stall_cycles_max=%d", p2_pipe_stall_cycles_max ) ) ; `endif end // randomization globals `ifndef SYNTH_LEVEL1_COMPILE `ifdef SIMTOP_RANDOMIZE_STALLS always @( `SIMTOP_RANDOMIZE_STALLS.global_stall_event ) begin if ( ! $test$plusargs( "NV_NVDLA_NOCIF_READ_IG_spt_pipe_stall_probability" ) ) p2_pipe_stall_probability = `SIMTOP_RANDOMIZE_STALLS.global_stall_pipe_probability; if ( ! $test$plusargs( "NV_NVDLA_NOCIF_READ_IG_spt_pipe_stall_cycles_min" ) ) p2_pipe_stall_cycles_min = `SIMTOP_RANDOMIZE_STALLS.global_stall_pipe_cycles_min; if ( ! $test$plusargs( "NV_NVDLA_NOCIF_READ_IG_spt_pipe_stall_cycles_max" ) ) p2_pipe_stall_cycles_max = `SIMTOP_RANDOMIZE_STALLS.global_stall_pipe_cycles_max; end `endif `endif //// randomization active reg p2_pipe_rand_enable; reg p2_pipe_rand_poised; always @( p2_pipe_stall_cycles or p2_pipe_stall_probability or spt_out_vld ) begin p2_pipe_rand_active = p2_pipe_stall_cycles != 0; p2_pipe_rand_enable = p2_pipe_stall_probability != 0; p2_pipe_rand_poised = p2_pipe_rand_enable && !p2_pipe_rand_active && spt_out_vld === 1'b1; end //// randomization cycles always @(posedge nvdla_core_clk or negedge nvdla_core_rstn) begin if (!nvdla_core_rstn) begin p2_pipe_stall_cycles <= 1'b0; end else begin if (p2_pipe_rand_poised) begin if (p2_pipe_stall_probability >= prand_inst0(1, 100)) begin p2_pipe_stall_cycles <= prand_inst1(p2_pipe_stall_cycles_min, p2_pipe_stall_cycles_max); end end else if (p2_pipe_rand_active) begin p2_pipe_stall_cycles <= p2_pipe_stall_cycles - 1; end else begin p2_pipe_stall_cycles <= 0; end end end `ifdef SYNTH_LEVEL1_COMPILE `else `ifdef SYNTHESIS `else `ifdef PRAND_VERILOG // Only verilog needs any local variables reg [47:0] prand_local_seed0; reg prand_initialized0; reg prand_no_rollpli0; `endif `endif `endif function [31:0] prand_inst0; //VCS coverage off input [31:0] min; input [31:0] max; reg [32:0] diff; begin `ifdef SYNTH_LEVEL1_COMPILE prand_inst0 = min; `else `ifdef SYNTHESIS prand_inst0 = min; `else `ifdef PRAND_VERILOG if (prand_initialized0 !== 1'b1) begin prand_no_rollpli0 = $test$plusargs("NO_ROLLPLI"); if (!prand_no_rollpli0) prand_local_seed0 = {$prand_get_seed(0), 16'b0}; prand_initialized0 = 1'b1; end if (prand_no_rollpli0) begin prand_inst0 = min; end else begin diff = max - min + 1; prand_inst0 = min + prand_local_seed0[47:16] % diff; // magic numbers taken from Java's random class (same as lrand48) prand_local_seed0 = prand_local_seed0 * 48'h5deece66d + 48'd11; end `else `ifdef PRAND_OFF prand_inst0 = min; `else prand_inst0 = $RollPLI(min, max, "auto"); `endif `endif `endif `endif end //VCS coverage on endfunction `ifdef SYNTH_LEVEL1_COMPILE `else `ifdef SYNTHESIS `else `ifdef PRAND_VERILOG // Only verilog needs any local variables reg [47:0] prand_local_seed1; reg prand_initialized1; reg prand_no_rollpli1; `endif `endif `endif function [31:0] prand_inst1; //VCS coverage off input [31:0] min; input [31:0] max; reg [32:0] diff; begin `ifdef SYNTH_LEVEL1_COMPILE prand_inst1 = min; `else `ifdef SYNTHESIS prand_inst1 = min; `else `ifdef PRAND_VERILOG if (prand_initialized1 !== 1'b1) begin prand_no_rollpli1 = $test$plusargs("NO_ROLLPLI"); if (!prand_no_rollpli1) prand_local_seed1 = {$prand_get_seed(1), 16'b0}; prand_initialized1 = 1'b1; end if (prand_no_rollpli1) begin prand_inst1 = min; end else begin diff = max - min + 1; prand_inst1 = min + prand_local_seed1[47:16] % diff; // magic numbers taken from Java's random class (same as lrand48) prand_local_seed1 = prand_local_seed1 * 48'h5deece66d + 48'd11; end `else `ifdef PRAND_OFF prand_inst1 = min; `else prand_inst1 = $RollPLI(min, max, "auto"); `endif `endif `endif `endif end //VCS coverage on endfunction `endif // VCS coverage on //## pipe (2) valid-ready-bubble-collapse always @( p2_pipe_ready or p2_pipe_valid ) begin p2_pipe_ready_bc = p2_pipe_ready || !p2_pipe_valid; end always @(posedge nvdla_core_clk or negedge nvdla_core_rstn) begin if (!nvdla_core_rstn) begin p2_pipe_valid <= 1'b0; end else begin p2_pipe_valid <= (p2_pipe_ready_bc)? p2_pipe_rand_valid : 1'd1; end end always @(posedge nvdla_core_clk) begin // VCS sop_coverage_off start p2_pipe_data <= (p2_pipe_ready_bc && p2_pipe_rand_valid)? p2_pipe_rand_data : p2_pipe_data; // VCS sop_coverage_off end end always @( p2_pipe_ready_bc ) begin p2_pipe_rand_ready = p2_pipe_ready_bc; end //## pipe (2) skid buffer always @( p2_pipe_valid or p2_skid_ready_flop or p2_pipe_skid_ready or p2_skid_valid ) begin p2_skid_catch = p2_pipe_valid && p2_skid_ready_flop && !p2_pipe_skid_ready; p2_skid_ready = (p2_skid_valid)? p2_pipe_skid_ready : !p2_skid_catch; end always @(posedge nvdla_core_clk or negedge nvdla_core_rstn) begin if (!nvdla_core_rstn) begin p2_skid_valid <= 1'b0; p2_skid_ready_flop <= 1'b1; p2_pipe_ready <= 1'b1; end else begin p2_skid_valid <= (p2_skid_valid)? !p2_pipe_skid_ready : p2_skid_catch; p2_skid_ready_flop <= p2_skid_ready; p2_pipe_ready <= p2_skid_ready; end end always @(posedge nvdla_core_clk) begin // VCS sop_coverage_off start p2_skid_data <= (p2_skid_catch)? p2_pipe_data : p2_skid_data; // VCS sop_coverage_off end end always @( p2_skid_ready_flop or p2_pipe_valid or p2_skid_valid or p2_pipe_data or p2_skid_data ) begin p2_pipe_skid_valid = (p2_skid_ready_flop)? p2_pipe_valid : p2_skid_valid; // VCS sop_coverage_off start p2_pipe_skid_data = (p2_skid_ready_flop)? p2_pipe_data : p2_skid_data; // VCS sop_coverage_off end end //## pipe (2) output always @( p2_pipe_skid_valid or spt2cvt_req_ready or p2_pipe_skid_data ) begin spt2cvt_req_valid = p2_pipe_skid_valid; p2_pipe_skid_ready = spt2cvt_req_ready; spt2cvt_req_pd = p2_pipe_skid_data; end //## pipe (2) assertions/testpoints `ifndef VIVA_PLUGIN_PIPE_DISABLE_ASSERTIONS wire p2_assert_clk = nvdla_core_clk; `ifdef SPYGLASS_ASSERT_ON `else // spyglass disable_block NoWidthInBasedNum-ML // spyglass disable_block STARC-2.10.3.2a // spyglass disable_block STARC05-2.1.3.1 // spyglass disable_block STARC-2.1.4.6 // spyglass disable_block W116 // spyglass disable_block W154 // spyglass disable_block W239 // spyglass disable_block W362 // spyglass disable_block WRN_58 // spyglass disable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `ifdef ASSERT_ON `ifdef FV_ASSERT_ON `define ASSERT_RESET nvdla_core_rstn `else `ifdef SYNTHESIS `define ASSERT_RESET nvdla_core_rstn `else `ifdef ASSERT_OFF_RESET_IS_X `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b0 : nvdla_core_rstn) `else `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b1 : nvdla_core_rstn) `endif // ASSERT_OFF_RESET_IS_X `endif // SYNTHESIS `endif // FV_ASSERT_ON `ifndef SYNTHESIS // VCS coverage off nv_assert_no_x #(0,1,0,"No X's allowed on control signals") zzz_assert_no_x_2x (nvdla_core_clk, `ASSERT_RESET, nvdla_core_rstn, (spt2cvt_req_valid^spt2cvt_req_ready^spt_out_vld^spt_out_rdy)); // spyglass disable W504 SelfDeterminedExpr-ML // VCS coverage on `endif `undef ASSERT_RESET `endif // ASSERT_ON `ifdef SPYGLASS_ASSERT_ON `else // spyglass enable_block NoWidthInBasedNum-ML // spyglass enable_block STARC-2.10.3.2a // spyglass enable_block STARC05-2.1.3.1 // spyglass enable_block STARC-2.1.4.6 // spyglass enable_block W116 // spyglass enable_block W154 // spyglass enable_block W239 // spyglass enable_block W362 // spyglass enable_block WRN_58 // spyglass enable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `ifdef SPYGLASS_ASSERT_ON `else // spyglass disable_block NoWidthInBasedNum-ML // spyglass disable_block STARC-2.10.3.2a // spyglass disable_block STARC05-2.1.3.1 // spyglass disable_block STARC-2.1.4.6 // spyglass disable_block W116 // spyglass disable_block W154 // spyglass disable_block W239 // spyglass disable_block W362 // spyglass disable_block WRN_58 // spyglass disable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `ifdef ASSERT_ON `ifdef FV_ASSERT_ON `define ASSERT_RESET nvdla_core_rstn `else `ifdef SYNTHESIS `define ASSERT_RESET nvdla_core_rstn `else `ifdef ASSERT_OFF_RESET_IS_X `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b0 : nvdla_core_rstn) `else `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b1 : nvdla_core_rstn) `endif // ASSERT_OFF_RESET_IS_X `endif // SYNTHESIS `endif // FV_ASSERT_ON // VCS coverage off nv_assert_hold_throughout_event_interval #(0,1,0,"valid removed before ready") zzz_assert_hold_throughout_event_interval_3x (nvdla_core_clk, `ASSERT_RESET, (spt_out_vld && !spt_out_rdy), (spt_out_vld), (spt_out_rdy)); // spyglass disable W504 SelfDeterminedExpr-ML // VCS coverage on `undef ASSERT_RESET `endif // ASSERT_ON `ifdef SPYGLASS_ASSERT_ON `else // spyglass enable_block NoWidthInBasedNum-ML // spyglass enable_block STARC-2.10.3.2a // spyglass enable_block STARC05-2.1.3.1 // spyglass enable_block STARC-2.1.4.6 // spyglass enable_block W116 // spyglass enable_block W154 // spyglass enable_block W239 // spyglass enable_block W362 // spyglass enable_block WRN_58 // spyglass enable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `endif endmodule // NV_NVDLA_NOCIF_READ_IG_spt module NV_NVDLA_NOCIF_DRAM_READ_IG_SPT_pipe_p1 ( nvdla_core_clk ,nvdla_core_rstn ,arb2spt_req_pd ,arb2spt_req_valid ,spt_req_rdy ,arb2spt_req_ready ,spt_req_pd ,spt_req_vld ); input nvdla_core_clk; input nvdla_core_rstn; input [32 +10:0] arb2spt_req_pd; input arb2spt_req_valid; input spt_req_rdy; output arb2spt_req_ready; output [32 +10:0] spt_req_pd; output spt_req_vld; reg arb2spt_req_ready; reg [32 +10:0] p1_pipe_data; reg [32 +10:0] p1_pipe_rand_data; reg p1_pipe_rand_ready; reg p1_pipe_rand_valid; reg p1_pipe_ready; reg p1_pipe_ready_bc; reg p1_pipe_valid; reg [32 +10:0] spt_req_pd; reg spt_req_vld; //## pipe (1) randomizer `ifndef SYNTHESIS reg p1_pipe_rand_active; `endif always @( `ifndef SYNTHESIS p1_pipe_rand_active or `endif arb2spt_req_valid or p1_pipe_rand_ready or arb2spt_req_pd ) begin `ifdef SYNTHESIS p1_pipe_rand_valid = arb2spt_req_valid; arb2spt_req_ready = p1_pipe_rand_ready; p1_pipe_rand_data = arb2spt_req_pd[32 +10:0]; `else // VCS coverage off p1_pipe_rand_valid = (p1_pipe_rand_active)? 1'b0 : arb2spt_req_valid; arb2spt_req_ready = (p1_pipe_rand_active)? 1'b0 : p1_pipe_rand_ready; p1_pipe_rand_data = (p1_pipe_rand_active)? 'bx : arb2spt_req_pd[32 +10:0]; // VCS coverage on `endif end `ifndef SYNTHESIS // VCS coverage off //// randomization init integer p1_pipe_stall_cycles; integer p1_pipe_stall_probability; integer p1_pipe_stall_cycles_min; integer p1_pipe_stall_cycles_max; initial begin p1_pipe_stall_cycles = 0; p1_pipe_stall_probability = 0; p1_pipe_stall_cycles_min = 1; p1_pipe_stall_cycles_max = 10; `ifndef SYNTH_LEVEL1_COMPILE if ( $value$plusargs( "NV_NVDLA_NOCIF_DRAM_READ_IG_spt_pipe_rand_probability=%d", p1_pipe_stall_probability ) ) ; // deprecated else if ( $value$plusargs( "default_pipe_rand_probability=%d", p1_pipe_stall_probability ) ) ; // deprecated if ( $value$plusargs( "NV_NVDLA_NOCIF_DRAM_READ_IG_spt_pipe_stall_probability=%d", p1_pipe_stall_probability ) ) ; else if ( $value$plusargs( "default_pipe_stall_probability=%d", p1_pipe_stall_probability ) ) ; if ( $value$plusargs( "NV_NVDLA_NOCIF_DRAM_READ_IG_spt_pipe_stall_cycles_min=%d", p1_pipe_stall_cycles_min ) ) ; else if ( $value$plusargs( "default_pipe_stall_cycles_min=%d", p1_pipe_stall_cycles_min ) ) ; if ( $value$plusargs( "NV_NVDLA_NOCIF_DRAM_READ_IG_spt_pipe_stall_cycles_max=%d", p1_pipe_stall_cycles_max ) ) ; else if ( $value$plusargs( "default_pipe_stall_cycles_max=%d", p1_pipe_stall_cycles_max ) ) ; `endif end // randomization globals `ifndef SYNTH_LEVEL1_COMPILE `ifdef SIMTOP_RANDOMIZE_STALLS always @( `SIMTOP_RANDOMIZE_STALLS.global_stall_event ) begin if ( ! $test$plusargs( "NV_NVDLA_NOCIF_DRAM_READ_IG_spt_pipe_stall_probability" ) ) p1_pipe_stall_probability = `SIMTOP_RANDOMIZE_STALLS.global_stall_pipe_probability; if ( ! $test$plusargs( "NV_NVDLA_NOCIF_DRAM_READ_IG_spt_pipe_stall_cycles_min" ) ) p1_pipe_stall_cycles_min = `SIMTOP_RANDOMIZE_STALLS.global_stall_pipe_cycles_min; if ( ! $test$plusargs( "NV_NVDLA_NOCIF_DRAM_READ_IG_spt_pipe_stall_cycles_max" ) ) p1_pipe_stall_cycles_max = `SIMTOP_RANDOMIZE_STALLS.global_stall_pipe_cycles_max; end `endif `endif //// randomization active reg p1_pipe_rand_enable; reg p1_pipe_rand_poised; always @( p1_pipe_stall_cycles or p1_pipe_stall_probability or arb2spt_req_valid ) begin p1_pipe_rand_active = p1_pipe_stall_cycles != 0; p1_pipe_rand_enable = p1_pipe_stall_probability != 0; p1_pipe_rand_poised = p1_pipe_rand_enable && !p1_pipe_rand_active && arb2spt_req_valid === 1'b1; end //// randomization cycles always @(posedge nvdla_core_clk or negedge nvdla_core_rstn) begin if (!nvdla_core_rstn) begin p1_pipe_stall_cycles <= 1'b0; end else begin if (p1_pipe_rand_poised) begin if (p1_pipe_stall_probability >= prand_inst0(1, 100)) begin p1_pipe_stall_cycles <= prand_inst1(p1_pipe_stall_cycles_min, p1_pipe_stall_cycles_max); end end else if (p1_pipe_rand_active) begin p1_pipe_stall_cycles <= p1_pipe_stall_cycles - 1; end else begin p1_pipe_stall_cycles <= 0; end end end `ifdef SYNTH_LEVEL1_COMPILE `else `ifdef SYNTHESIS `else `ifdef PRAND_VERILOG // Only verilog needs any local variables reg [47:0] prand_local_seed0; reg prand_initialized0; reg prand_no_rollpli0; `endif `endif `endif function [31:0] prand_inst0; //VCS coverage off input [31:0] min; input [31:0] max; reg [32:0] diff; begin `ifdef SYNTH_LEVEL1_COMPILE prand_inst0 = min; `else `ifdef SYNTHESIS prand_inst0 = min; `else `ifdef PRAND_VERILOG if (prand_initialized0 !== 1'b1) begin prand_no_rollpli0 = $test$plusargs("NO_ROLLPLI"); if (!prand_no_rollpli0) prand_local_seed0 = {$prand_get_seed(0), 16'b0}; prand_initialized0 = 1'b1; end if (prand_no_rollpli0) begin prand_inst0 = min; end else begin diff = max - min + 1; prand_inst0 = min + prand_local_seed0[47:16] % diff; // magic numbers taken from Java's random class (same as lrand48) prand_local_seed0 = prand_local_seed0 * 48'h5deece66d + 48'd11; end `else `ifdef PRAND_OFF prand_inst0 = min; `else prand_inst0 = $RollPLI(min, max, "auto"); `endif `endif `endif `endif end //VCS coverage on endfunction `ifdef SYNTH_LEVEL1_COMPILE `else `ifdef SYNTHESIS `else `ifdef PRAND_VERILOG // Only verilog needs any local variables reg [47:0] prand_local_seed1; reg prand_initialized1; reg prand_no_rollpli1; `endif `endif `endif function [31:0] prand_inst1; //VCS coverage off input [31:0] min; input [31:0] max; reg [32:0] diff; begin `ifdef SYNTH_LEVEL1_COMPILE prand_inst1 = min; `else `ifdef SYNTHESIS prand_inst1 = min; `else `ifdef PRAND_VERILOG if (prand_initialized1 !== 1'b1) begin prand_no_rollpli1 = $test$plusargs("NO_ROLLPLI"); if (!prand_no_rollpli1) prand_local_seed1 = {$prand_get_seed(1), 16'b0}; prand_initialized1 = 1'b1; end if (prand_no_rollpli1) begin prand_inst1 = min; end else begin diff = max - min + 1; prand_inst1 = min + prand_local_seed1[47:16] % diff; // magic numbers taken from Java's random class (same as lrand48) prand_local_seed1 = prand_local_seed1 * 48'h5deece66d + 48'd11; end `else `ifdef PRAND_OFF prand_inst1 = min; `else prand_inst1 = $RollPLI(min, max, "auto"); `endif `endif `endif `endif end //VCS coverage on endfunction `endif // VCS coverage on //## pipe (1) valid-ready-bubble-collapse always @( p1_pipe_ready or p1_pipe_valid ) begin p1_pipe_ready_bc = p1_pipe_ready || !p1_pipe_valid; end always @(posedge nvdla_core_clk or negedge nvdla_core_rstn) begin if (!nvdla_core_rstn) begin p1_pipe_valid <= 1'b0; end else begin p1_pipe_valid <= (p1_pipe_ready_bc)? p1_pipe_rand_valid : 1'd1; end end always @(posedge nvdla_core_clk) begin // VCS sop_coverage_off start p1_pipe_data <= (p1_pipe_ready_bc && p1_pipe_rand_valid)? p1_pipe_rand_data : p1_pipe_data; // VCS sop_coverage_off end end always @( p1_pipe_ready_bc ) begin p1_pipe_rand_ready = p1_pipe_ready_bc; end //## pipe (1) output always @( p1_pipe_valid or spt_req_rdy or p1_pipe_data ) begin spt_req_vld = p1_pipe_valid; p1_pipe_ready = spt_req_rdy; spt_req_pd = p1_pipe_data; end //## pipe (1) assertions/testpoints `ifndef VIVA_PLUGIN_PIPE_DISABLE_ASSERTIONS wire p1_assert_clk = nvdla_core_clk; `ifdef SPYGLASS_ASSERT_ON `else // spyglass disable_block NoWidthInBasedNum-ML // spyglass disable_block STARC-2.10.3.2a // spyglass disable_block STARC05-2.1.3.1 // spyglass disable_block STARC-2.1.4.6 // spyglass disable_block W116 // spyglass disable_block W154 // spyglass disable_block W239 // spyglass disable_block W362 // spyglass disable_block WRN_58 // spyglass disable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `ifdef ASSERT_ON `ifdef FV_ASSERT_ON `define ASSERT_RESET nvdla_core_rstn `else `ifdef SYNTHESIS `define ASSERT_RESET nvdla_core_rstn `else `ifdef ASSERT_OFF_RESET_IS_X `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b0 : nvdla_core_rstn) `else `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b1 : nvdla_core_rstn) `endif // ASSERT_OFF_RESET_IS_X `endif // SYNTHESIS `endif // FV_ASSERT_ON `ifndef SYNTHESIS // VCS coverage off nv_assert_no_x #(0,1,0,"No X's allowed on control signals") zzz_assert_no_x_4x (nvdla_core_clk, `ASSERT_RESET, nvdla_core_rstn, (spt_req_vld^spt_req_rdy^arb2spt_req_valid^arb2spt_req_ready)); // spyglass disable W504 SelfDeterminedExpr-ML // VCS coverage on `endif `undef ASSERT_RESET `endif // ASSERT_ON `ifdef SPYGLASS_ASSERT_ON `else // spyglass enable_block NoWidthInBasedNum-ML // spyglass enable_block STARC-2.10.3.2a // spyglass enable_block STARC05-2.1.3.1 // spyglass enable_block STARC-2.1.4.6 // spyglass enable_block W116 // spyglass enable_block W154 // spyglass enable_block W239 // spyglass enable_block W362 // spyglass enable_block WRN_58 // spyglass enable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `ifdef SPYGLASS_ASSERT_ON `else // spyglass disable_block NoWidthInBasedNum-ML // spyglass disable_block STARC-2.10.3.2a // spyglass disable_block STARC05-2.1.3.1 // spyglass disable_block STARC-2.1.4.6 // spyglass disable_block W116 // spyglass disable_block W154 // spyglass disable_block W239 // spyglass disable_block W362 // spyglass disable_block WRN_58 // spyglass disable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `ifdef ASSERT_ON `ifdef FV_ASSERT_ON `define ASSERT_RESET nvdla_core_rstn `else `ifdef SYNTHESIS `define ASSERT_RESET nvdla_core_rstn `else `ifdef ASSERT_OFF_RESET_IS_X `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b0 : nvdla_core_rstn) `else `define ASSERT_RESET ((1'bx === nvdla_core_rstn) ? 1'b1 : nvdla_core_rstn) `endif // ASSERT_OFF_RESET_IS_X `endif // SYNTHESIS `endif // FV_ASSERT_ON // VCS coverage off nv_assert_hold_throughout_event_interval #(0,1,0,"valid removed before ready") zzz_assert_hold_throughout_event_interval_5x (nvdla_core_clk, `ASSERT_RESET, (arb2spt_req_valid && !arb2spt_req_ready), (arb2spt_req_valid), (arb2spt_req_ready)); // spyglass disable W504 SelfDeterminedExpr-ML // VCS coverage on `undef ASSERT_RESET `endif // ASSERT_ON `ifdef SPYGLASS_ASSERT_ON `else // spyglass enable_block NoWidthInBasedNum-ML // spyglass enable_block STARC-2.10.3.2a // spyglass enable_block STARC05-2.1.3.1 // spyglass enable_block STARC-2.1.4.6 // spyglass enable_block W116 // spyglass enable_block W154 // spyglass enable_block W239 // spyglass enable_block W362 // spyglass enable_block WRN_58 // spyglass enable_block WRN_61 `endif // SPYGLASS_ASSERT_ON `endif endmodule // NV_NVDLA_NOCIF_DRAM_READ_IG_SPT_pipe_p1