// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: itlb_rd.v
// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// For the avoidance of doubt, and except that if any non-GPL license
// choice is available it will apply instead, Sun elects to use only
// the General Public License version 2 (GPLv2) at this time for any
// software where a choice of GPL license versions is made
// available with the language indicating that GPLv2 or any later version
// may be used, or where a choice of which version of the GPL is applied is
// otherwise unspecified.
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or
// ========== Copyright Header End ============================================
parameter WIDTH = `TLB_FIFO_WIDTH;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b;
wire [(`TS_WIDTH-1):0] ts_b;
reg [(`TS_WIDTH-1):0] tstamp;
ready = `PARGS.tlb_sync_on;
assign newtid = ((mytg*4) + tid_b);
assign newtnum = (mycid * 8) + newtid;
//----------------------------------------------------------
assign tid_d = mytg ? `SPC0.dec.dec_tid1_d :
assign inst_d = mytg ? `SPC0.dec.dec_decode1_d :
assign inst_b = mytg ? |(`PROBES0.select_pc_b[7:4]) :
|(`PROBES0.select_pc_b[3:0]);
assign pc_b = mytg ? `PROBES0.pc_1_b :
assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0];
assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9];
assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1];
//----------------------------------------------------------
//----------------------------------------------------------
always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // {
2'b00: itlb_pipe_d = itlb_pipe_d0;
2'b01: itlb_pipe_d = itlb_pipe_d1;
2'b10: itlb_pipe_d = itlb_pipe_d2;
2'b11: itlb_pipe_d = itlb_pipe_d3;
//----------------------------------------------------------
always @ (posedge `SPC0.l2clk & ready) begin // {
tstamp = `TOP.core_cycle_cnt - 1;
// if POR|WMR, then no TLBread
if (`TOP.in_reset_core) begin // {
// flush pipeline during reset
//---------------------------------
itlb_pipe_e <= inst_d ? itlb_pipe_d : 0;
itlb_pipe_m <= itlb_pipe_e;
itlb_pipe_b <= itlb_pipe_m;
tid_e <= inst_d ? tid_d : 0;
//---------------------------------
`PR_ERROR ("tlb_sync", `ERROR,
"C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.",
// Must suppress PLI_ITLBREAD messages if th_check_enable=0.
// This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap).
// So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs.
if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core0[newtid]) begin // {
`PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h",
mycid,newtid,newtnum,ts_b,pc_b);
junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b);
if (`PARGS.show_tlb_on) begin // {
$display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d",
mycid,newtid,pc_b,ts_b*`TOP.core_period);
//----------------------------------------------------------
parameter WIDTH = `TLB_FIFO_WIDTH;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b;
wire [(`TS_WIDTH-1):0] ts_b;
reg [(`TS_WIDTH-1):0] tstamp;
ready = `PARGS.tlb_sync_on;
assign newtid = ((mytg*4) + tid_b);
assign newtnum = (mycid * 8) + newtid;
//----------------------------------------------------------
assign tid_d = mytg ? `SPC1.dec.dec_tid1_d :
assign inst_d = mytg ? `SPC1.dec.dec_decode1_d :
assign inst_b = mytg ? |(`PROBES1.select_pc_b[7:4]) :
|(`PROBES1.select_pc_b[3:0]);
assign pc_b = mytg ? `PROBES1.pc_1_b :
assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0];
assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9];
assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1];
//----------------------------------------------------------
//----------------------------------------------------------
always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // {
2'b00: itlb_pipe_d = itlb_pipe_d0;
2'b01: itlb_pipe_d = itlb_pipe_d1;
2'b10: itlb_pipe_d = itlb_pipe_d2;
2'b11: itlb_pipe_d = itlb_pipe_d3;
//----------------------------------------------------------
always @ (posedge `SPC1.l2clk & ready) begin // {
tstamp = `TOP.core_cycle_cnt - 1;
// if POR|WMR, then no TLBread
if (`TOP.in_reset_core) begin // {
// flush pipeline during reset
//---------------------------------
itlb_pipe_e <= inst_d ? itlb_pipe_d : 0;
itlb_pipe_m <= itlb_pipe_e;
itlb_pipe_b <= itlb_pipe_m;
tid_e <= inst_d ? tid_d : 0;
//---------------------------------
`PR_ERROR ("tlb_sync", `ERROR,
"C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.",
// Must suppress PLI_ITLBREAD messages if th_check_enable=0.
// This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap).
// So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs.
if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core1[newtid]) begin // {
`PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h",
mycid,newtid,newtnum,ts_b,pc_b);
junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b);
if (`PARGS.show_tlb_on) begin // {
$display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d",
mycid,newtid,pc_b,ts_b*`TOP.core_period);
//----------------------------------------------------------
parameter WIDTH = `TLB_FIFO_WIDTH;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b;
wire [(`TS_WIDTH-1):0] ts_b;
reg [(`TS_WIDTH-1):0] tstamp;
ready = `PARGS.tlb_sync_on;
assign newtid = ((mytg*4) + tid_b);
assign newtnum = (mycid * 8) + newtid;
//----------------------------------------------------------
assign tid_d = mytg ? `SPC2.dec.dec_tid1_d :
assign inst_d = mytg ? `SPC2.dec.dec_decode1_d :
assign inst_b = mytg ? |(`PROBES2.select_pc_b[7:4]) :
|(`PROBES2.select_pc_b[3:0]);
assign pc_b = mytg ? `PROBES2.pc_1_b :
assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0];
assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9];
assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1];
//----------------------------------------------------------
//----------------------------------------------------------
always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // {
2'b00: itlb_pipe_d = itlb_pipe_d0;
2'b01: itlb_pipe_d = itlb_pipe_d1;
2'b10: itlb_pipe_d = itlb_pipe_d2;
2'b11: itlb_pipe_d = itlb_pipe_d3;
//----------------------------------------------------------
always @ (posedge `SPC2.l2clk & ready) begin // {
tstamp = `TOP.core_cycle_cnt - 1;
// if POR|WMR, then no TLBread
if (`TOP.in_reset_core) begin // {
// flush pipeline during reset
//---------------------------------
itlb_pipe_e <= inst_d ? itlb_pipe_d : 0;
itlb_pipe_m <= itlb_pipe_e;
itlb_pipe_b <= itlb_pipe_m;
tid_e <= inst_d ? tid_d : 0;
//---------------------------------
`PR_ERROR ("tlb_sync", `ERROR,
"C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.",
// Must suppress PLI_ITLBREAD messages if th_check_enable=0.
// This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap).
// So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs.
if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core2[newtid]) begin // {
`PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h",
mycid,newtid,newtnum,ts_b,pc_b);
junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b);
if (`PARGS.show_tlb_on) begin // {
$display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d",
mycid,newtid,pc_b,ts_b*`TOP.core_period);
//----------------------------------------------------------
parameter WIDTH = `TLB_FIFO_WIDTH;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b;
wire [(`TS_WIDTH-1):0] ts_b;
reg [(`TS_WIDTH-1):0] tstamp;
ready = `PARGS.tlb_sync_on;
assign newtid = ((mytg*4) + tid_b);
assign newtnum = (mycid * 8) + newtid;
//----------------------------------------------------------
assign tid_d = mytg ? `SPC3.dec.dec_tid1_d :
assign inst_d = mytg ? `SPC3.dec.dec_decode1_d :
assign inst_b = mytg ? |(`PROBES3.select_pc_b[7:4]) :
|(`PROBES3.select_pc_b[3:0]);
assign pc_b = mytg ? `PROBES3.pc_1_b :
assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0];
assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9];
assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1];
//----------------------------------------------------------
//----------------------------------------------------------
always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // {
2'b00: itlb_pipe_d = itlb_pipe_d0;
2'b01: itlb_pipe_d = itlb_pipe_d1;
2'b10: itlb_pipe_d = itlb_pipe_d2;
2'b11: itlb_pipe_d = itlb_pipe_d3;
//----------------------------------------------------------
always @ (posedge `SPC3.l2clk & ready) begin // {
tstamp = `TOP.core_cycle_cnt - 1;
// if POR|WMR, then no TLBread
if (`TOP.in_reset_core) begin // {
// flush pipeline during reset
//---------------------------------
itlb_pipe_e <= inst_d ? itlb_pipe_d : 0;
itlb_pipe_m <= itlb_pipe_e;
itlb_pipe_b <= itlb_pipe_m;
tid_e <= inst_d ? tid_d : 0;
//---------------------------------
`PR_ERROR ("tlb_sync", `ERROR,
"C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.",
// Must suppress PLI_ITLBREAD messages if th_check_enable=0.
// This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap).
// So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs.
if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core3[newtid]) begin // {
`PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h",
mycid,newtid,newtnum,ts_b,pc_b);
junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b);
if (`PARGS.show_tlb_on) begin // {
$display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d",
mycid,newtid,pc_b,ts_b*`TOP.core_period);
//----------------------------------------------------------
parameter WIDTH = `TLB_FIFO_WIDTH;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b;
wire [(`TS_WIDTH-1):0] ts_b;
reg [(`TS_WIDTH-1):0] tstamp;
ready = `PARGS.tlb_sync_on;
assign newtid = ((mytg*4) + tid_b);
assign newtnum = (mycid * 8) + newtid;
//----------------------------------------------------------
assign tid_d = mytg ? `SPC4.dec.dec_tid1_d :
assign inst_d = mytg ? `SPC4.dec.dec_decode1_d :
assign inst_b = mytg ? |(`PROBES4.select_pc_b[7:4]) :
|(`PROBES4.select_pc_b[3:0]);
assign pc_b = mytg ? `PROBES4.pc_1_b :
assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0];
assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9];
assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1];
//----------------------------------------------------------
//----------------------------------------------------------
always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // {
2'b00: itlb_pipe_d = itlb_pipe_d0;
2'b01: itlb_pipe_d = itlb_pipe_d1;
2'b10: itlb_pipe_d = itlb_pipe_d2;
2'b11: itlb_pipe_d = itlb_pipe_d3;
//----------------------------------------------------------
always @ (posedge `SPC4.l2clk & ready) begin // {
tstamp = `TOP.core_cycle_cnt - 1;
// if POR|WMR, then no TLBread
if (`TOP.in_reset_core) begin // {
// flush pipeline during reset
//---------------------------------
itlb_pipe_e <= inst_d ? itlb_pipe_d : 0;
itlb_pipe_m <= itlb_pipe_e;
itlb_pipe_b <= itlb_pipe_m;
tid_e <= inst_d ? tid_d : 0;
//---------------------------------
`PR_ERROR ("tlb_sync", `ERROR,
"C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.",
// Must suppress PLI_ITLBREAD messages if th_check_enable=0.
// This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap).
// So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs.
if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core4[newtid]) begin // {
`PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h",
mycid,newtid,newtnum,ts_b,pc_b);
junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b);
if (`PARGS.show_tlb_on) begin // {
$display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d",
mycid,newtid,pc_b,ts_b*`TOP.core_period);
//----------------------------------------------------------
parameter WIDTH = `TLB_FIFO_WIDTH;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b;
wire [(`TS_WIDTH-1):0] ts_b;
reg [(`TS_WIDTH-1):0] tstamp;
ready = `PARGS.tlb_sync_on;
assign newtid = ((mytg*4) + tid_b);
assign newtnum = (mycid * 8) + newtid;
//----------------------------------------------------------
assign tid_d = mytg ? `SPC5.dec.dec_tid1_d :
assign inst_d = mytg ? `SPC5.dec.dec_decode1_d :
assign inst_b = mytg ? |(`PROBES5.select_pc_b[7:4]) :
|(`PROBES5.select_pc_b[3:0]);
assign pc_b = mytg ? `PROBES5.pc_1_b :
assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0];
assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9];
assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1];
//----------------------------------------------------------
//----------------------------------------------------------
always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // {
2'b00: itlb_pipe_d = itlb_pipe_d0;
2'b01: itlb_pipe_d = itlb_pipe_d1;
2'b10: itlb_pipe_d = itlb_pipe_d2;
2'b11: itlb_pipe_d = itlb_pipe_d3;
//----------------------------------------------------------
always @ (posedge `SPC5.l2clk & ready) begin // {
tstamp = `TOP.core_cycle_cnt - 1;
// if POR|WMR, then no TLBread
if (`TOP.in_reset_core) begin // {
// flush pipeline during reset
//---------------------------------
itlb_pipe_e <= inst_d ? itlb_pipe_d : 0;
itlb_pipe_m <= itlb_pipe_e;
itlb_pipe_b <= itlb_pipe_m;
tid_e <= inst_d ? tid_d : 0;
//---------------------------------
`PR_ERROR ("tlb_sync", `ERROR,
"C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.",
// Must suppress PLI_ITLBREAD messages if th_check_enable=0.
// This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap).
// So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs.
if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core5[newtid]) begin // {
`PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h",
mycid,newtid,newtnum,ts_b,pc_b);
junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b);
if (`PARGS.show_tlb_on) begin // {
$display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d",
mycid,newtid,pc_b,ts_b*`TOP.core_period);
//----------------------------------------------------------
parameter WIDTH = `TLB_FIFO_WIDTH;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b;
wire [(`TS_WIDTH-1):0] ts_b;
reg [(`TS_WIDTH-1):0] tstamp;
ready = `PARGS.tlb_sync_on;
assign newtid = ((mytg*4) + tid_b);
assign newtnum = (mycid * 8) + newtid;
//----------------------------------------------------------
assign tid_d = mytg ? `SPC6.dec.dec_tid1_d :
assign inst_d = mytg ? `SPC6.dec.dec_decode1_d :
assign inst_b = mytg ? |(`PROBES6.select_pc_b[7:4]) :
|(`PROBES6.select_pc_b[3:0]);
assign pc_b = mytg ? `PROBES6.pc_1_b :
assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0];
assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9];
assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1];
//----------------------------------------------------------
//----------------------------------------------------------
always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // {
2'b00: itlb_pipe_d = itlb_pipe_d0;
2'b01: itlb_pipe_d = itlb_pipe_d1;
2'b10: itlb_pipe_d = itlb_pipe_d2;
2'b11: itlb_pipe_d = itlb_pipe_d3;
//----------------------------------------------------------
always @ (posedge `SPC6.l2clk & ready) begin // {
tstamp = `TOP.core_cycle_cnt - 1;
// if POR|WMR, then no TLBread
if (`TOP.in_reset_core) begin // {
// flush pipeline during reset
//---------------------------------
itlb_pipe_e <= inst_d ? itlb_pipe_d : 0;
itlb_pipe_m <= itlb_pipe_e;
itlb_pipe_b <= itlb_pipe_m;
tid_e <= inst_d ? tid_d : 0;
//---------------------------------
`PR_ERROR ("tlb_sync", `ERROR,
"C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.",
// Must suppress PLI_ITLBREAD messages if th_check_enable=0.
// This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap).
// So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs.
if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core6[newtid]) begin // {
`PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h",
mycid,newtid,newtnum,ts_b,pc_b);
junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b);
if (`PARGS.show_tlb_on) begin // {
$display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d",
mycid,newtid,pc_b,ts_b*`TOP.core_period);
//----------------------------------------------------------
parameter WIDTH = `TLB_FIFO_WIDTH;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d0;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d1;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d2;
input [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d3;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_d;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_e;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_m;
reg [(`TLB_FIFO_WIDTH-1):0] itlb_pipe_b;
wire [(`TS_WIDTH-1):0] ts_b;
reg [(`TS_WIDTH-1):0] tstamp;
ready = `PARGS.tlb_sync_on;
assign newtid = ((mytg*4) + tid_b);
assign newtnum = (mycid * 8) + newtid;
//----------------------------------------------------------
assign tid_d = mytg ? `SPC7.dec.dec_tid1_d :
assign inst_d = mytg ? `SPC7.dec.dec_decode1_d :
assign inst_b = mytg ? |(`PROBES7.select_pc_b[7:4]) :
|(`PROBES7.select_pc_b[3:0]);
assign pc_b = mytg ? `PROBES7.pc_1_b :
assign ts_b = itlb_pipe_b[(`TS_WIDTH-1):0];
assign ifu_err_vect = itlb_pipe_b[`TLB_FIFO_WIDTH-2:`TLB_FIFO_WIDTH-9];
assign ifu_err_vld = itlb_pipe_b[`TLB_FIFO_WIDTH-1];
//----------------------------------------------------------
//----------------------------------------------------------
always @ (tid_d or itlb_pipe_d0 or itlb_pipe_d1 or itlb_pipe_d2 or itlb_pipe_d3) begin // {
2'b00: itlb_pipe_d = itlb_pipe_d0;
2'b01: itlb_pipe_d = itlb_pipe_d1;
2'b10: itlb_pipe_d = itlb_pipe_d2;
2'b11: itlb_pipe_d = itlb_pipe_d3;
//----------------------------------------------------------
always @ (posedge `SPC7.l2clk & ready) begin // {
tstamp = `TOP.core_cycle_cnt - 1;
// if POR|WMR, then no TLBread
if (`TOP.in_reset_core) begin // {
// flush pipeline during reset
//---------------------------------
itlb_pipe_e <= inst_d ? itlb_pipe_d : 0;
itlb_pipe_m <= itlb_pipe_e;
itlb_pipe_b <= itlb_pipe_m;
tid_e <= inst_d ? tid_d : 0;
//---------------------------------
`PR_ERROR ("tlb_sync", `ERROR,
"C%0d T%0d nas_probes/select_pc_b is asserted, but there is not a valid instruction in B stage for this thread.",
// Must suppress PLI_ITLBREAD messages if th_check_enable=0.
// This is required since the bench stops sending SSTEPs after th_check_enable=0 (on good/bad trap).
// So, Bench must also stop sending ITLBREADs. Without SSTEPs, Riesling will not pop any ITLBREADs.
if (`PARGS.nas_check_on && `PARGS.tlb_sync_on && `PARGS.th_check_enable[newtnum] && `TOP.tlb_sync.nas_pipe_enabled_core7[newtid]) begin // {
`PR_INFO ("pli_tlb", `INFO, "C%0d T%0d PLI_ITLBREAD tid=%d ts=%0d pc=%h",
mycid,newtid,newtnum,ts_b,pc_b);
junk = $sim_send(`PLI_ITLBREAD, newtnum,ts_b);
if (`PARGS.show_tlb_on) begin // {
$display ("SHOW_TLB: ITLB_READ C%0d T%0d pc=%h ts=%0d",
mycid,newtid,pc_b,ts_b*`TOP.core_period);
//----------------------------------------------------------
//----------------------------------------------------------
//----------------------------------------------------------