1 |
2 |
dmitryr |
// ========== Copyright Header Begin ==========================================
|
2 |
|
|
//
|
3 |
|
|
// OpenSPARC T1 Processor File: ucb_bus_out.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 |
|
|
// Module Name: ucb_bus_out (ucb bus outbound interface block)
|
24 |
|
|
// Description: This interface block is instantiated by the
|
25 |
|
|
// UCB modules and IO Bridge to transmit packets
|
26 |
|
|
// on the UCB bus.
|
27 |
|
|
*/
|
28 |
|
|
////////////////////////////////////////////////////////////////////////
|
29 |
|
|
// Global header file includes
|
30 |
|
|
////////////////////////////////////////////////////////////////////////
|
31 |
|
|
`include "sys.h" // system level definition file which
|
32 |
|
|
// contains the time scale definition
|
33 |
|
|
|
34 |
|
|
////////////////////////////////////////////////////////////////////////
|
35 |
|
|
// Local header file includes / local defines
|
36 |
|
|
////////////////////////////////////////////////////////////////////////
|
37 |
|
|
|
38 |
|
|
module ucb_bus_out (/*AUTOARG*/
|
39 |
|
|
// Outputs
|
40 |
|
|
vld, data, outdata_buf_busy,
|
41 |
|
|
// Inputs
|
42 |
|
|
clk, rst_l, stall, outdata_buf_in, outdata_vec_in, outdata_buf_wr
|
43 |
|
|
);
|
44 |
|
|
|
45 |
|
|
// synopsys template
|
46 |
|
|
|
47 |
|
|
parameter UCB_BUS_WIDTH = 32;
|
48 |
|
|
parameter REG_WIDTH = 64; // maximum data bits that needs to
|
49 |
|
|
// be sent. Set to 64 or 128
|
50 |
|
|
|
51 |
|
|
// Globals
|
52 |
|
|
input clk;
|
53 |
|
|
input rst_l;
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
// UCB bus interface
|
57 |
|
|
output vld;
|
58 |
|
|
output [UCB_BUS_WIDTH-1:0] data;
|
59 |
|
|
input stall;
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
// Local interface
|
63 |
|
|
output outdata_buf_busy;
|
64 |
|
|
input [REG_WIDTH+63:0] outdata_buf_in;
|
65 |
|
|
input [(REG_WIDTH+64)/UCB_BUS_WIDTH-1:0] outdata_vec_in;
|
66 |
|
|
input outdata_buf_wr;
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
// Local signals
|
70 |
|
|
wire stall_d1;
|
71 |
|
|
wire [(REG_WIDTH+64)/UCB_BUS_WIDTH-1:0] outdata_vec;
|
72 |
|
|
wire [(REG_WIDTH+64)/UCB_BUS_WIDTH-1:0] outdata_vec_next;
|
73 |
|
|
wire [REG_WIDTH+63:0] outdata_buf;
|
74 |
|
|
wire [REG_WIDTH+63:0] outdata_buf_next;
|
75 |
|
|
wire load_outdata;
|
76 |
|
|
wire shift_outdata;
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
////////////////////////////////////////////////////////////////////////
|
80 |
|
|
// Code starts here
|
81 |
|
|
////////////////////////////////////////////////////////////////////////
|
82 |
|
|
/************************************************************
|
83 |
|
|
* UCB bus interface flops
|
84 |
|
|
************************************************************/
|
85 |
|
|
assign vld = outdata_vec[0];
|
86 |
|
|
assign data = outdata_buf[UCB_BUS_WIDTH-1:0];
|
87 |
|
|
|
88 |
|
|
dffrl_ns #(1) stall_d1_ff (.din(stall),
|
89 |
|
|
.clk(clk),
|
90 |
|
|
.rst_l(rst_l),
|
91 |
|
|
.q(stall_d1));
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
/************************************************************
|
95 |
|
|
* Outbound Data
|
96 |
|
|
************************************************************/
|
97 |
|
|
// accept new data only if there is none being processed
|
98 |
|
|
assign load_outdata = outdata_buf_wr & ~outdata_buf_busy;
|
99 |
|
|
|
100 |
|
|
assign outdata_buf_busy = outdata_vec[0] | stall_d1;
|
101 |
|
|
|
102 |
|
|
assign shift_outdata = outdata_vec[0] & ~stall_d1;
|
103 |
|
|
|
104 |
|
|
assign outdata_vec_next =
|
105 |
|
|
load_outdata ? outdata_vec_in:
|
106 |
|
|
shift_outdata ? outdata_vec >> 1:
|
107 |
|
|
outdata_vec;
|
108 |
|
|
dffrl_ns #((REG_WIDTH+64)/UCB_BUS_WIDTH) outdata_vec_ff (.din(outdata_vec_next),
|
109 |
|
|
.clk(clk),
|
110 |
|
|
.rst_l(rst_l),
|
111 |
|
|
.q(outdata_vec));
|
112 |
|
|
|
113 |
|
|
assign outdata_buf_next =
|
114 |
|
|
load_outdata ? outdata_buf_in:
|
115 |
|
|
shift_outdata ? (outdata_buf >> UCB_BUS_WIDTH):
|
116 |
|
|
outdata_buf;
|
117 |
|
|
dff_ns #(REG_WIDTH+64) outdata_buf_ff (.din(outdata_buf_next),
|
118 |
|
|
.clk(clk),
|
119 |
|
|
.q(outdata_buf));
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
endmodule // ucb_bus_out
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|