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

Subversion Repositories nfcc

[/] [nfcc/] [trunk/] [rijndael/] [cipher/] [c8b.vhdl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 arif_endro
-- ------------------------------------------------------------------------
2
-- Copyright (C) 2010 Arif Endro Nugroho
3
-- All rights reserved.
4
-- 
5
-- Redistribution and use in source and binary forms, with or without
6
-- modification, are permitted provided that the following conditions
7
-- are met:
8
-- 
9
-- 1. Redistributions of source code must retain the above copyright
10
--    notice, this list of conditions and the following disclaimer.
11
-- 2. Redistributions in binary form must reproduce the above copyright
12
--    notice, this list of conditions and the following disclaimer in the
13
--    documentation and/or other materials provided with the distribution.
14
-- 
15
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
16
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
19
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
-- POSSIBILITY OF SUCH DAMAGE.
26
-- 
27
-- End Of License.
28
-- ------------------------------------------------------------------------
29
 
30
library ieee;
31
use ieee.std_logic_1164.all;
32
use ieee.std_logic_unsigned.all;
33
 
34
entity c6b is
35
  port (
36
  cnt : out bit_vector (  7 downto 0);
37
  clk : in  bit;
38
  rst : in  bit
39
  );
40
end c6b;
41
 
42
architecture phy of c6b is
43
  signal sum : bit_vector (  7 downto 0); -- sum
44
  signal cr  : bit_vector (  7 downto 0); -- carry
45
  begin
46
    cr(0)            <= '0'; -- LSB always zero
47
    cr(7 downto 1) <= ( ((sum(6 downto 0) and B"0000001") or (sum(6 downto 0) and cr(6 downto 0))) or (B"0000001" and cr(6 downto 0)) );
48
    process (clk)
49
    begin
50
      if (clk = '1' and clk'event) then
51
        if (rst = '1') then
52
          sum <= B"00000000";
53
        else
54
          sum <= ((sum xor B"00000001") xor cr); -- sum = ((addend xor augend) xor carry)
55
        end if;
56
      end if;
57
    end process;
58
    cnt <= sum;
59
end phy;

powered by: WebSVN 2.1.0

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