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

Subversion Repositories securehash256bits

[/] [securehash256bits/] [trunk/] [sha256test.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 feketebv
--------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:
4
--
5
-- Create Date:   12:29:53 06/03/2013
6
-- Design Name:   
7
-- Module Name:   S:/project/sha256/sha256test.vhd
8
-- Project Name:  sha256
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description:   
12
-- 
13
-- VHDL Test Bench Created by ISE for module: sha256forBTC
14
-- 
15
-- Dependencies:
16
-- 
17
-- Revision:
18
-- Revision 0.01 - File Created
19
-- Additional Comments:
20
--
21
-- Notes: 
22
-- This testbench has been automatically generated using types std_logic and
23
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
24
-- that these types always be used for the top-level I/O of a design in order
25
-- to guarantee that the testbench will bind correctly to the post-implementation 
26
-- simulation model.
27
--------------------------------------------------------------------------------
28
LIBRARY ieee;
29
USE ieee.std_logic_1164.ALL;
30
 
31
-- Uncomment the following library declaration if using
32
-- arithmetic functions with Signed or Unsigned values
33
--USE ieee.numeric_std.ALL;
34
 
35
ENTITY sha256test IS
36
END sha256test;
37
 
38
ARCHITECTURE behavior OF sha256test IS
39
 
40
    -- Component Declaration for the Unit Under Test (UUT)
41
 
42
    COMPONENT sha256forBTC
43
    PORT(
44
         reset : IN  std_logic;
45
         clock : IN  std_logic;
46
         data : IN  std_logic_vector(511 downto 0);
47
         enable : IN  std_logic;
48
         busy : OUT  std_logic;
49
         digest : OUT  std_logic_vector(255 downto 0);
50
         ready : OUT  std_logic
51
        );
52
    END COMPONENT;
53
 
54
 
55
   --Inputs
56
   signal reset : std_logic := '0';
57
   signal clock : std_logic := '0';
58
   signal data : std_logic_vector(511 downto 0) := (others => '0');
59
   signal enable : std_logic := '0';
60
 
61
        --Outputs
62
   signal busy : std_logic;
63
   signal digest : std_logic_vector(255 downto 0);
64
   signal ready : std_logic;
65
 
66
   -- Clock period definitions
67
   constant clock_period : time := 10 ns;
68
   constant chunk0 : std_logic_vector(511 downto 0) := x"61626380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018";
69
   constant chunk1 : std_logic_vector(511 downto 0) := x"6162636462636465636465666465666765666768666768696768696a68696a6b696a6b6c6a6b6c6d6b6c6d6e6c6d6e6f6d6e6f706e6f70718000000000000000";
70
   constant chunk2 : std_logic_vector(511 downto 0) := x"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c0";
71
 
72
   constant hash2b0 : std_logic_vector(255 downto 0) := x"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad";
73
   constant hash2b12 : std_logic_vector(255 downto 0) := x"248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1";
74
 
75
   signal allesOK_0,allesOK_12 : std_logic := '0';
76
BEGIN
77
 
78
        -- Instantiate the Unit Under Test (UUT)
79
   uut: sha256forBTC PORT MAP (
80
          reset => reset,
81
          clock => clock,
82
          data => data,
83
          enable => enable,
84
          busy => busy,
85
          digest => digest,
86
          ready => ready
87
        );
88
 
89
   -- Clock process definitions
90
   clock_process :process
91
   begin
92
                clock <= '0';
93
                wait for clock_period/2;
94
                clock <= '1';
95
                wait for clock_period/2;
96
   end process;
97
 
98
 
99
   -- Stimulus process
100
   stim_proc: process
101
   begin
102
      wait for clock_period*10;
103
      --load chunk0: 1 chunk test vector
104
      reset <= '1';
105
      wait for clock_period;
106
      reset <= '0';
107
      data <= chunk0;
108
      enable <= '1';
109
      wait for clock_period;
110
      enable <= '0';
111
      wait for clock_period*65;
112
      --load chunk12: 2 chunks test vector
113
      reset <= '1';
114
      wait for clock_period;
115
      reset <= '0';
116
      data <= chunk1;
117
      enable <= '1';
118
      wait for clock_period;
119
      enable <= '0';
120
      wait for clock_period*64;
121
      data <= chunk2;
122
      enable <= '1';
123
      wait for clock_period;
124
      enable <= '0';
125
      wait for clock_period*65;
126
      wait;
127
   end process;
128
 
129
   allesOK_0 <= '1' when hash2b0 = digest else '0';
130
   allesOK_12 <= '1' when hash2b12 = digest else '0';
131
 
132
END;

powered by: WebSVN 2.1.0

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