Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.numeric_std.all;
  4. use ieee.std_logic_unsigned.all;
  5.  
  6. entity Boot is
  7. port(x, y: in std_logic_vector(7 downto 0); o:out std_logic_vector(15 downto 0));
  8. end Boot;
  9.  
  10. architecture boot of Boot is
  11. begin
  12.  
  13. process(x, y)
  14. variable a: std_logic_vector(16 downto 0);
  15. variable s,p : std_logic_vector(7 downto 0);
  16. variable i: integer;
  17.  
  18. begin
  19. a := "00000000000000000";
  20. s := y;
  21. a(8 downto 1) := x;
  22.  
  23. for i in 0 to 7 loop
  24. if(a(1) = '1' and a(0) = '0') then
  25. p := (a(16 downto 9));
  26. a(16 downto 9) := (p-s);
  27.  
  28. elsif(a(1) = '0' and a(0) = '1') then
  29. p := (a(16 downto 9));
  30. a(16 downto 9) := (p+s);
  31.  
  32. end if;
  33.  
  34. a(15 downto 0) := a(16 downto 1);
  35.  
  36. end loop;
  37.  
  38. o(15 downto 0) <= a(16 downto 1);
  39.  
  40. end process;
  41.  
  42. end boot;
  43.  
  44. library ieee;
  45. use ieee.std_logic_1164.all;
  46. use ieee.numeric_std.all;
  47. use ieee.std_logic_unsigned.all;
  48.  
  49. entity test_boot is
  50. end test_boot;
  51.  
  52. architecture tba of test_boot is
  53. component boot
  54. port(x, y: in std_logic_vector(7 downto 0); o: out std_logic_vector(15 downto 0));
  55. end component;
  56.  
  57. signal x_t, y_t: std_logic_vector(7 downto 0);
  58. signal o_t: std_logic_vector(15 downto 0);
  59.  
  60. begin
  61. cpn_t:boot port map(x_t, y_t, o_t);
  62. x_t <= "00110101", "10001101" after 100 us, "10111100" after 200 us;
  63. y_t <= "01011101", "00011100" after 100 us, "10011111" after 200 us;
  64. end tba;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement