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

Subversion Repositories wf3d

[/] [wf3d/] [trunk/] [implement/] [rtl/] [axi_cmn/] [fm_dispatch.v] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 specular
//=======================================================================
2
// Project Monophony
3
//   Wire-Frame 3D Graphics Accelerator IP Core
4
//
5
// File:
6
//   fm_dispatch.v
7
//
8
// Abstract:
9
//   Register access dispatcher
10
//
11
// Author:
12 9 specular
//   Kenji Ishimaru (info.info.wf3d@gmail.com)
13 5 specular
//
14
//======================================================================
15
//
16
// Copyright (c) 2016, 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
 
43
// memory mapping
44
//
45
//  address(byte)                      address(/32bit)
46
//
47
//  0x0000_03ff +------------------+ 0x0080_0ff
48
//              |          (8MB)   |         
49
//  0x0000_0300 +------------------+ 0x0080_0c0
50
//              |          (8MB)   |         
51
//  0x0000_0200 +------------------+ 0x0000_080
52
//              |  3D      (8MB)   |
53
//  0x0000_0100 +------------------+ 0x0000_040
54
//              |  System  (8MB)   |
55
//  0x0000_0000 +------------------+ 0x0000_000
56
//
57
 
58
module fm_dispatch (
59
    clk_core,
60
    rst_x,
61
    // local interface
62
    i_req,
63
    i_wr,
64
    i_adrs,
65
    o_ack,
66
    i_be,
67
    i_wd,
68
    o_rstr,
69
    o_rd,
70
    // internal side
71
    o_req_sys,
72
    o_req_3d,
73
    o_wr,
74
    o_adrs,
75
    i_ack_sys,
76
    i_ack_3d,
77
    o_be,
78
    o_wd,
79
    i_rstr_sys,
80
    i_rstr_3d,
81
    i_rd_sys,
82
    i_rd_3d
83
);
84
//////////////////////////////////
85
// I/O port definition
86
//////////////////////////////////
87
    input           clk_core;
88
    input           rst_x;
89
    // sh4 local interface
90
    input           i_req;
91
    input           i_wr;
92
    input  [23:0]   i_adrs;
93
    output          o_ack;
94
    input  [3:0]    i_be;
95
    input  [31:0]   i_wd;
96
    output          o_rstr;
97
    output [31:0]   o_rd;
98
    // internal side
99
    output          o_req_sys;
100
    output          o_req_3d;
101
    output          o_wr;
102
    output [21:0]   o_adrs;
103
    input           i_ack_sys;
104
    input           i_ack_3d;
105
    output [3:0]    o_be;
106
    output [31:0]   o_wd;
107
    input           i_rstr_sys;
108
    input           i_rstr_3d;
109
    input  [31:0]   i_rd_sys;
110
    input  [31:0]   i_rd_3d;
111
//////////////////////////////////
112
// reg
113
//////////////////////////////////
114
//////////////////////////////////
115
// wire
116
//////////////////////////////////
117
    wire            w_sys_hit;
118
    wire            w_3d_hit;
119
 
120
    wire   [23:0]   w_adrs;
121
    wire            w_req;
122
 
123
//////////////////////////////////
124
// assign
125
//////////////////////////////////
126
    assign     w_adrs = i_adrs;
127
    assign     w_req = i_req;
128
 
129
    assign     w_sys_hit = (w_adrs[9:8] == 2'b00);  // byte address
130
    assign     w_3d_hit = !w_sys_hit;
131
 
132
    assign     o_ack = (w_sys_hit & i_ack_sys)|
133
                       (w_3d_hit &i_ack_3d);
134
    assign     o_rstr = i_rstr_3d | i_rstr_sys;
135
    assign     o_rd = (i_rstr_sys) ? i_rd_sys :
136
                      (i_rstr_3d)  ? i_rd_3d :
137
                                     32'h0;
138
    assign     o_req_sys = w_req & w_sys_hit;
139
    assign     o_req_3d = w_req & w_3d_hit;
140
    assign     o_adrs = w_adrs[21:0];
141
    assign     o_wr = i_wr;
142
    assign     o_be = i_be;
143
    assign     o_wd = i_wd;
144
 
145
endmodule

powered by: WebSVN 2.1.0

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