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

Subversion Repositories rsa_512

[/] [rsa_512/] [trunk/] [rtl/] [m_calc.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 jcastillo
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    20:33:10 10/29/2009 
6
-- Design Name: 
7
-- Module Name:    m_calc - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.all;
22
use IEEE.STD_LOGIC_ARITH.all;
23
use IEEE.STD_LOGIC_UNSIGNED.all;
24
 
25
---- Uncomment the following library declaration if instantiating
26
---- any Xilinx primitives in this code.
27
--library UNISIM;
28
--use UNISIM.VComponents.all;
29
 
30
entity m_calc is
31
 
32
  port(
33
    clk        : in  std_logic;
34
    reset      : in  std_logic;
35
    ab         : in  std_logic_vector (15 downto 0);
36
    t          : in  std_logic_vector (15 downto 0);
37
    n_cons     : in  std_logic_vector (15 downto 0);
38
    m          : out std_logic_vector (15 downto 0);
39
    mult_valid : in  std_logic;         -- indica que los datos de entrada son validos
40
    m_valid    : out std_logic);        -- la m calculada es valida
41
end m_calc;
42
 
43
architecture Behavioral of m_calc is
44
 
45
 
46
 
47
  signal sum_res, next_sum_res      : std_logic_vector(15 downto 0);
48
  signal mult_valid_1, mult_valid_2 : std_logic;  --delay del valido a lo largo del calculo
49
  signal mult                       : std_logic_vector(31 downto 0);
50
begin
51
 
52
 
53
  mult <= sum_res * n_cons;
54
 
55
  process(clk, reset)
56
  begin
57
 
58
    if(clk = '1' and clk'event) then
59
 
60
      if(reset = '1') then
61
        sum_res      <= (others => '0');
62
        mult_valid_1 <= '0';
63
        mult_valid_2 <= '0';
64
      else
65
        sum_res      <= next_sum_res;
66
        mult_valid_1 <= mult_valid;
67
        mult_valid_2 <= mult_valid_1;
68
 
69
      end if;
70
 
71
    end if;
72
 
73
  end process;
74
 
75
  process(ab, t, mult_valid_2)
76
  begin
77
    m            <= mult(15 downto 0);
78
    next_sum_res <= ab+t;
79
    m_valid      <= mult_valid_2;
80
  end process;
81
 
82
end Behavioral;
83
 

powered by: WebSVN 2.1.0

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