Subversion Repositories pentevo

Rev

Rev 896 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. // ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
  2. //
  3. // wait generator for Z80
  4.  
  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.  
  24. `include "../include/tune.v"
  25.  
  26. module zwait(
  27.  
  28.         input  wire rst_n,
  29.  
  30.         input  wire wait_start_gluclock,
  31.         input  wire wait_start_comport,
  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.  
  43. `ifdef SIMULATE
  44.         initial
  45.         begin
  46. //              force waits = 7'd0;
  47.                 waits <= 7'd0;
  48.         end
  49. `endif
  50.  
  51.  
  52.         wire wait_off_n;
  53.         assign wait_off_n = (~wait_end) & rst_n;
  54.  
  55.         // RS-flipflops
  56.         //
  57.         always @(posedge wait_start_gluclock, negedge wait_off_n)
  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;
  68.  
  69.  
  70.         always @(posedge wait_end) // just dummy for future extensions
  71.         begin
  72.                 waits[6:2] <= 5'd0;
  73.         end
  74.  
  75.  
  76.  
  77. `ifndef SIMULATE
  78.         assign spiint_n = ~|waits;
  79.         assign wait_n = spiint_n ? 1'bZ : 1'b0;
  80. `else
  81.         assign spiint_n = 1'b1;
  82.         assign wait_n = 1'bZ;
  83. `endif
  84.  
  85. endmodule
  86.  
  87.