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

Subversion Repositories aoocs

[/] [aoocs/] [trunk/] [rtl/] [bus_terminator.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/*
2
 * Copyright 2010, Aleksander Osman, alfik@poczta.fm. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without modification, are
5
 * permitted provided that the following conditions are met:
6
 *
7
 *  1. Redistributions of source code must retain the above copyright notice, this list of
8
 *     conditions and the following disclaimer.
9
 *
10
 *  2. Redistributions in binary form must reproduce the above copyright notice, this list
11
 *     of conditions and the following disclaimer in the documentation and/or other materials
12
 *     provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
15
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 */
24
 
25
/*! \file
26
 * \brief Terminator for not handled WISHBONE bus cycles.
27
 */
28
 
29
/*! \brief \copybrief bus_terminator.v
30
*/
31
module bus_terminator(
32
    //% \name Clock and reset
33
    //% @{
34
    input CLK_I,
35
    input reset_n,
36
    //% @}
37
 
38
    //% \name WISHBONE slave
39
    //% @{
40
    input [31:2]    ADR_I,
41
    input           CYC_I,
42
    input           WE_I,
43
    input           STB_I,
44
    input [3:0]     SEL_I,
45
    input [31:0]    slave_DAT_I,
46
    output [31:0]   slave_DAT_O,
47
    output reg      ACK_O,
48
    output reg      RTY_O,
49
    output          ERR_O,
50
    //% @}
51
 
52
    //% \name ao68000 interrupt cycle indicator
53
    //% @{
54
    input           cpu_space_cycle
55
    //% @}
56
);
57
 
58
assign ERR_O        = 1'b0;
59
assign slave_DAT_O  = 32'd0;
60
 
61
wire accepted_addresses =
62
    ({ADR_I, 2'b00} >= 32'h00F00000 && {ADR_I, 2'b00} <= 32'h00F7FFFC) ||
63
    ({ADR_I, 2'b00} >= 32'h00E80000 && {ADR_I, 2'b00} <= 32'h00EFFFFC) ||
64
    // Lotus2
65
    ({ADR_I, 2'b00} >= 32'h00200000 && {ADR_I, 2'b00} <= 32'h009FFFFF) ||
66
    // Pinball Dreams
67
    {ADR_I, 2'b00} == 32'h00DFF11C ||
68
 
69
    {ADR_I, 2'b00} == 32'h00DFF1FC ||
70
    {ADR_I, 2'b00} == 32'h00DFF0FC ||
71
    {ADR_I, 2'b00} == 32'h00DC003C ||
72
    {ADR_I, 2'b00} == 32'h00D8003C ||
73
    {ADR_I, 2'b00} == 32'hFFFFFFFC;
74
 
75
always @(posedge CLK_I or negedge reset_n) begin
76
    if(reset_n == 1'b0) begin
77
        ACK_O <= 1'b0;
78
        RTY_O <= 1'b0;
79
    end
80
    else begin
81
        if( cpu_space_cycle == 1'b0 &&
82
            accepted_addresses == 1'b1 &&
83
            CYC_I == 1'b1 && STB_I == 1'b1 && ACK_O == 1'b0)    ACK_O <= 1'b1;
84
        else                                                    ACK_O <= 1'b0;
85
 
86
        if( cpu_space_cycle == 1'b1 &&
87
            ADR_I[31:5] == 27'b111_1111_1111_1111_1111_1111_1111 &&
88
            CYC_I == 1'b1 && STB_I == 1'b1 && WE_I == 1'b0)
89
        begin
90
            RTY_O <= 1'b1;
91
        end
92
        else begin
93
            RTY_O <= 1'b0;
94
        end
95
    end
96
end
97
 
98
endmodule

powered by: WebSVN 2.1.0

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