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 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jdoin
-----------------------------------------------------------------------------------------------------------------------
2 6 jdoin
-- Author:          Jonny Doin, jdoin@opencores.org, jonnydoin@gmail.com, jonnydoin@gridvortex.com
3 2 jdoin
-- 
4 6 jdoin
-- Create Date:     09:56:30 05/06/2016  
5 2 jdoin
-- 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 6 jdoin
--                                                                   
18
--      This file is part of the SHA256 HASH CORE project http://opencores.org/project,sha256_hash_core
19
--                                                                   
20
--      Author(s):      Jonny Doin, jdoin@opencores.org, jonnydoin@gridvortex.com, jonnydoin@gmail.com
21
--                                                                   
22
--      Copyright (C) 2016 Jonny Doin
23
--      -----------------------------
24
--                                                                   
25
--      This source file may be used and distributed without restriction provided that this copyright statement is not    
26
--      removed from the file and that any derivative work contains the original copyright notice and the associated 
27
--      disclaimer. 
28
--                                                                   
29
--      This source file is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 
30
--      General Public License as published by the Free Software Foundation; either version 2.1 of the License, or 
31
--      (at your option) any later version.
32
--                                                                   
33
--      This source is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
34
--      warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more  
35
--      details.
36
--
37
--      You should have received a copy of the GNU Lesser General Public License along with this source; if not, download 
38
--      it from http://www.gnu.org/licenses/lgpl.txt
39
--                                                                   
40 2 jdoin
------------------------------ REVISION HISTORY -----------------------------------------------------------------------
41
--
42
-- 2016/05/22   v0.01.0010  [JD]    started development. design of blocks and port interfaces.
43
-- 2016/06/05   v0.01.0090  [JD]    all modules integrated. testbench for basic test vectors verification.
44
-- 2016/06/05   v0.01.0095  [JD]    verification failed. misalignment of words in the datapath. 
45
-- 2016/06/06   v0.01.0100  [JD]    first simulation verification against NIST-FIPS-180-4 test vectors passed.
46
--
47
-----------------------------------------------------------------------------------------------------------------------
48
--  TODO
49
--  ====
50
--
51
--
52
-----------------------------------------------------------------------------------------------------------------------
53
 
54
 
55
library ieee;
56
use ieee.std_logic_1164.all;
57
use ieee.numeric_std.all;
58
 
59
entity sha256_kt_rom is
60
    port (
61
        addr_i : in std_logic_vector(5 downto 0) := (others => '0');    -- address of the Kt constant
62
        dout_o : out std_logic_vector(31 downto 0)                      -- output delayed one clock
63
    );
64
end sha256_kt_rom;
65
 
66
architecture behavioral of sha256_kt_rom is
67
    signal addr : integer range 0 to 63;
68
    signal next_rout : std_logic_vector (31 downto 0);
69
begin
70
    --=============================================================================================
71
    -- COEFFICIENTS ROM
72
    --=============================================================================================
73
    -- The coefficients for the block hash are synthesized as an unregistered 64x32bit ROM.
74
 
75
    addr <= to_integer(unsigned(addr_i));
76
 
77
    -- The ROM is a 5-bit select MUX
78
    next_rout <=    x"428a2f98" when addr =  0 else
79
                    x"71374491" when addr =  1 else
80
                    x"b5c0fbcf" when addr =  2 else
81
                    x"e9b5dba5" when addr =  3 else
82
                    x"3956c25b" when addr =  4 else
83
                    x"59f111f1" when addr =  5 else
84
                    x"923f82a4" when addr =  6 else
85
                    x"ab1c5ed5" when addr =  7 else
86
                    x"d807aa98" when addr =  8 else
87
                    x"12835b01" when addr =  9 else
88
                    x"243185be" when addr = 10 else
89
                    x"550c7dc3" when addr = 11 else
90
                    x"72be5d74" when addr = 12 else
91
                    x"80deb1fe" when addr = 13 else
92
                    x"9bdc06a7" when addr = 14 else
93
                    x"c19bf174" when addr = 15 else
94
                    x"e49b69c1" when addr = 16 else
95
                    x"efbe4786" when addr = 17 else
96
                    x"0fc19dc6" when addr = 18 else
97
                    x"240ca1cc" when addr = 19 else
98
                    x"2de92c6f" when addr = 20 else
99
                    x"4a7484aa" when addr = 21 else
100
                    x"5cb0a9dc" when addr = 22 else
101
                    x"76f988da" when addr = 23 else
102
                    x"983e5152" when addr = 24 else
103
                    x"a831c66d" when addr = 25 else
104
                    x"b00327c8" when addr = 26 else
105
                    x"bf597fc7" when addr = 27 else
106
                    x"c6e00bf3" when addr = 28 else
107
                    x"d5a79147" when addr = 29 else
108
                    x"06ca6351" when addr = 30 else
109
                    x"14292967" when addr = 31 else
110
                    x"27b70a85" when addr = 32 else
111
                    x"2e1b2138" when addr = 33 else
112
                    x"4d2c6dfc" when addr = 34 else
113
                    x"53380d13" when addr = 35 else
114
                    x"650a7354" when addr = 36 else
115
                    x"766a0abb" when addr = 37 else
116
                    x"81c2c92e" when addr = 38 else
117
                    x"92722c85" when addr = 39 else
118
                    x"a2bfe8a1" when addr = 40 else
119
                    x"a81a664b" when addr = 41 else
120
                    x"c24b8b70" when addr = 42 else
121
                    x"c76c51a3" when addr = 43 else
122
                    x"d192e819" when addr = 44 else
123
                    x"d6990624" when addr = 45 else
124
                    x"f40e3585" when addr = 46 else
125
                    x"106aa070" when addr = 47 else
126
                    x"19a4c116" when addr = 48 else
127
                    x"1e376c08" when addr = 49 else
128
                    x"2748774c" when addr = 50 else
129
                    x"34b0bcb5" when addr = 51 else
130
                    x"391c0cb3" when addr = 52 else
131
                    x"4ed8aa4a" when addr = 53 else
132
                    x"5b9cca4f" when addr = 54 else
133
                    x"682e6ff3" when addr = 55 else
134
                    x"748f82ee" when addr = 56 else
135
                    x"78a5636f" when addr = 57 else
136
                    x"84c87814" when addr = 58 else
137
                    x"8cc70208" when addr = 59 else
138
                    x"90befffa" when addr = 60 else
139
                    x"a4506ceb" when addr = 61 else
140
                    x"bef9a3f7" when addr = 62 else
141
                    x"c67178f2";
142
 
143
    --=============================================================================================
144
    -- OUTPUT LOGIC                         
145
    --=============================================================================================
146
    -- connect output port                  
147
 
148
    dout_o_proc:    dout_o <= next_rout;
149
 
150
end behavioral;
151
 
152
 

powered by: WebSVN 2.1.0

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