// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: ccu_cmp_dr_sync.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 ============================================
reg [3:0] agg_k; // aggregate for k=0,1,2,3
reg [3:0] dtm_agg_k; // aggregate for k=0,1,2,3 for DTM
// only one set of ratios is active
assign func_ratio = ccu_serdes_dtm ? 5'b0 : ratio;
assign dtm_ratio = ccu_serdes_dtm ? ratio : 5'b0 ;
// this causes the aggregates of that set to be quiescent
assign pulse = (align_shift == 2'b10) ? pulse_minus1 :
(align_shift == 2'b01) ? pulse_plus1 : pulse_nom ;
always @ (posedge clk) begin
pulse_minus1 <= (| (agg_k | dtm_agg_k)) ; // pulse is OR of any pulse @k
pulse_nom <= pulse_minus1; // code ensures only one set of
pulse_plus1 <= pulse_nom; // pulses is active at any time
// pulse counter starting from align
always @ (posedge clk) begin
// PULSE POSITIONS @ CCU BOUNDARY
// ==============================
// cmp:dr Binary K -> slow clk cycles
// -----------------------------------------
// cmp:dr Binary K -> slow clk cycles
// -----------------------------------------
// 15.00 1110 12 12 12 12
// pulse gen from counter (combo logic)
always @ (cnt or func_ratio) begin
5'b01000: // 010 00 => 2.00
5'b01001: // 010 01 => 2.25
5'b01010: // 010 10 => 2.50
5'b01011: // 010 11 => 2.75
5'b01100: // 011 00 => 3.00
5'b01101: // 011 01 => 3.25
5'b01110: // 011 10 => 3.50
5'b01111: // 011 11 => 3.75
5'b10000: // 100 00 => 4.00
5'b10001: // 100 01 => 4.25
5'b10010: // 100 10 => 4.50
5'b10011: // 100 11 => 4.75
5'b10100: // 101 00 => 5.00
5'b10101: // 101 01 => 5.25
default: agg_k = 4'h0; // no pulses
// pulse gen from counter (combo logic)
always @ (cnt or dtm_ratio) begin
5'd02: dtm_agg_k = 4'b0001; // same cnt applies to k=1,2,3
default: dtm_agg_k = 4'h0;
5'b01010: // 0_1010 => 11
5'd06: dtm_agg_k = 4'b0001; // same cnt applies to k=1,2,3
default: dtm_agg_k = 4'h0;
5'b01110: // 0_1110 => 15
5'd12: dtm_agg_k = 4'b0001; // same cnt applies to k=1,2,3
default: dtm_agg_k = 4'h0;
default: dtm_agg_k = 4'h0; // no pulses