OpenCores
URL https://opencores.org/ocsvn/pci/pci/trunk

Subversion Repositories pci

[/] [pci/] [tags/] [rel_8/] [apps/] [crt/] [rtl/] [verilog/] [ssvga_wbs_if.v] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mihad
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Simple Small VGA IP Core                                    ////
4
////                                                              ////
5
////  This file is part of the Simple Small VGA project           ////
6
////                                                              ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  LITTLE-ENDIAN WISHBONE slave interface.                     ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   Nothing                                                    ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Damjan Lampret, lampret@opencores.org                 ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// CVS Revision History
45
//
46
// $Log: not supported by cvs2svn $
47 21 mihad
// Revision 1.1.1.1  2001/10/02 15:33:33  mihad
48
// New project directory structure
49 2 mihad
//
50 21 mihad
//
51 2 mihad
 
52
// synopsys translate_off
53
`include "timescale.v"
54
// synopsys translate_on
55
 
56
`define SEL_PAL 10
57
`define SEL_ADDRESS 2
58
 
59
module ssvga_wbs_if(
60
        // Clock and reset
61
        wb_clk_i, wb_rst_i,
62 21 mihad
 
63 2 mihad
        // WISHBONE Slave I/F
64
        wbs_cyc_i, wbs_stb_i, wbs_sel_i, wbs_we_i,
65
        wbs_adr_i, wbs_dat_i, wbs_cab_i,
66
        wbs_dat_o, wbs_ack_o, wbs_err_o, wbs_rty_o,
67
 
68
        // Other signals
69
        ssvga_en, pal_wr_en, pal_rd_en, pal_dat,
70
    pix_start_addr
71
);
72
 
73
//
74
// I/O ports
75
//
76
 
77
//
78
// Clock and reset
79
//
80
input                   wb_clk_i;       // Pixel Clock
81
input                   wb_rst_i;       // Reset
82
 
83
//
84
// WISHBONE Slave I/F
85
//
86
input                   wbs_cyc_i;
87
input                   wbs_stb_i;
88
input   [3:0]            wbs_sel_i;
89
input                   wbs_we_i;
90
input   [31:0]           wbs_adr_i;
91
input   [31:0]           wbs_dat_i;
92
input                   wbs_cab_i;
93
output  [31:0]           wbs_dat_o;
94
output                  wbs_ack_o;
95
output                  wbs_err_o;
96
output                  wbs_rty_o;
97
 
98
//
99
// Other signals
100
//
101
output                  ssvga_en;       // Global enable
102
output                  pal_wr_en;      // Palette write enable
103
output                  pal_rd_en;      // Palette read enable
104
input   [15:0]           pal_dat;        // Palette data
105
output  [31:2] pix_start_addr ;
106
 
107
//
108
// Internal regs and wires
109
//
110
reg                     wbs_ack_o;      // WISHBONE ack
111
reg                     wbs_err_o;      // WISHBONE err
112
reg     [0:0]             ctrl_r;         // Control register
113
wire                    valid_access;   // Access to SSVGA
114
 
115
//
116
// Control register
117
//
118
always @(posedge wb_clk_i or posedge wb_rst_i)
119
        if (wb_rst_i)
120
                ctrl_r <= #1 1'b0;
121
        else if (valid_access & wbs_we_i & !wbs_adr_i[`SEL_PAL] & !wbs_adr_i[`SEL_ADDRESS])
122
                ctrl_r <= #1 wbs_dat_i[0];
123
 
124
reg [31:2] pix_start_addr ;
125
always @(posedge wb_clk_i or posedge wb_rst_i)
126
        if (wb_rst_i)
127
                pix_start_addr <= #1 30'h0000_0000 ;
128
        else if (valid_access & wbs_we_i & !wbs_adr_i[`SEL_PAL] & wbs_adr_i[`SEL_ADDRESS] )
129
                pix_start_addr <= #1 wbs_dat_i[31:2] ;
130
 
131
//
132
// Generate delayed WISHBONE ack/err
133
//
134
always @(posedge wb_clk_i or posedge wb_rst_i)
135
        if (wb_rst_i) begin
136
                wbs_ack_o <= #1 1'b0;
137
                wbs_err_o <= #1 1'b0;
138
        end
139
        else if (valid_access) begin
140
                wbs_ack_o <= #1 1'b1;
141
                wbs_err_o <= #1 1'b0;
142
        end
143
        else if (wbs_cyc_i & wbs_stb_i) begin
144
                wbs_ack_o <= #1 1'b0;
145
                wbs_err_o <= #1 1'b1;
146
        end
147
        else begin
148
                wbs_ack_o <= #1 1'b0;
149
                wbs_err_o <= #1 1'b0;
150
        end
151
 
152
//
153
// Generate WISHBONE output signals
154
//
155
reg [31:0] wbs_dat_o ;
156
always@(wbs_adr_i or pal_dat or ctrl_r or pix_start_addr)
157
begin
158
    if ( wbs_adr_i[`SEL_PAL] )
159
        wbs_dat_o = {16'h0000, pal_dat} ;
160
    else
161
    if ( wbs_adr_i[`SEL_ADDRESS] )
162
        wbs_dat_o = {pix_start_addr, 2'b00} ;
163
    else
164
        wbs_dat_o = {{31{1'b0}}, ctrl_r};
165
end
166
 
167
assign wbs_rty_o = 1'b0;
168
 
169
//
170
// Generate other signals
171
//
172
assign valid_access = wbs_cyc_i & wbs_stb_i & (wbs_sel_i == 4'b1111);
173
assign ssvga_en = ctrl_r[0];
174
assign pal_wr_en = valid_access & wbs_we_i & wbs_adr_i[`SEL_PAL];
175
assign pal_rd_en = valid_access & ~wbs_we_i & wbs_adr_i[`SEL_PAL];
176
 
177
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.