// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: niu_zcp_tt_sm.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 ============================================
/***************************************************************
* File Name : niu_zcp_tt_sm.v
* Copyright (c) 2020, Sun Microsystems, Inc.
* Sun Proprietary and Confidential
* Design Notes: When adding more CAL states DON'T forget to
**************************************************************/
tt_rd_en0, tt_rd_en1, tt_rd_en2, tt_rd_en3, tt_rd_en4, wb_tt0,
wb_tt1, decode_default_rdc, decode_table_rdc, decode_zc_rdc,
tt_active, tt_sm_rw, ld_cal_results, tt_fail, buf_req, wr_2words,
clk, reset10, kickoff_tt, tt_ok_reg, tt_en, zc_mode, buf_req_ok
output decode_default_rdc;
output [31:0] ld_cal_results;
wire [31:0] ld_cal_results;
wr_2words , // bypass_mode, tt_fail
wr_4words , // ~tt_fail => do 4 writes to cfifo.
parameter IDLE = 4'b0_000,
always @ (/*AUTOSENSE*/buf_req_ok or kickoff_tt or tt_en or tt_ok_reg
casex (tt_state) // synopsys parallel_case full_case
nx_tt_state = RD_TT; // tt_en and good
p1_tt_rd_en = 1; // tt_rd_en is register to latch va,dn,st ram.
nx_tt_state = tt_state; // stay
//----- TCP mode and successful tests -----------------
RD_TT: begin // tt_rd_en = 1 (registered)
nx_tt_state = CHK_RESULT;
CHK_RESULT: // handle is ready
buf_req = tt_ok_reg[1] & buf_req_ok;
wr_4words = tt_ok_reg[2];
wr_2words = ~tt_ok_reg[3];
//----- BYPASS mode tests -------------------
//----- default stuff ----------------------------------------
// synopsys translate_off
$display("(* ERROR: at sim time = %d, niu_zcp_tt_sm is in forbidden state *) \n", $time);
endcase // casex(tt_state)
zcp_RegRst #(4) tt_state_RegRst(.din(nx_tt_state[3:0]),
zcp_RegDff #(5) tt_rd_en_RegDff(.din({5{p1_tt_rd_en}}),.clk(clk),.qout({tt_rd_en4,tt_rd_en3,tt_rd_en2,tt_rd_en1,tt_rd_en0}));
zcp_RegDff #(32) tt_state_RegDff(.din({32{p1_ld_cal_results}}),.clk(clk),.qout(ld_cal_results[31:0]));
endmodule // niu_zcp_tt_sm