Subversion Repositories ngs

Rev

Blame | Last modification | View Log | Download | RSS feed | ?url?

  1. //
  2. // TV80 8-Bit Microprocessor Core
  3. // Based on the VHDL T80 core by Daniel Wallner (jesus@opencores.org)
  4. //
  5. // Copyright (c) 2004 Guy Hutchison (ghutchis@opencores.org)
  6. //
  7. // Permission is hereby granted, free of charge, to any person obtaining a
  8. // copy of this software and associated documentation files (the "Software"),
  9. // to deal in the Software without restriction, including without limitation
  10. // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. // and/or sell copies of the Software, and to permit persons to whom the
  12. // Software is furnished to do so, subject to the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be included
  15. // in all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  21. // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  22. // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  23. // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24.  
  25. module tv80_reg (/*AUTOARG*/
  26.   // Outputs
  27.   DOBH, DOAL, DOCL, DOBL, DOCH, DOAH,
  28.   // Inputs
  29.   AddrC, AddrA, AddrB, DIH, DIL, clk, CEN, WEH, WEL
  30.   );
  31.     input  [2:0] AddrC;
  32.     output [7:0] DOBH;
  33.     input  [2:0] AddrA;
  34.     input  [2:0] AddrB;
  35.     input  [7:0] DIH;
  36.     output [7:0] DOAL;
  37.     output [7:0] DOCL;
  38.     input  [7:0] DIL;
  39.     output [7:0] DOBL;
  40.     output [7:0] DOCH;
  41.     output [7:0] DOAH;
  42.     input  clk, CEN, WEH, WEL;
  43.  
  44.   reg [7:0] RegsH [0:7];
  45.   reg [7:0] RegsL [0:7];
  46.  
  47.   always @(posedge clk)
  48.     begin
  49.       if (CEN)
  50.         begin
  51.           if (WEH) RegsH[AddrA] <= DIH;
  52.           if (WEL) RegsL[AddrA] <= DIL;
  53.         end
  54.     end
  55.          
  56.   assign DOAH = RegsH[AddrA];
  57.   assign DOAL = RegsL[AddrA];
  58.   assign DOBH = RegsH[AddrB];
  59.   assign DOBL = RegsL[AddrB];
  60.   assign DOCH = RegsH[AddrC];
  61.   assign DOCL = RegsL[AddrC];
  62.  
  63.   // break out ram bits for waveform debug
  64. // synopsys translate_off
  65.   wire [7:0] B = RegsH[0];
  66.   wire [7:0] C = RegsL[0];
  67.   wire [7:0] D = RegsH[1];
  68.   wire [7:0] E = RegsL[1];
  69.   wire [7:0] H = RegsH[2];
  70.   wire [7:0] L = RegsL[2];
  71.  
  72.   wire [15:0] IX = { RegsH[3], RegsL[3] };
  73.   wire [15:0] IY = { RegsH[7], RegsL[7] };
  74. // synopsys translate_on
  75.  
  76. endmodule
  77.  
  78.