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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mp3/] [rtl/] [verilog/] [ssvga/] [ssvga_wbm_if.v] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 266 lampret
//////////////////////////////////////////////////////////////////////
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 master 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
// Revision 1.1.1.1  2001/10/06 10:19:09  igorm
48
// no message
49
//
50
//
51
 
52
// synopsys translate_off
53
`include "timescale.v"
54
`include "ssvga_defines.v"
55
// synopsys translate_on
56
 
57
module ssvga_wbm_if(
58
        // Clock and reset
59
        wb_clk_i, wb_rst_i,
60
 
61
        // WISHBONE Master I/F
62
        wbm_cyc_o, wbm_stb_o, wbm_sel_o, wbm_we_o,
63
        wbm_adr_o, wbm_dat_o, wbm_cab_o,
64
        wbm_dat_i, wbm_ack_i, wbm_err_i, wbm_rty_i,
65
 
66
        // Other signals
67
        ssvga_en, fifo_full,
68
        fifo_wr_en, fifo_dat,
69
    pix_start_addr, resync
70
);
71
 
72
//
73
// I/O ports
74
//
75
 
76
//
77
// Clock and reset
78
//
79
input                   wb_clk_i;       // Pixel Clock
80
input                   wb_rst_i;       // Reset
81
 
82
//
83
// WISHBONE Master I/F
84
//
85
output                  wbm_cyc_o;
86
output                  wbm_stb_o;
87
output  [3:0]            wbm_sel_o;
88
output                  wbm_we_o;
89
output  [31:0]           wbm_adr_o;
90
output  [31:0]           wbm_dat_o;
91
output                  wbm_cab_o;
92
input   [31:0]           wbm_dat_i;
93
input                   wbm_ack_i;
94
input                   wbm_err_i;
95
input                   wbm_rty_i;
96
 
97
//
98
// Other signals
99
//
100
input                   ssvga_en;       // Global enable
101
input                   fifo_full;      // FIFO is full
102
output                  fifo_wr_en;     // FIFO write enable
103
output  [31:0]           fifo_dat;       // FIFO data
104
input   [31:2]  pix_start_addr ;
105
input           resync ;    // when pixel buffer underrun occures, master must resynchronize operation to start of screen
106
 
107
//
108
// Internal regs and wires
109
//
110
reg     [`SSVGA_VMCW-1:0] vmaddr_r;      // Video memory address counter
111
//reg   [31:0]          shift_r;        // Shift register
112
//reg   [1:0]           shift_empty_r;  // Shift register empty flags
113
 
114
// frame finished indicator - whenever video memory address shows 640x480 pixels read
115
reg  frame_read ;
116
wire frame_read_in = ( vmaddr_r == `SSVGA_VMCW'h0_00_00 ) & wbm_ack_i & wbm_stb_o || ~ssvga_en || resync ;
117
 
118
always@(posedge wb_clk_i or posedge wb_rst_i)
119
begin
120
    if (wb_rst_i)
121
        frame_read <= #1 1'b0 ;
122
    else
123
        frame_read <= #1 frame_read_in ;
124
end
125
 
126
//
127
// Video memory address generation
128
//
129
always @(posedge wb_clk_i or posedge wb_rst_i)
130
        if (wb_rst_i)
131
                vmaddr_r <= #1 ((`PIXEL_NUM/4)-1) ;
132
        else if (frame_read)
133
                vmaddr_r <= #1 ((`PIXEL_NUM/4)-1);
134
        else if (wbm_ack_i & wbm_stb_o)
135
                vmaddr_r <= #1 vmaddr_r - 1;
136
 
137
reg [31:2] wbm_adr ;
138
always@(posedge wb_clk_i or posedge wb_rst_i)
139
begin
140
    if (wb_rst_i)
141
                wbm_adr <= #1 30'h0000_0000 ;
142
    else if (frame_read)
143
        wbm_adr <= #1 pix_start_addr ;
144
    else if (wbm_ack_i & wbm_stb_o)
145
        wbm_adr <= #1 wbm_adr + 1 ;
146
end
147
 
148
//
149
// Shift register
150
//
151
/*always @(posedge wb_clk_i or posedge wb_rst_i)
152
        if (wb_rst_i)
153
                shift_r <= #1 32'h0000_0000;
154
        else if (wbm_ack_i & wbm_cyc_o)
155
                shift_r <= #1 wbm_dat_i;
156
        else if (!fifo_full)
157
                shift_r <= #1 {16'h00, shift_r[31:16]};
158
 
159
//
160
// Shift register empty flags
161
//
162
always @(posedge wb_clk_i or posedge wb_rst_i)
163
        if (wb_rst_i)
164
                shift_empty_r <= #1 2'b11 ;
165
        else if (wbm_ack_i & wbm_cyc_o)
166
                shift_empty_r <= #1 2'b00;
167
        else if (!fifo_full)
168
                shift_empty_r <= #1 {1'b1, shift_empty_r[1]};
169
*/
170
//
171
// Generate WISHBONE output signals
172
//
173
assign wbm_cyc_o = ssvga_en & !frame_read ;
174
assign wbm_stb_o = wbm_cyc_o & !fifo_full;
175
assign wbm_sel_o = 4'b1111;
176
assign wbm_we_o = 1'b0;
177
assign wbm_adr_o = {wbm_adr, 2'b00};
178
assign wbm_dat_o = 32'h0000_0000;
179
assign wbm_cab_o = 1'b1;
180
 
181
//
182
// Generate other signals
183
//
184
assign fifo_wr_en = wbm_ack_i & wbm_stb_o ;
185
assign fifo_dat = wbm_dat_i ;
186
 
187
endmodule

powered by: WebSVN 2.1.0

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