Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 12.10.2015 08:25:11
  6. -- Design Name:
  7. -- Module Name: main - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24. use work.mycomponents_package.ALL;
  25.  
  26. -- Uncomment the following library declaration if using
  27. -- arithmetic functions with Signed or Unsigned values
  28. --use IEEE.NUMERIC_STD.ALL;
  29.  
  30. -- Uncomment the following library declaration if instantiating
  31. -- any Xilinx leaf cells in this code.
  32. --library UNISIM;
  33. --use UNISIM.VComponents.all;
  34.  
  35. entity main is
  36. PORT (
  37. X: in STD_LOGIC_VECTOR (7 downto 0);
  38. O: in STD_LOGIC_VECTOR (2 downto 0);
  39. I: in STD_LOGIC_VECTOR (1 downto 0);
  40. L: out STD_LOGIC_VECTOR (7 downto 0);
  41. --p0,p1,p2,p3: out STD_LOGIC_VECTOR (7 downto 0);
  42. --pin:out STD_LOGIC_VECTOR (3 downto 0);
  43. --pout: out STD_LOGIC_VECTOR (4 downto 0);
  44. En: in STD_LOGIC
  45. );
  46. end main;
  47.  
  48. architecture Behavioral of main is
  49.  
  50. SIGNAL dbu : STD_LOGIC_VECTOR (7 downto 0);
  51. SIGNAL Rout : STD_LOGIC_VECTOR (4 downto 0);
  52. SIGNAL Rin : STD_LOGIC_VECTOR (3 downto 0);
  53. SIGNAL R0,R1,R2,R3 : STD_LOGIC_VECTOR (7 downto 0);
  54. begin
  55.  
  56. WITH O SELECT
  57. Rout <= "00001" WHEN "000",
  58. "00010" WHEN "001",
  59. "00100" WHEN "010",
  60. "01000" WHEN "011",
  61. "10000" WHEN "100",
  62. "00000" WHEN OTHERS;
  63.  
  64. PROCESS
  65. BEGIN
  66. WAIT UNTIL En'EVENT AND En = '0' ;
  67. CASE I IS
  68. WHEN "00" =>
  69. Rin <= "0001";
  70. WHEN "01" =>
  71. Rin <= "0010";
  72. WHEN "10" =>
  73. Rin <= "0100";
  74. WHEN "11" =>
  75. Rin <= "1000";
  76. WHEN others =>
  77. Rin <= "0000";
  78. END CASE;
  79. END PROCESS;
  80.  
  81. tri_ext: tris PORT MAP (X,Rout(4),dbu);
  82. reg0: REG PORT MAP(dbu,'1',Rin(0),R0);
  83. reg1: REG PORT MAP(dbu,'1',Rin(1),R1);
  84. reg2: REG PORT MAP(dbu,'1',Rin(2),R2);
  85. reg3: REG PORT MAP(dbu,'1',Rin(3),R3);
  86. tri0: tris PORT MAP (R0,Rout(0),dbu);
  87. tri1: tris PORT MAP (R1,Rout(1),dbu);
  88. tri2: tris PORT MAP (R2,Rout(2),dbu);
  89. tri3: tris PORT MAP (R3,Rout(3),dbu);
  90. L <= dbu;
  91. --p0 <= R0;
  92. --p1 <= R1;
  93. --p2 <= R2;
  94. --p3 <= R3;
  95. --pin <= Rin;
  96. --pout<= Rout;
  97. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement