Guest User

Untitled

a guest
Feb 8th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.32 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. -- use IEEE.STD_LOGIC_ARITH.ALL;
  4. -- use IEEE.STD_LOGIC_UNSIGNED.ALL;
  5.  
  6. -- Uncomment the following library declaration if instantiating
  7. -- any Xilinx primitives in this code.
  8. -- library UNISIM;
  9. -- use UNISIM.VComponents.all;
  10.  
  11. entity CodigoRedundanciaCiclica is
  12.      Port ( rst : in  STD_LOGIC;
  13.            clk : in  STD_LOGIC;
  14.            serialin : in  STD_LOGIC;
  15.            CRC : out  STD_LOGIC_VECTOR (11 downto 0));
  16. end CodigoRedundanciaCiclica;
  17.  
  18. architecture Behavioral of CodigoRedundanciaCiclica is
  19. signal salidaP   : STD_LOGIC_VECTOR (4 downto 0);
  20. signal salidaB   : STD_LOGIC_VECTOR (11 downto 0);
  21.  
  22. component puertaXOR is
  23.     Port ( inA  : in    STD_LOGIC;
  24.           inB   : in    STD_LOGIC;
  25.           outC  : out   STD_LOGIC);
  26. end component;
  27.  
  28. component biestable is
  29.     Port ( rst  : in    STD_LOGIC;
  30.           clk   : in    STD_LOGIC;
  31.           i : in    STD_LOGIC;
  32.           o : inout STD_LOGIC);
  33. end component;
  34.  
  35. begin
  36.     BIS0 : biestable port map(rst, clk, salidaP(4), salidaB(0));
  37.     BIS1 : biestable port map(rst, clk, salidaP(0), salidaB(1));
  38.     BIS2 : biestable port map(rst, clk, salidaP(1), salidaB(2));
  39.     BIS3 : biestable port map(rst, clk, salidaP(2), salidaB(3));
  40.     BIS4 : biestable port map(rst, clk, salidaB(3), salidaB(4));
  41.     BIS5 : biestable port map(rst, clk, salidaB(4), salidaB(5));
  42.     BIS6 : biestable port map(rst, clk, salidaB(5), salidaB(6));
  43.     BIS7 : biestable port map(rst, clk, salidaB(6), salidaB(7));
  44.     BIS8 : biestable port map(rst, clk, salidaB(7), salidaB(8));
  45.     BIS9 : biestable port map(rst, clk, salidaB(8), salidaB(9));
  46.     BIS10 : biestable port map(rst, clk, salidaB(9), salidaB(10));
  47.     BIS11 : biestable port map(rst, clk, salidaP(3), salidaB(11));
  48.    
  49.     PXOR0 : puertaXOR port map(salidaP(4), salidaB(0), salidaP(0));
  50.     PXOR1 : puertaXOR port map(salidaP(4), salidaB(1), salidaP(1));
  51.     PXOR2 : puertaXOR port map(salidaP(4), salidaB(2), salidaP(2));
  52.     PXOR3 : puertaXOR port map(salidaP(4), salidaB(10), salidaP(3));
  53.     PXOR4 : puertaXOR port map(salidaB(11), serialin, salidaP(4));
  54.    
  55.     CRC(0) <= salidaB(11);
  56.     CRC(1) <= salidaB(10);
  57.     CRC(2) <= salidaB(9);
  58.     CRC(3) <= salidaB(8);
  59.     CRC(4) <= salidaB(7);
  60.     CRC(5) <= salidaB(6);
  61.     CRC(6) <= salidaB(5);
  62.     CRC(7) <= salidaB(4);
  63.     CRC(8) <= salidaB(3);
  64.     CRC(9) <= salidaB(2);
  65.     CRC(10) <= salidaB(1);
  66.     CRC(11) <= salidaB(0);
  67. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment