source: XOpenSparcT1/trunk/T1-CPU/lsu/lsu_pcx_qmon.v @ 6

Revision 6, 4.9 KB checked in by pntsvt00, 13 years ago (diff)

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: lsu_pcx_qmon.v
4// Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21////////////////////////////////////////////////////////////////////////
22/*
23//      Description:    Monitors queue state of pcx.
24*/
25////////////////////////////////////////////////////////////////////////
26// Global header file includes
27////////////////////////////////////////////////////////////////////////
28`include        "sys.h" // system level definition file which contains the
29                                        // time scale definition
30
31////////////////////////////////////////////////////////////////////////
32// Local header file includes / local defines
33////////////////////////////////////////////////////////////////////////
34
35module lsu_pcx_qmon (/*AUTOARG*/
36   // Outputs
37   so, qwrite, sel_qentry0, 
38   // Inputs
39   rclk, grst_l, arst_l, si, se, send_by_pcx, send_to_pcx
40   ) ;                                         
41
42input           rclk ;
43input           grst_l;
44input           arst_l;
45input           si;
46input           se;
47output          so;
48
49input   send_by_pcx ;           // PCX sends packet to dest.
50input   send_to_pcx ;           // SKB sends packet to PCX.
51       
52output  qwrite ;                // PCX queue is writable.
53output  sel_qentry0 ;           // entry to be written.
54
55wire       clk;
56wire    reset ,dbb_reset_l ;
57wire    entry0_rst, entry1_rst ;
58wire    entry0_en, entry1_en ;
59wire    entry0_din, entry1_din ;
60wire    entry0_full,entry1_full;
61
62    dffrl_async rstff(.din (grst_l),
63                        .q   (dbb_reset_l),
64                        .clk (clk), .se(se), .si(), .so(),
65                        .rst_l (arst_l));
66
67assign  reset =  ~dbb_reset_l;
68assign  clk = rclk;
69
70
71//======================================================================================
72//
73//      Queue Monitor
74//
75//======================================================================================
76
77//
78//      Pipeline :
79//--------------------------------------------------------------------------------------
80//
81//      | req to pcx    | payload to pcx|               |               |
82//      | qfull=0       |   arb/grant=1 |               |               |
83//      | qentry=1      |               |               |               |
84//      |               |               |               |               |
85//      |               | req to pcx    | payload to pcx|               |
86//      |               | qfull=0       |   arb/grant=0 |               |
87//      |               | qentry=2      |               |               |
88//      |               |               | req to pcx    | payload to pcx|
89//      |               |               | qfull=0       |     arb/grant |
90//
91//     
92
93
94// OPERATION :
95// Monitors state per 2 input queue of pcx for given processor.
96// - Implemented as FIFO.
97// - The queue is cleared on reset.
98// - A packet sent from the core to pcx will set a bit in the
99// corresponding logical queue entry.
100// - A packet sent from pcx to dest, will cause entry0 to be cleared.
101// Only entry0 need be cleared as entry1 will shift to entry0 on
102// a grant by the pcx.
103// - The queue will never overflow as a packet will never be sent
104// from the skb to the pcx unless at least one queue entry is free.
105// Timing : May have to flop grant and then use it.
106
107assign entry0_rst =     reset | 
108                        (send_by_pcx & ~entry0_en) ;            // pcx sends to dest.
109assign entry0_en  =     ( entry1_full & send_by_pcx)    |       // shift entry1 to entry0
110                        (~(entry0_full & ~send_by_pcx) & send_to_pcx) ;         
111assign entry0_din =     entry0_en ;
112
113// represents oldest packet.
114dffre_s  qstate_entry0 (
115        .din    (entry0_din), .(entry0_full),
116        .rst    (entry0_rst), .en (entry0_en), .clk (clk),
117        .se     (1'b0),       .si (),          .so ()
118        );
119
120assign entry1_rst =     reset | 
121                        (send_by_pcx & ~entry1_en) ;
122assign entry1_en  =     entry0_full & send_to_pcx
123                        & ~(send_by_pcx & ~entry1_full) ; // new packet to entry1
124assign entry1_din =     entry1_en ;
125
126// represents youngest packet.
127dffre_s  qstate_entry1 (
128        .din    (entry1_din), .(entry1_full),
129        .rst    (entry1_rst), .en (entry1_en),  .clk (clk),
130        .se     (1'b0), .si     (), .so ()
131        );
132
133assign qwrite = ~entry1_full ; 
134                //(entry1_full & send_by_pcx) ;         // look at top of stack only.
135assign sel_qentry0 = 
136        (~entry0_full & ~send_to_pcx) ; 
137        //(~entry0_full |
138        //(~entry1_full & entry0_full & send_by_pcx)) & ~send_to_pcx ;                                 
139                                                                        // select which entry to write.
140
141endmodule
Note: See TracBrowser for help on using the repository browser.