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

Subversion Repositories btc_dsha256

[/] [btc_dsha256/] [trunk/] [rtl/] [vhdl/] [sha256core/] [btc_dsha.vhd] - Diff between revs 2 and 3

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 1... Line 1...
-- Copyright (c) 2013 VariStream
------------------------------------------------------------------- 
-- Auther : Yu Peng
--                                                               --
 
--  Copyright (C) 2013 Author and VariStream Studio              --
 
--  Author : Yu Peng                                             --
 
--                                                               -- 
 
--  This source file may be used and distributed without         -- 
 
--  restriction provided that this copyright statement is not    -- 
 
--  removed from the file and that any derivative work contains  -- 
 
--  the original copyright notice and the associated disclaimer. -- 
 
--                                                               -- 
 
--  This source file is free software; you can redistribute it   -- 
 
--  and/or modify it under the terms of the GNU Lesser General   -- 
 
--  Public License as published by the Free Software Foundation; -- 
 
--  either version 2.1 of the License, or (at your option) any   -- 
 
--  later version.                                               -- 
 
--                                                               -- 
 
--  This source is distributed in the hope that it will be       -- 
 
--  useful, but WITHOUT ANY WARRANTY; without even the implied   -- 
 
--  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      -- 
 
--  PURPOSE.  See the GNU Lesser General Public License for more -- 
 
--  details.                                                     -- 
 
--                                                               -- 
 
--  You should have received a copy of the GNU Lesser General    -- 
 
--  Public License along with this source; if not, download it   -- 
 
--  from http://www.opencores.org/lgpl.shtml                     -- 
 
--                                                               -- 
 
-------------------------------------------------------------------
 
 
library IEEE;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_arith.all;
Line 11... Line 36...
entity btc_dsha is
entity btc_dsha is
        generic(
        generic(
                gBASE_DELAY : integer := 1
                gBASE_DELAY : integer := 1
        );
        );
        port(
        port(
 
                iRst_async : in std_logic := '0';
 
 
                iClkReg : in std_logic := '0';
                iClkReg : in std_logic := '0';
                iClkProcess : in std_logic := '0';
                iClkProcess : in std_logic := '0';
                iRst_async : in std_logic := '0';
 
 
 
                iValid_p : in std_logic := '0';
                iValid_p : in std_logic := '0';
                ivAddr : in std_logic_vector(3 downto 0) := (others=>'0');
                ivAddr : in std_logic_vector(3 downto 0) := (others=>'0');
                ivData : in std_logic_vector(31 downto 0) := (others=>'0');
                ivData : in std_logic_vector(31 downto 0) := (others=>'0');
 
 
Line 106... Line 132...
                        oSyncReset              : out std_logic                                         -- Synchronous reset output
                        oSyncReset              : out std_logic                                         -- Synchronous reset output
                );
                );
        end component;
        end component;
 
 
        constant cCMD_ADDR : std_logic_vector(3 downto 0) := X"D";
        constant cCMD_ADDR : std_logic_vector(3 downto 0) := X"D";
        constant cCMD_IDLE : std_logic_vector(15 downto 0) := X"0000";
 
        constant cCMD_RESET : std_logic_vector(15 downto 0) := X"CAFE";
 
        constant cCMD_START : std_logic_vector(15 downto 0) := X"0001";
        constant cCMD_START : std_logic_vector(15 downto 0) := X"0001";
 
 
        constant cPROCESS_DEALY : std_logic_vector(15 downto 0) := conv_std_logic_vector(64 * gBASE_DELAY * 2 + 1, 16);
        constant cPROCESS_DEALY : std_logic_vector(15 downto 0) := conv_std_logic_vector(64 * gBASE_DELAY * 2 + 1, 16);
        constant cCMP_DELAY : std_logic_vector(15 downto 0) := conv_std_logic_vector(64 * gBASE_DELAY * 2 + 1 + 2, 16);
        constant cCMP_DELAY : std_logic_vector(15 downto 0) := conv_std_logic_vector(64 * gBASE_DELAY * 2 + 1 + 2, 16);
 
 
Line 136... Line 160...
        signal svStartNonce : std_logic_vector(31 downto 0) := (others=>'0');
        signal svStartNonce : std_logic_vector(31 downto 0) := (others=>'0');
        signal svEndNonce : std_logic_vector(31 downto 0) := (others=>'0');
        signal svEndNonce : std_logic_vector(31 downto 0) := (others=>'0');
        signal svNonce : std_logic_vector(31 downto 0) := (others=>'0');
        signal svNonce : std_logic_vector(31 downto 0) := (others=>'0');
        signal svCmd : std_logic_vector(15 downto 0) := (others=>'0');
        signal svCmd : std_logic_vector(15 downto 0) := (others=>'0');
        signal sCmdValid_syncReg_p : std_logic := '0';
        signal sCmdValid_syncReg_p : std_logic := '0';
        signal sCmdReset : std_logic := '0';
 
        signal sCmdStart_syncReg_p : std_logic := '0';
        signal sCmdStart_syncReg_p : std_logic := '0';
        signal sCmdStart_syncProcess_p : std_logic := '0';
        signal sCmdStart_syncProcess_p : std_logic := '0';
        signal sCmdStart_syncProcess_p_1d : std_logic := '0';
        signal sCmdStart_syncProcess_p_1d : std_logic := '0';
 
 
        signal sProcess : tProcessStateMachine := stIdle;
        signal sProcess : tProcessStateMachine := stIdle;
Line 163... Line 186...
        signal sCmpResultValid : std_logic := '0';
        signal sCmpResultValid : std_logic := '0';
        signal sFoundNonceToIdle : std_logic := '0';
        signal sFoundNonceToIdle : std_logic := '0';
        signal sReachEndToIdle : std_logic := '0';
        signal sReachEndToIdle : std_logic := '0';
 
 
begin
begin
 
 
        SyncReset_inst_Process : SyncReset
        SyncReset_inst_Process : SyncReset
                port map(
                port map(
                        iClk => iClkProcess,
                        iClk => iClkProcess,
                        iAsyncReset => iRst_async,
                        iAsyncReset => iRst_async,
                        oSyncReset => sReset_syncProcess
                        oSyncReset => sReset_syncProcess
Line 227... Line 251...
        end process;
        end process;
 
 
        process(iClkReg, iRst_async)
        process(iClkReg, iRst_async)
        begin
        begin
                if iRst_async = '1' then
                if iRst_async = '1' then
                        sCmdReset <= '0';
 
                        sCmdValid_syncReg_p <= '0';
                        sCmdValid_syncReg_p <= '0';
 
                        sCmdStart_syncReg_p <= '0';
                elsif rising_edge(iClkReg) then
                elsif rising_edge(iClkReg) then
                        if iValid_p = '1' and ivAddr = cCMD_ADDR then
                        if iValid_p = '1' and ivAddr = cCMD_ADDR then
                                if ivData(15 downto 0) = cCMD_RESET then
 
                                        sCmdReset <= '1';
 
                                else
 
                                        sCmdReset <= '0';
 
                                end if;
 
                        end if;
 
 
 
                        if iValid_p = '1' and ivAddr = cCMD_ADDR then
 
                                sCmdValid_syncReg_p <= '1';
                                sCmdValid_syncReg_p <= '1';
                        else
                        else
                                sCmdValid_syncReg_p <= '0';
                                sCmdValid_syncReg_p <= '0';
                        end if;
                        end if;
 
 

powered by: WebSVN 2.1.0

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