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

Subversion Repositories mod_sim_exp

[/] [mod_sim_exp/] [tags/] [start_version/] [rtl/] [vhdl/] [core/] [modulus_ram.vhd] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 JonasDC
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    13:57:21 03/08/2012 
6
-- Design Name: 
7
-- Module Name:    modulus_ram - 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 modulus_ram is
31
        port(
32
                clk : in std_logic;
33
                modulus_addr : in std_logic_vector(5 downto 0);
34
                write_modulus : in std_logic;
35
                modulus_in : in std_logic_vector(31 downto 0);
36
                modulus_out : out std_logic_vector(1535 downto 0)
37
        );
38
end modulus_ram;
39
 
40
architecture Behavioral of modulus_ram is
41
        -- single port blockram to store modulus
42
        component operands_sp
43
        port(
44
                clka: in std_logic;
45
                wea: in std_logic_vector(0 downto 0);
46
                addra: in std_logic_vector(4 downto 0);
47
                dina: in std_logic_vector(31 downto 0);
48
                douta: out std_logic_vector(511 downto 0)
49
        );
50
        end component;
51
 
52
        signal part_enable : std_logic_vector(3 downto 0);
53
        signal wea : std_logic_vector(3 downto 0);
54
        signal addra : std_logic_vector(4 downto 0);
55
begin
56
 
57
        -- the blockram has a write depth of 2 but we only use the lower half
58
        addra <= '0' & modulus_addr(3 downto 0);
59
 
60
        -- the two highest bits of the address are used to select the bloc
61
        with modulus_addr(5 downto 4) select
62
                part_enable <= "0001" when "00",
63
                               "0010" when "01",
64
                                         "0100" when "10",
65
                                         "1000" when others;
66
 
67
        with write_modulus select
68
                wea <= part_enable when '1',
69
                       "0000" when others;
70
 
71
        -- 4 instances of 512 bits blockram
72
        modulus_0 : operands_sp
73
        port map (
74
                        clka => clk,
75
                        wea => wea(0 downto 0),
76
                        addra => addra,
77
                        dina => modulus_in,
78
                        douta => modulus_out(511 downto 0)
79
        );
80
 
81
        modulus_1 : operands_sp
82
        port map (
83
                        clka => clk,
84
                        wea => wea(1 downto 1),
85
                        addra => addra,
86
                        dina => modulus_in,
87
                        douta => modulus_out(1023 downto 512)
88
        );
89
 
90
        modulus_2 : operands_sp
91
        port map (
92
                        clka => clk,
93
                        wea => wea(2 downto 2),
94
                        addra => addra,
95
                        dina => modulus_in,
96
                        douta => modulus_out(1535 downto 1024)
97
        );
98
 
99
--      modulus_3 : operands_sp
100
--      port map (
101
--                      clka => clk,
102
--                      wea => wea(3 downto 3),
103
--                      addra => addra,
104
--                      dina => modulus_in,
105
--                      douta => modulus_out(2047 downto 1536)
106
--      );
107
 
108
end Behavioral;
109
 

powered by: WebSVN 2.1.0

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