T80_Reg.vhd 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. -- ****
  2. -- T80(b) core. In an effort to merge and maintain bug fixes ....
  3. --
  4. --
  5. -- Ver 300 started tidyup
  6. -- MikeJ March 2005
  7. -- Latest version from www.fpgaarcade.com (original www.opencores.org)
  8. --
  9. -- ****
  10. --
  11. -- T80 Registers, technology independent
  12. --
  13. -- Version : 0244
  14. --
  15. -- Copyright (c) 2002 Daniel Wallner (jesus@opencores.org)
  16. --
  17. -- All rights reserved
  18. --
  19. -- Redistribution and use in source and synthezised 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. --
  25. -- Redistributions in synthesized form must reproduce the above copyright
  26. -- notice, this list of conditions and the following disclaimer in the
  27. -- documentation and/or other materials provided with the distribution.
  28. --
  29. -- Neither the name of the author nor the names of other contributors may
  30. -- be used to endorse or promote products derived from this software without
  31. -- specific prior written permission.
  32. --
  33. -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  34. -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  35. -- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  36. -- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
  37. -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  38. -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  39. -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  40. -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  41. -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  42. -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  43. -- POSSIBILITY OF SUCH DAMAGE.
  44. --
  45. -- Please report bugs to the author, but before you do so, please
  46. -- make sure that this is not a derivative work and that
  47. -- you have the latest version of this file.
  48. --
  49. -- The latest version of this file can be found at:
  50. -- http://www.opencores.org/cvsweb.shtml/t51/
  51. --
  52. -- Limitations :
  53. --
  54. -- File history :
  55. --
  56. -- 0242 : Initial release
  57. --
  58. -- 0244 : Changed to single register file
  59. --
  60. library IEEE;
  61. use IEEE.std_logic_1164.all;
  62. use IEEE.numeric_std.all;
  63. entity T80_Reg is
  64. port(
  65. Clk : in std_logic;
  66. CEN : in std_logic;
  67. WEH : in std_logic;
  68. WEL : in std_logic;
  69. AddrA : in std_logic_vector(2 downto 0);
  70. AddrB : in std_logic_vector(2 downto 0);
  71. AddrC : in std_logic_vector(2 downto 0);
  72. DIH : in std_logic_vector(7 downto 0);
  73. DIL : in std_logic_vector(7 downto 0);
  74. DOAH : out std_logic_vector(7 downto 0);
  75. DOAL : out std_logic_vector(7 downto 0);
  76. DOBH : out std_logic_vector(7 downto 0);
  77. DOBL : out std_logic_vector(7 downto 0);
  78. DOCH : out std_logic_vector(7 downto 0);
  79. DOCL : out std_logic_vector(7 downto 0)
  80. );
  81. end T80_Reg;
  82. architecture rtl of T80_Reg is
  83. type Register_Image is array (natural range <>) of std_logic_vector(7 downto 0);
  84. signal RegsH : Register_Image(0 to 7);
  85. signal RegsL : Register_Image(0 to 7);
  86. begin
  87. process (Clk)
  88. begin
  89. if Clk'event and Clk = '1' then
  90. if CEN = '1' then
  91. if WEH = '1' then
  92. RegsH(to_integer(unsigned(AddrA))) <= DIH;
  93. end if;
  94. if WEL = '1' then
  95. RegsL(to_integer(unsigned(AddrA))) <= DIL;
  96. end if;
  97. end if;
  98. end if;
  99. end process;
  100. DOAH <= RegsH(to_integer(unsigned(AddrA)));
  101. DOAL <= RegsL(to_integer(unsigned(AddrA)));
  102. DOBH <= RegsH(to_integer(unsigned(AddrB)));
  103. DOBL <= RegsL(to_integer(unsigned(AddrB)));
  104. DOCH <= RegsH(to_integer(unsigned(AddrC)));
  105. DOCL <= RegsL(to_integer(unsigned(AddrC)));
  106. end;