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

Subversion Repositories wf3d

[/] [wf3d/] [trunk/] [implement/] [rtl/] [de0/] [fm_vga_wrapper.v] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 specular
//=======================================================================
2
// Project Monophony
3
//   Wire-Frame 3D Graphics Accelerator IP Core
4
//
5
// File:
6
//   fm_vga_wrapper.v
7
//
8
// Abstract:
9
//   AVALON VGA Master
10
//
11
// Author:
12 9 specular
//   Kenji Ishimaru (info.info.wf3d@gmail.com)
13 2 specular
//
14
//======================================================================
15
//
16
// Copyright (c) 2015, Kenji Ishimaru
17
// All rights reserved.
18
//
19
// Redistribution and use in source and binary forms, with or without
20
// modification, are permitted provided that the following conditions are met:
21
//
22
//  -Redistributions of source code must retain the above copyright notice,
23
//   this list of conditions and the following disclaimer.
24
//  -Redistributions in binary form must reproduce the above copyright notice,
25
//   this list of conditions and the following disclaimer in the documentation
26
//   and/or other materials provided with the distribution.
27
//
28
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
32
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
35
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
37
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
38
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
//
40
// Revision History
41
 
42
module fm_vga_wrapper (
43
  // Avalon-MM Slave Interface
44
  input           clk_core,
45
  input           rst_x,
46
  input  [3:0]    i_avs_adr,
47
  input  [3:0]    i_avs_be,
48
  input           i_avs_r,
49
  output [31:0]   o_avs_rd,
50
  input           i_avs_w,
51
  input  [31:0]   i_avs_wd,
52
  output          o_avs_wait,
53
  // Avalon-MM Master Interface
54
  output [23:0]   o_avm_adr,
55
  output [3:0]    o_avm_be,
56
  output [5:0]    o_avm_blen,
57
  output          o_avm_r,
58
  input           i_avm_wait,
59
  input           i_avm_rvalid,
60
  input  [31:0]   i_avm_rd,
61
  // Vsync int
62
  output o_int,
63
  // VGA output
64
  input        clk25m,
65
  output [3:0] o_cr,
66
  output [3:0] o_cg,
67
  output [3:0] o_cb,
68
  output o_vsync_x,
69
  output o_hsync_x
70
);
71
 
72
// bridge
73
  wire        w_req;
74
  wire        w_wr;
75
  wire [3:0]  w_adrs;
76
  wire        w_ack;
77
  wire [3:0]  w_be;
78
  wire [31:0] w_wd;
79
  wire        w_rstr;
80
  wire [31:0] w_rd;
81
 
82
  wire w_video_start;
83
  wire [6:0] w_fb0_offset;
84
  wire [6:0] w_fb1_offset;
85
  wire [1:0] w_color_mode;
86
  wire w_front_buffer;
87
 
88
  wire w_vint_x;
89
  wire w_vint_edge;
90
 
91
  wire [7:0] w_cr;
92
  wire [7:0] w_cg;
93
  wire [7:0] w_cb;
94
  wire [25:0] w_avm_adr;
95
 
96
  assign o_cr = w_cr[7:4];
97
  assign o_cg = w_cg[7:4];
98
  assign o_cb = w_cb[7:4];
99
  assign o_avm_adr = {w_avm_adr,2'b00};  // byte address
100
  assign o_avm_be = 4'hf;
101
 
102
fm_avalon #(.P_AVALON_ADR_WIDTH(4)) u_avalon (
103
  .clk_core(clk_core),
104
  .rst_x(rst_x),
105
  // AVALON slave bus
106
  .i_av_adr(i_avs_adr),
107
  .i_av_be(i_avs_be),
108
  .i_av_r(i_avs_r),
109
  .o_av_rd(o_avs_rd),
110
  .i_av_w(i_avs_w),
111
  .i_av_wd(i_avs_wd),
112
  .o_av_wait(o_avs_wait),
113
  // internal side
114
  .o_req(w_req),
115
  .o_wr(w_wr),
116
  .o_adrs(w_adrs),
117
  .i_ack(w_ack),
118
  .o_be(w_be),
119
  .o_wd(w_wd),
120
  .i_rstr(w_rstr),
121
  .i_rd(w_rd)
122
);
123
 
124
// System controller
125
fm_hsys fm_hsys (
126
  .clk_core(clk_core),
127
  .rst_x(rst_x),
128
  // internal interface
129
  .i_req(w_req),
130
  .i_wr(w_wr),
131
  .i_adrs(w_adrs),
132
  .o_ack(w_ack),
133
  .i_be(w_be),
134
  .i_wd(w_wd),
135
  .o_rstr(w_rstr),
136
  .o_rd(w_rd),
137
  // configuration output
138
  //   Video controller
139
  .o_video_start(w_video_start),
140
  .o_aa_en(),
141
  .o_fb0_offset(w_fb0_offset),
142
  .o_fb1_offset(w_fb1_offset),
143
  .o_color_mode(w_color_mode),
144
  .o_front_buffer(w_front_buffer),
145
  .o_fb_blend_en(),
146
  // vint
147
  .i_vint_x(w_vint_x),
148
  .i_vint_edge(w_vint_edge),
149
  // vertex dma int
150
  .i_vtx_int(1'b0),
151
  // int out
152
  .o_int(o_int)
153
);
154
 
155
// Video controller
156
fm_hvc fm_hvc (
157
  .clk_core(clk_core),
158
  .clk_vi(clk25m),
159
  .rst_x(rst_x),
160
  // configuration registers
161
  .i_video_start(w_video_start),
162
  .i_fb0_offset(w_fb0_offset),
163
  .i_fb1_offset(w_fb1_offset),
164
  .i_color_mode(w_color_mode),
165
  .i_front_buffer(w_front_buffer),
166
  // status out
167
  .o_vint_x(w_vint_x),
168
  .o_vint_edge(w_vint_edge),
169
  // dram if
170
  .o_req(o_avm_r),
171
  .o_adrs(w_avm_adr),
172
  .o_len(o_avm_blen),
173
  .i_ack(!i_avm_wait),
174
  .i_rstr(i_avm_rvalid),
175
  .i_rd(i_avm_rd),
176
  // video out
177
  .clk_vo(),
178
  .o_r(w_cr),
179
  .o_g(w_cg),
180
  .o_b(w_cb),
181
  .o_vsync_x(o_vsync_x),
182
  .o_hsync_x(o_hsync_x),
183
  .o_blank_x(),
184
  .o_de()
185
);
186
 
187
endmodule

powered by: WebSVN 2.1.0

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