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

Subversion Repositories sha256_hash_core

[/] [sha256_hash_core/] [trunk/] [syn/] [sha256/] [sha256_Kt_rom.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 jdoin
-----------------------------------------------------------------------------------------------------------------------
2
-- Author:          Jonny Doin, jdoin@opencores.org, jonnydoin@gmail.com
3
-- 
4
-- Create Date:     09:56:30 07/06/2011  
5
-- Module Name:     sha256_kt_rom - RTL
6
-- Project Name:    sha256 processor
7
-- Target Devices:  Spartan-6
8
-- Tool versions:   ISE 14.7
9
-- Description: 
10
--
11
--      This is the 64 words coefficients rom for the block hash core.
12
--      It is modelled as an asynchronous addressable ROM memory.
13
--      Depending on the fabrication process and technology, this memory can be implemented
14
--      as a OTP, a MUX, a fixed LUT or a combinational function.
15
--
16
------------------------------ COPYRIGHT NOTICE -----------------------------------------------------------------------
17
--                                                                   
18
--                                                                   
19
--      Author(s):      Jonny Doin, jonnydoin@gridvortex.com, jonnydoin@gmail.com
20
--                                                                   
21
--      Copyright (C) 2016 GridVortex, All Rights Reserved
22
--      --------------------------------------------------
23
--                                                                   
24
------------------------------ REVISION HISTORY -----------------------------------------------------------------------
25
--
26
-- 2016/05/22   v0.01.0010  [JD]    started development. design of blocks and port interfaces.
27
-- 2016/06/05   v0.01.0090  [JD]    all modules integrated. testbench for basic test vectors verification.
28
-- 2016/06/05   v0.01.0095  [JD]    verification failed. misalignment of words in the datapath. 
29
-- 2016/06/06   v0.01.0100  [JD]    first simulation verification against NIST-FIPS-180-4 test vectors passed.
30
--
31
-----------------------------------------------------------------------------------------------------------------------
32
--  TODO
33
--  ====
34
--
35
--
36
-----------------------------------------------------------------------------------------------------------------------
37
 
38
 
39
library ieee;
40
use ieee.std_logic_1164.all;
41
use ieee.numeric_std.all;
42
 
43
entity sha256_kt_rom is
44
    port (
45
        addr_i : in std_logic_vector(5 downto 0) := (others => '0');    -- address of the Kt constant
46
        dout_o : out std_logic_vector(31 downto 0)                      -- output delayed one clock
47
    );
48
end sha256_kt_rom;
49
 
50
architecture behavioral of sha256_kt_rom is
51
    signal addr : integer range 0 to 63;
52
    signal next_rout : std_logic_vector (31 downto 0);
53
begin
54
    --=============================================================================================
55
    -- COEFFICIENTS ROM
56
    --=============================================================================================
57
    -- The coefficients for the block hash are synthesized as an unregistered 64x32bit ROM.
58
 
59
    addr <= to_integer(unsigned(addr_i));
60
 
61
    -- The ROM is a 5-bit select MUX
62
    next_rout <=    x"428a2f98" when addr =  0 else
63
                    x"71374491" when addr =  1 else
64
                    x"b5c0fbcf" when addr =  2 else
65
                    x"e9b5dba5" when addr =  3 else
66
                    x"3956c25b" when addr =  4 else
67
                    x"59f111f1" when addr =  5 else
68
                    x"923f82a4" when addr =  6 else
69
                    x"ab1c5ed5" when addr =  7 else
70
                    x"d807aa98" when addr =  8 else
71
                    x"12835b01" when addr =  9 else
72
                    x"243185be" when addr = 10 else
73
                    x"550c7dc3" when addr = 11 else
74
                    x"72be5d74" when addr = 12 else
75
                    x"80deb1fe" when addr = 13 else
76
                    x"9bdc06a7" when addr = 14 else
77
                    x"c19bf174" when addr = 15 else
78
                    x"e49b69c1" when addr = 16 else
79
                    x"efbe4786" when addr = 17 else
80
                    x"0fc19dc6" when addr = 18 else
81
                    x"240ca1cc" when addr = 19 else
82
                    x"2de92c6f" when addr = 20 else
83
                    x"4a7484aa" when addr = 21 else
84
                    x"5cb0a9dc" when addr = 22 else
85
                    x"76f988da" when addr = 23 else
86
                    x"983e5152" when addr = 24 else
87
                    x"a831c66d" when addr = 25 else
88
                    x"b00327c8" when addr = 26 else
89
                    x"bf597fc7" when addr = 27 else
90
                    x"c6e00bf3" when addr = 28 else
91
                    x"d5a79147" when addr = 29 else
92
                    x"06ca6351" when addr = 30 else
93
                    x"14292967" when addr = 31 else
94
                    x"27b70a85" when addr = 32 else
95
                    x"2e1b2138" when addr = 33 else
96
                    x"4d2c6dfc" when addr = 34 else
97
                    x"53380d13" when addr = 35 else
98
                    x"650a7354" when addr = 36 else
99
                    x"766a0abb" when addr = 37 else
100
                    x"81c2c92e" when addr = 38 else
101
                    x"92722c85" when addr = 39 else
102
                    x"a2bfe8a1" when addr = 40 else
103
                    x"a81a664b" when addr = 41 else
104
                    x"c24b8b70" when addr = 42 else
105
                    x"c76c51a3" when addr = 43 else
106
                    x"d192e819" when addr = 44 else
107
                    x"d6990624" when addr = 45 else
108
                    x"f40e3585" when addr = 46 else
109
                    x"106aa070" when addr = 47 else
110
                    x"19a4c116" when addr = 48 else
111
                    x"1e376c08" when addr = 49 else
112
                    x"2748774c" when addr = 50 else
113
                    x"34b0bcb5" when addr = 51 else
114
                    x"391c0cb3" when addr = 52 else
115
                    x"4ed8aa4a" when addr = 53 else
116
                    x"5b9cca4f" when addr = 54 else
117
                    x"682e6ff3" when addr = 55 else
118
                    x"748f82ee" when addr = 56 else
119
                    x"78a5636f" when addr = 57 else
120
                    x"84c87814" when addr = 58 else
121
                    x"8cc70208" when addr = 59 else
122
                    x"90befffa" when addr = 60 else
123
                    x"a4506ceb" when addr = 61 else
124
                    x"bef9a3f7" when addr = 62 else
125
                    x"c67178f2";
126
 
127
    --=============================================================================================
128
    -- OUTPUT LOGIC                         
129
    --=============================================================================================
130
    -- connect output port                  
131
 
132
    dout_o_proc:    dout_o <= next_rout;
133
 
134
end behavioral;
135
 
136
 

powered by: WebSVN 2.1.0

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