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/] [standard_stage.vhd] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 JonasDC
------------------------------------------------------------------------------------ 
2
--                      
3
-- Geoffrey Ottoy - DraMCo research group
4
--
5
-- Module Name: standard_stage.vhd / entity standard_stage
6
-- 
7
-- Last Modified:       24/11/2011 
8
-- 
9
-- Description:         standard stage for use in the montgommery multiplier systolic
10
--                                              array pipeline
11
--
12
--
13
-- Dependencies:        standard_cell_block,
14
--                                              register_n,
15
--                                              register_1b,
16
--                                              d_flip_flop
17
--
18
-- Revision:
19
-- Revision 4.00 - Removed input registers and used start signal as load_out_regs
20
-- Revision 3.00 - Removed "a" input and replaced with "a_msb" (which is the only one 
21
--                 that matters.
22
-- Revision 2.02 - removed "ready" output signal
23
-- Revision 2.01 - replaced the behavioral description of the registers with a
24
--                 component instantiation
25
-- Revision 2.00 - added registers to store input values xin, cin, qin (because they
26
--                                          can change during operation)
27
-- Revision 1.03 - added done pulse
28
-- Revision 1.02 - appended "_i" to name of all internal signals
29
-- Revision 1.01 - ready is '1' after reset
30
--      Revision 1.00 - Architecture
31
--      Revision 0.01 - File Created
32
--
33
--
34
------------------------------------------------------------------------------------
35
--
36
-- NOTICE:
37
--
38
-- Copyright DraMCo research group. 2011. This code may be contain portions patented
39
-- by other third parties!
40
--
41
------------------------------------------------------------------------------------
42
library IEEE;
43
use IEEE.STD_LOGIC_1164.ALL;
44
use IEEE.STD_LOGIC_ARITH.ALL;
45
use IEEE.STD_LOGIC_UNSIGNED.ALL;
46
 
47
---- Uncomment the following library declaration if instantiating
48
---- any Xilinx primitives in this code.
49
--library UNISIM;
50
--use UNISIM.VComponents.all;
51
 
52
entity standard_stage is
53
        generic(width : integer := 32
54
        );
55
   port(core_clk : in  STD_LOGIC;
56
                             my : in  STD_LOGIC_VECTOR((width-1) downto 0);
57
               y : in  STD_LOGIC_VECTOR((width-1) downto 0);
58
               m : in  STD_LOGIC_VECTOR((width-1) downto 0);
59
             xin : in  STD_LOGIC;
60
             qin : in  STD_LOGIC;
61
                           xout : out STD_LOGIC;
62
            qout : out STD_LOGIC;
63
                          a_msb : in  STD_LOGIC;
64
                            cin : in  STD_LOGIC;
65
                           cout : out STD_LOGIC;
66
                          start : in  STD_LOGIC;
67
                          reset : in  STD_LOGIC;
68
        --                ready : out STD_LOGIC;
69
                           done : out STD_LOGIC;
70
               r : out STD_LOGIC_VECTOR((width-1) downto 0)
71
        );
72
end standard_stage;
73
 
74
architecture Structural of standard_stage is
75
        component d_flip_flop
76
   port(core_clk : in  STD_LOGIC;
77
                          reset : in  STD_LOGIC;
78
                            din : in  STD_LOGIC;
79
                      dout : out STD_LOGIC
80
        );
81
        end component;
82
 
83
        component register_1b
84
   port(core_clk : in  STD_LOGIC;
85
                             ce : in  STD_LOGIC;
86
                          reset : in  STD_LOGIC;
87
                            din : in  STD_LOGIC;
88
                      dout : out STD_LOGIC
89
        );
90
        end component;
91
 
92
        component register_n
93
        generic( n : integer := 4
94
        );
95
   port(core_clk : in  STD_LOGIC;
96
                             ce : in  STD_LOGIC;
97
                          reset : in  STD_LOGIC;
98
                            din : in  STD_LOGIC_VECTOR((n-1) downto 0);
99
                      dout : out STD_LOGIC_VECTOR((n-1) downto 0)
100
        );
101
        end component;
102
 
103
        component standard_cell_block
104
        generic ( width : integer := 32
105
        );
106
   Port ( my : in  STD_LOGIC_VECTOR((width-1) downto 0);
107
           y : in  STD_LOGIC_VECTOR((width-1) downto 0);
108
           m : in  STD_LOGIC_VECTOR((width-1) downto 0);
109
           x : in  STD_LOGIC;
110
           q : in  STD_LOGIC;
111
                          a : in  STD_LOGIC_VECTOR((width-1) downto 0);
112
                          cin : in STD_LOGIC;
113
                          cout : out STD_LOGIC;
114
           r : out  STD_LOGIC_VECTOR((width-1) downto 0));
115
        end component;
116
 
117
        -- input
118
        signal cin_i : std_logic;
119
        signal xin_i : std_logic;
120
        signal qin_i : std_logic;
121
        signal a_msb_i : std_logic;
122
--      signal cin_reg_i : std_logic;
123
--      signal xin_reg_i : std_logic;
124
--      signal qin_reg_i : std_logic;
125
--      signal a_msb_reg_i : std_logic;
126
 
127
        -- output
128
        signal cout_i : std_logic;
129
        signal r_i : std_logic_vector((width-1) downto 0);
130
        signal cout_reg_i : std_logic;
131
        signal xout_reg_i : std_logic;
132
        signal qout_reg_i : std_logic;
133
        signal r_reg_i : std_logic_vector((width-1) downto 0);
134
 
135
        -- interconnect
136
        signal a_i : std_logic_vector((width-1) downto 0);
137
 
138
        -- control
139
--      signal load_out_regs_i : std_logic;
140
        signal done_i : std_logic := '1';
141
        --signal ready_del_i : std_logic := '1';
142
begin
143
        -- map internal signals to outputs
144
        done <= done_i;
145
        r <= r_reg_i;
146
        cout <= cout_reg_i;
147
        qout <= qout_reg_i;
148
        xout <= xout_reg_i;
149
                -- two posibilities:
150
        --done <= ready_i and (not ready_del_i); -- slow
151
        --done <= not ready_i; -- faster but not sure if it will work (DONE_PROC can be omitted)
152
 
153
        -- map inputs to internal signals
154
        xin_i <= xin;
155
        qin_i <= qin;
156
        cin_i <= cin;
157
        a_msb_i <= a_msb;
158
 
159
--      a_i <= a_msb_reg_i & r_reg_i((width-1) downto 1);
160
        a_i <= a_msb_i & r_reg_i((width-1) downto 1);
161
 
162
        -- input registers
163
--      A_REG: register_1b
164
--   port map(core_clk => core_clk,
165
--                           ce => start,
166
--                        reset => reset,
167
--                          din => a_msb_i,
168
--                    dout => a_msb_reg_i
169
--      );
170
 
171
--      XIN_REG: register_1b
172
--   port map(core_clk => core_clk,
173
--                           ce => start,
174
--                        reset => reset,
175
--                          din => xin_i,
176
--                    dout => xin_reg_i
177
--      );
178
 
179
--      QIN_REG: register_1b
180
--   port map(core_clk => core_clk,
181
--                           ce => start,
182
--                        reset => reset,
183
--                          din => qin_i,
184
--                    dout => qin_reg_i
185
--      );
186
 
187
--      CIN_REG: register_1b
188
--   port map(core_clk => core_clk,
189
--                           ce => start,
190
--                        reset => reset,
191
--                          din => cin_i,
192
--                    dout => cin_reg_i
193
--      );
194
 
195
        cell_block: standard_cell_block
196
        generic map( width => width
197
        )
198
   Port map( my => my,
199
                         y => y,
200
                         m => m,
201
--                       x => xin_reg_i,
202
--                       q => qin_reg_i,
203
                         x => xin_i,
204
                         q => qin_i,
205
                         a => a_i,
206
--                       cin => cin_reg_i,
207
                         cin => cin_i,
208
                         cout => cout_i,
209
                         r => r_i
210
        );
211
 
212
--      delay_1_cycle: d_flip_flop
213
--   port map(core_clk => core_clk,
214
--                        reset => reset,
215
--                          din => start,
216
--                    dout => load_out_regs_i
217
--      );
218
 
219
        done_signal: d_flip_flop
220
   port map(core_clk => core_clk,
221
                          reset => reset,
222
--                          din => load_out_regs_i,
223
                                 din => start,
224
                      dout => done_i
225
        );
226
 
227
        -- output registers
228
        RESULT_REG: register_n
229
        generic map( n => width
230
        )
231
   port map(core_clk => core_clk,
232
--                           ce => load_out_regs_i,
233
                                  ce => start,
234
                          reset => reset,
235
                            din => r_i,
236
                      dout => r_reg_i
237
        );
238
 
239
        XOUT_REG: register_1b
240
   port map(core_clk => core_clk,
241
--                           ce => load_out_regs_i,
242
                                  ce => start,
243
                          reset => reset,
244
--                          din => xin_reg_i,
245
                                 din => xin_i,
246
                      dout => xout_reg_i
247
        );
248
 
249
        QOUT_REG: register_1b
250
   port map(core_clk => core_clk,
251
--                           ce => load_out_regs_i,
252
                                  ce => start,
253
                          reset => reset,
254
--                          din => qin_reg_i,
255
                                 din => qin_i,
256
                      dout => qout_reg_i
257
        );
258
 
259
        COUT_REG: register_1b
260
   port map(core_clk => core_clk,
261
--                           ce => load_out_regs_i,
262
                                  ce => start,
263
                          reset => reset,
264
                            din => cout_i,
265
                      dout => cout_reg_i
266
        );
267
 
268
end Structural;

powered by: WebSVN 2.1.0

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