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

Subversion Repositories vga_lcd

[/] [vga_lcd/] [trunk/] [rtl/] [verilog/] [vga_csm_pb.v] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 23 rherveille
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  WISHBONE rev.B2 compliant VGA/LCD Core; CycleShared Memory ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Richard Herveille                                  ////
7
////          richard@asics.ws                                   ////
8
////          www.asics.ws                                       ////
9
////                                                             ////
10
////  Downloaded from: http://www.opencores.org/projects/vga_lcd ////
11
////                                                             ////
12
/////////////////////////////////////////////////////////////////////
13
////                                                             ////
14
//// Copyright (C) 2001 Richard Herveille                        ////
15
////                    richard@asics.ws                         ////
16
////                                                             ////
17
//// This source file may be used and distributed without        ////
18
//// restriction provided that this copyright statement is not   ////
19
//// removed from the file and that any derivative work contains ////
20
//// the original copyright notice and the associated disclaimer.////
21
////                                                             ////
22
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
23
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
24
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
25
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
26
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
27
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
28
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
29
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
30
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
31
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
32
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
33
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
34
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
35
////                                                             ////
36
/////////////////////////////////////////////////////////////////////
37
 
38
//  CVS Log
39 17 rherveille
//
40 30 rherveille
//  $Id: vga_csm_pb.v,v 1.6 2002-02-07 05:42:10 rherveille Exp $
41 23 rherveille
//
42 30 rherveille
//  $Date: 2002-02-07 05:42:10 $
43
//  $Revision: 1.6 $
44 23 rherveille
//  $Author: rherveille $
45
//  $Locker:  $
46
//  $State: Exp $
47
//
48
// Change History:
49
//               $Log: not supported by cvs2svn $
50 17 rherveille
 
51
`include "timescale.v"
52
 
53 19 rherveille
module vga_csm_pb (clk_i, req0_i, ack0_o, adr0_i, dat0_i, dat0_o, we0_i, req1_i, ack1_o, adr1_i, dat1_i, dat1_o, we1_i);
54 17 rherveille
 
55
        //
56
        // parameters
57
        //
58
        parameter DWIDTH = 32; // databus width
59
        parameter AWIDTH = 8;  // address bus width
60
 
61
        //
62
        // inputs & outputs
63
        //
64
 
65 19 rherveille
        input clk_i;                    // clock input
66 17 rherveille
 
67
        // wishbone slave0 connections
68 19 rherveille
        input  [ AWIDTH   -1:0] adr0_i; // address input
69
        input  [ DWIDTH   -1:0] dat0_i; // data input
70
        output [ DWIDTH   -1:0] dat0_o; // data output
71
        input                   we0_i;  // write enable input
72
        input                   req0_i; // access request input
73
        output                  ack0_o; // access acknowledge output
74 17 rherveille
 
75
        // wishbone slave1 connections
76 19 rherveille
        input  [ AWIDTH   -1:0] adr1_i; // address input
77
        input  [ DWIDTH   -1:0] dat1_i; // data input
78
        output [ DWIDTH   -1:0] dat1_o; // data output
79
        input                   we1_i;  // write enable input
80
        input                   req1_i; // access request input
81
        output                  ack1_o; // access acknowledge output
82 17 rherveille
 
83
        //
84
        // variable declarations
85
        //
86
 
87
        // multiplexor select signal
88 19 rherveille
        wire acc0, acc1;
89
        reg  dacc0, dacc1;
90
        wire sel0, sel1;
91 17 rherveille
        reg  ack0, ack1;
92
 
93
        // memory data output
94
        wire [DWIDTH -1:0] mem_q;
95
 
96
 
97
        //
98
        // module body
99
        //
100
 
101
        // generate multiplexor select signal
102 19 rherveille
        assign acc0 = req0_i;
103
        assign acc1 = req1_i && !sel0;
104 17 rherveille
 
105 19 rherveille
        always@(posedge clk_i)
106 17 rherveille
                begin
107 19 rherveille
                        dacc0 <= #1 acc0 & !ack0_o;
108
                        dacc1 <= #1 acc1 & !ack1_o;
109 17 rherveille
                end
110
 
111 19 rherveille
        assign sel0 = acc0 && !dacc0;
112
        assign sel1 = acc1 && !dacc1;
113 17 rherveille
 
114 19 rherveille
        always@(posedge clk_i)
115
                begin
116
                        ack0 <= #1 sel0 && !ack0_o;
117
                        ack1 <= #1 sel1 && !ack1_o;
118
                end
119 17 rherveille
 
120 19 rherveille
        wire [AWIDTH -1:0] mem_adr = sel0 ? adr0_i : adr1_i;
121
        wire [DWIDTH -1:0] mem_d   = sel0 ? dat0_i : dat1_i;
122
        wire               mem_we  = sel0 ? req0_i && we0_i : req1_i && we1_i;
123 17 rherveille
 
124
        // hookup generic synchronous single port memory
125
        generic_spram #(AWIDTH, DWIDTH) clut_mem(
126 19 rherveille
                .clk(clk_i),
127 17 rherveille
                .rst(1'b0),       // no reset
128
                .ce(1'b1),        // always enable memory
129
                .we(mem_we),
130
                .oe(1'b1),        // always output data
131
                .addr(mem_adr),
132
                .di(mem_d),
133
                .do(mem_q)
134
        );
135
 
136
        // assign DAT_O outputs
137 19 rherveille
        assign dat0_o = mem_q;
138
        assign dat1_o = mem_q;
139 17 rherveille
 
140 19 rherveille
        // generate ack outputs
141
        assign ack0_o = ( (sel0 && we0_i) || ack0 );
142
        assign ack1_o = ( (sel1 && we1_i) || ack1 );
143
endmodule

powered by: WebSVN 2.1.0

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