Subversion Repositories pentevo

Rev

Rev 668 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
668 lvd 1
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
88 lvd 2
//
3
// wait generator for Z80
4
 
668 lvd 5
/*
6
    This file is part of ZX-Evo Base Configuration firmware.
7
 
8
    ZX-Evo Base Configuration firmware is free software:
9
    you can redistribute it and/or modify it under the terms of
10
    the GNU General Public License as published by
11
    the Free Software Foundation, either version 3 of the License, or
12
    (at your option) any later version.
13
 
14
    ZX-Evo Base Configuration firmware is distributed in the hope that
15
    it will be useful, but WITHOUT ANY WARRANTY; without even
16
    the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
    See the GNU General Public License for more details.
18
 
19
    You should have received a copy of the GNU General Public License
20
    along with ZX-Evo Base Configuration firmware.
21
    If not, see <http://www.gnu.org/licenses/>.
22
*/
23
 
200 lvd 24
`include "../include/tune.v"
25
 
88 lvd 26
module zwait(
27
 
28
        input  wire rst_n,
29
 
30
        input  wire wait_start_gluclock,
228 lvd 31
        input  wire wait_start_comport,
88 lvd 32
 
33
        input  wire wait_end,
34
 
35
 
36
        output reg  [6:0] waits,
37
 
38
        output wire wait_n,
39
        output wire spiint_n
40
);
41
 
42
 
200 lvd 43
`ifdef SIMULATE
44
        initial
45
        begin
280 lvd 46
//              force waits = 7'd0;
47
                waits <= 7'd0;
200 lvd 48
        end
49
`endif
50
 
51
 
88 lvd 52
        wire wait_off_n;
53
        assign wait_off_n = (~wait_end) & rst_n;
54
 
228 lvd 55
        // RS-flipflops
56
        //
88 lvd 57
        always @(posedge wait_start_gluclock, negedge wait_off_n)
228 lvd 58
        if( !wait_off_n )
59
                waits[0] <= 1'b0;
60
        else if( wait_start_gluclock )
61
                waits[0] <= 1'b1;
62
        //
63
        always @(posedge wait_start_comport, negedge wait_off_n)
64
        if( !wait_off_n )
65
                waits[1] <= 1'b0;
66
        else if( wait_start_comport )
67
                waits[1] <= 1'b1;
88 lvd 68
 
228 lvd 69
 
88 lvd 70
        always @(posedge wait_end) // just dummy for future extensions
71
        begin
340 lvd 72
                waits[6:2] <= 5'd0;
88 lvd 73
        end
74
 
75
 
76
 
684 lvd 77
`ifndef SIMULATE
88 lvd 78
        assign spiint_n = ~|waits;
79
        assign wait_n = spiint_n ? 1'bZ : 1'b0;
425 lvd 80
`else
684 lvd 81
        assign spiint_n = 1'b1;
425 lvd 82
        assign wait_n = 1'bZ;
83
`endif
88 lvd 84
 
85
endmodule
86