OpenCores
URL https://opencores.org/ocsvn/bluetooth/bluetooth/trunk

Subversion Repositories bluetooth

[/] [bluetooth/] [trunk/] [code/] [cores/] [HEC/] [generator/] [tb/] [hec_gen.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 khatib
-------------------------------------------------------------------------------
2
-- Title      :  HEC generator
3
-- Project    :  Bluetooth baseband core
4
-------------------------------------------------------------------------------
5
-- File        : hec_gen.vhd
6
-- Author      : Jamil Khatib  (khatib@ieee.org)
7
-- Organization: OpenIPCore Project
8
-- Created     : 2000/12/28
9
-- Last update : 2000/12/28
10
-- Platform    : 
11
-- Simulators  : Modelsim 5.3XE/Windows98
12
-- Synthesizers: Leonardo/WindowsNT
13
-- Target      : 
14
-- Dependency  : ieee.std_logic_1164
15
-------------------------------------------------------------------------------
16
-- Description: HEC generator core
17
-------------------------------------------------------------------------------
18
-- Copyright (c) 2000 Jamil Khatib
19
-- 
20
-- This VHDL design file is an open design; you can redistribute it and/or
21
-- modify it and/or implement it after contacting the author
22
-- You can check the draft license at
23
-- http://www.opencores.org/OIPC/license.shtml
24
 
25
-------------------------------------------------------------------------------
26
-- Revisions  :
27
-- Revision Number :   1
28
-- Version         :   0.1
29
-- Date            :   28 Dec 2000
30
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
31
-- Desccription    :   Created
32
-- Known bugs      :   
33
-- To Optimze      :  
34
-------------------------------------------------------------------------------
35
 
36
library ieee;
37
use ieee.std_logic_1164.all;
38
 
39
use work.PCK_CRC8_D8.all;
40
 
41
entity HECgen_ent is
42
 
43
  port (
44
    clk    : in  std_logic;                     -- system clock
45
    rst    : in  std_logic;                     -- system reset
46
    header : in  std_logic_vector(9 downto 0);  -- header data
47
    hec    : out std_logic_vector(7 downto 0);  -- HEC 8 bit value
48
    init   : in  std_logic_vector(7 downto 0);  -- init value
49
    load   : in  std_logic);                    -- load header
50
 
51
end HECgen_ent;
52
 
53
architecture HECgen_beh of HECgen_ent is
54
 
55
signal tsthec : std_logic_vector(7 downto 0);
56
 
57
begin  -- HECgen_beh
58
 
59
tsthec <= nextCRC8_D8(header(9 downto 2), (others=> '1'));
60
 
61
 
62
  -- purpose: Generate HEC
63
  -- type   : sequential
64
  -- inputs : clk, rst
65
  -- outputs: 
66
  generate_proc : process (clk, rst)
67
 
68
    variable lfsr         : std_logic_vector(7 downto 0);  -- LFSR (HEC register)
69
    variable feedback_var : std_logic;  -- feed back variable
70
 
71
  begin  -- process generate_proc
72
    if rst = '0' then                   -- asynchronous reset (active low)
73
 
74
      lfsr := (others => '0');
75
      HEC  <= (others => '0');
76
 
77
    elsif clk'event and clk = '1' then  -- rising clock edge
78
 
79
      if load = '1' then
80
 
81
        lfsr := init;
82
 
83
      else
84
 
85
        for i in 9 downto 0 loop
86
 
87
          feedback_var := header(i) xor lfsr(7);
88
 
89
          lfsr(7) := feedback_var xor lfsr(6);
90
          lfsr(6) := lfsr(5);
91
          lfsr(5) := feedback_var xor lfsr(4);
92
          lfsr(4) := lfsr(3);
93
          lfsr(3) := lfsr(2);
94
          lfsr(2) := feedback_var xor lfsr(1);
95
          lfsr(1) := feedback_var xor lfsr(0);
96
          lfsr(0) := feedback_var;
97
 
98
        end loop;  -- i
99
 
100
 
101
      end if;
102
 
103
      HEC <= lfsr;
104
 
105
    end if;
106
 
107
  end process generate_proc;
108
 
109
end HECgen_beh;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.