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

Subversion Repositories raytrac

[/] [raytrac/] [trunk/] [uf.vhd] - Blame information for rev 77

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 jguarin200
--! @file raytrac.vhd
2 67 jguarin200
--! @brief Descripción del sistema aritmetico usado por raytrac.
3 52 jguarin200
--! @author Juli´n Andrés Guarín Reyes.
4 8 jguarin200
-- RAYTRAC
5
-- Author Julian Andres Guarin
6
-- uf.vhd
7
-- This file is part of raytrac.
8
-- 
9
--     raytrac is free software: you can redistribute it and/or modify
10
--     it under the terms of the GNU General Public License as published by
11
--     the Free Software Foundation, either version 3 of the License, or
12
--     (at your option) any later version.
13
-- 
14
--     raytrac is distributed in the hope that it will be useful,
15
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
16
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
--     GNU General Public License for more details.
18
-- 
19
--     You should have received a copy of the GNU General Public License
20
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>.
21
 
22 52 jguarin200
--! Libreria de definicion de senales y tipos estandares, comportamiento de operadores aritmeticos y logicos.
23 2 jguarin200
library ieee;
24 52 jguarin200
--! Paquete de definicion estandard de logica. 
25 2 jguarin200
use ieee.std_logic_1164.all;
26 27 jguarin200
 
27
--! Paquete para el manejo de aritmŽtica con signo sobre el tipo std_logic_vector 
28
use ieee.std_logic_signed.all;
29
 
30 50 jguarin200
--! Paquete estandar de texto
31
use std.textio.all;
32
 
33 52 jguarin200
--! Se usaran en esta descripcion los componentes del package arithpack.vhd. 
34 2 jguarin200
use work.arithpack.all;
35
 
36 22 jguarin200
 
37 67 jguarin200
--! uf es la descripci&oacute;on del circuito que realiza la aritm&eacute;tica del Rt Engine.
38 22 jguarin200
 
39 67 jguarin200
--! La entrada opcode indica la operaci&oacute;n que se est&aacute; realizando, en los sumadores, es la misma se&ntilde;al que se encuentra en la entidad opcoder, que selecciona si se est&aacute; realizando un producto punto o un producto cruz. Dentro de la arquitectura de uf, la se&ntilde;al opcode selecciona en la primera etapa de sumadores, si la operaci&oacute;n a realizar ser&aacute; una resta o una suma. 
40
--! Los resultados estar&acute;n en distintas salidas dependiendo de la operaci&oacute;n, lo cual es apenas natural: El producto cruz tiene por resultado un vector, mientras que el producto punto tiene por resultado un escalar. 
41
--! Esta entidad utiliza las se&ntilde;ales de control clk y rst.
42 22 jguarin200
--! \n\n
43 67 jguarin200
--! La caracter&iacute;stica fundamental de uf, es que puede realizar 2 operaciones de producto punto al mimso tiempo &oacute; una operaci&oacute;n de producto cruz. La otra caracter&iacute;stica importante es que el pipe de producto punto es mas largo que el pipe de producto cruz: el producto punto tomar&acute; 3 clocks para realizarse, mientras que el procto punto tomara 4 clocks para realizarse.    
44 22 jguarin200
 
45 27 jguarin200
entity uf is
46
        generic (
47 32 jguarin200
                        use_std_logic_signed : string := "NO";
48 50 jguarin200
                        testbench_generation : string := "NO";
49 32 jguarin200
                        carry_logic : string := "CLA"
50 27 jguarin200
        );
51 2 jguarin200
        port (
52 67 jguarin200
                opcode          : in std_logic; --! Entrada que dentro de la arquitectura funciona como selector de la operaci&oacute;n que se lleva a cabo en la primera etapa de sumadores/restadores. 
53
                m0f0,m0f1,m1f0,m1f1,m2f0,m2f1,m3f0,m3f1,m4f0,m4f1,m5f0,m5f1 : in std_logic_vector(17 downto 0); --! Entradas que van conectadas a los multiplicadores en la primera etapa de la descripci&oacute;n.  
54 77 jguarin200
                cpx,cpy,cpz,dp0,dp1,kvx0,kvy0,kvz0,kvx1,kvy1,kvz1 : out std_logic_vector(31 downto 0); --! Salidas donde se registran los resultados de las operaciones aritm&eacute;ticas: cpx,cpy,cpz ser&acute;n los componentes del vector que da por resultado el producto cruz entre los vectores AxB &oacute; CxD. kvx0, kvy0, kvz0, kvx1, kvy1, kvz1 es el resultado de los multiplicadores   
55 22 jguarin200
                clk,rst         : in std_logic --! Las entradas de control usuales.  
56 2 jguarin200
        );
57
end uf;
58
 
59
architecture uf_arch of uf is
60
 
61 8 jguarin200
        -- Stage 0 signals
62 2 jguarin200
 
63 22 jguarin200
        signal stage0mf00,stage0mf01,stage0mf10,stage0mf11,stage0mf20,stage0mf21,stage0mf30,stage0mf31,stage0mf40,stage0mf41,stage0mf50,stage0mf51 : std_logic_vector(17 downto 0); --! Señales que conectan los operandos seleccionados en opcode a las entradas de los multiplicadores.
64
        signal stage0p0,stage0p1, stage0p2, stage0p3, stage0p4, stage0p5 : std_logic_vector(31 downto 0); --! Señales / buses, con los productos de los multiplicadores. 
65 28 jguarin200
        signal stageMopcode : std_logic; --! Señal de atraso del opcode. Revisar el diagrama de bloques para mayor claridad.
66 2 jguarin200
 
67 8 jguarin200
        --Stage 1 signals 
68 2 jguarin200
 
69 22 jguarin200
        signal stage1p0, stage1p1, stage1p2, stage1p3, stage1p4, stage1p5 : std_logic_vector (31 downto 0); --! Señales provenientes de los productos de la etapa previa de multiplicadores.
70
        signal stage1a0, stage1a1, stage1a2 : std_logic_vector (31 downto 0); --! Señales / buses, con los resultados de los sumadores. 
71 67 jguarin200
        signal stageSRopcode : std_logic; --! Señal proveniente del opcode que selecciona si los sumadores deben ejecutar una resta o una suma dependiendo de la operaci&oacute;n que se ejecute en ese momento del pipe.  
72 2 jguarin200
 
73 8 jguarin200
        -- Some support signals
74 52 jguarin200
        signal stage1_internalCarry     : std_logic_vector(2 downto 0); --! Cada uno de los 3 sumadores de la etapa de sumadores est&acute; compuesto de una cascada de 2 sumadores Carry Look Ahead: aXhigh y aXlow. El carry out del componente low y el carry in del componente high, se conectar&acute; a trav&eacute;s de las señales internal carry.   
75
        signal stage2_internalCarry : std_logic_vector(1 downto 0); --! Cada uno de los 2 sumadores de la última etapa de sumadores est&acute; compuesto de una cascada de 2 sumadores Carry Look AheadÑ: aXhigh y aXlow. El carry out del componente low y el carry in del componente high, se conectar&acute; a trav&eacute;s de las señales internal carry.  
76 2 jguarin200
 
77 22 jguarin200
        --Stage 2 signals       
78
        signal stage2a0, stage2a2, stage2a3, stage2a4, stage2p2, stage2p3 : std_logic_vector (31 downto 0); --! Estas señales corresponden a los sumandos derivados de la primera etapa de multiplicadores (stage2p2, stage2p3) y a los sumandos derivados del resultado de las sumas en la primera etapa de sumadores. 
79 8 jguarin200
 
80
 
81
 
82 2 jguarin200
begin
83
 
84 8 jguarin200
        -- Multiplicator Instantiation (StAgE 0)
85 22 jguarin200
        --! Multiplicador 0 
86 50 jguarin200
        m0 : lpm_mult
87
        generic map (
88
                lpm_hint =>  "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
89
                lpm_pipeline =>  2,
90
                lpm_representation => "SIGNED",
91
                lpm_type => "LPM_MULT",
92
                lpm_widtha => 18,
93
                lpm_widthb => 18,
94
                lpm_widthp => 32
95
        )
96 8 jguarin200
        port map (
97
                aclr    => rst,
98
                clock   => clk,
99 15 jguarin200
                dataa   => stage0mf00,
100
                datab   => stage0mf01,
101
                result  => stage0p0
102 8 jguarin200
        );
103 77 jguarin200
        kvx0 <= stage0p0;
104 22 jguarin200
        --! Multiplicador 1
105 50 jguarin200
        m1 : lpm_mult
106
        generic map (
107
                lpm_hint =>  "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
108
                lpm_pipeline =>  2,
109
                lpm_representation => "SIGNED",
110
                lpm_type => "LPM_MULT",
111
                lpm_widtha => 18,
112
                lpm_widthb => 18,
113
                lpm_widthp => 32
114
        )
115 8 jguarin200
        port map (
116
                aclr    => rst,
117
                clock   => clk,
118 15 jguarin200
                dataa   => stage0mf10,
119
                datab   => stage0mf11,
120
                result  => stage0p1
121 8 jguarin200
        );
122 77 jguarin200
        kvy0 <= stage0p1;
123 22 jguarin200
 
124
        --! Multiplicador 2
125 50 jguarin200
        m2 : lpm_mult
126
        generic map (
127
                lpm_hint =>  "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
128
                lpm_pipeline =>  2,
129
                lpm_representation => "SIGNED",
130
                lpm_type => "LPM_MULT",
131
                lpm_widtha => 18,
132
                lpm_widthb => 18,
133
                lpm_widthp => 32
134
        )
135 8 jguarin200
        port map (
136
                aclr    => rst,
137
                clock   => clk,
138 15 jguarin200
                dataa   => stage0mf20,
139
                datab   => stage0mf21,
140
                result  => stage0p2
141 8 jguarin200
        );
142 77 jguarin200
        kvz0 <= stage0p2;
143 22 jguarin200
 
144
        --! Multiplicador 3
145 50 jguarin200
        m3 : lpm_mult
146
        generic map (
147
                lpm_hint =>  "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
148
                lpm_pipeline =>  2,
149
                lpm_representation => "SIGNED",
150
                lpm_type => "LPM_MULT",
151
                lpm_widtha => 18,
152
                lpm_widthb => 18,
153
                lpm_widthp => 32
154
        )
155 8 jguarin200
        port map (
156
                aclr    => rst,
157
                clock   => clk,
158 15 jguarin200
                dataa   => stage0mf30,
159
                datab   => stage0mf31,
160
                result  => stage0p3
161 8 jguarin200
        );
162 77 jguarin200
        kvx1 <= stage0p3;
163 22 jguarin200
        --! Multiplicador 4
164 50 jguarin200
        m4 : lpm_mult
165
        generic map (
166
                lpm_hint =>  "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
167
                lpm_pipeline =>  2,
168
                lpm_representation => "SIGNED",
169
                lpm_type => "LPM_MULT",
170
                lpm_widtha => 18,
171
                lpm_widthb => 18,
172
                lpm_widthp => 32
173
        )
174 8 jguarin200
        port map (
175
                aclr    => rst,
176
                clock   => clk,
177 15 jguarin200
                dataa   => stage0mf40,
178
                datab   => stage0mf41,
179
                result  => stage0p4
180 8 jguarin200
        );
181 77 jguarin200
        kvy1 <= stage0p4;
182 22 jguarin200
 
183
        --! Multiplicador 5
184 50 jguarin200
        m5 : lpm_mult
185
        generic map (
186
                lpm_hint =>  "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
187
                lpm_pipeline =>  2,
188
                lpm_representation => "SIGNED",
189
                lpm_type => "LPM_MULT",
190
                lpm_widtha => 18,
191
                lpm_widthb => 18,
192
                lpm_widthp => 32
193
        )
194 8 jguarin200
        port map (
195
                aclr    => rst,
196
                clock   => clk,
197 15 jguarin200
                dataa   => stage0mf50,
198
                datab   => stage0mf51,
199
                result  => stage0p5
200 8 jguarin200
        );
201 77 jguarin200
        kvz1 <= stage0p5;
202 8 jguarin200
 
203
 
204 27 jguarin200
        useIeee:
205
        if use_std_logic_signed="YES" generate
206
                -- Adder Instantiation (sTaGe 1)
207
                stage1adderProc:
208 28 jguarin200
                process (stage1p0,stage1p1,stage1p2,stage1p3,stage1p4,stage1p5,stageSRopcode)
209 27 jguarin200
                begin
210 28 jguarin200
                        case (stageSRopcode) is
211 27 jguarin200
                                when '1' =>             -- Cross Product
212
                                        stage1a0 <= stage1p0-stage1p1;
213
                                        stage1a2 <= stage1p4-stage1p5;
214
                                when others =>  -- Dot Product
215
                                        stage1a0 <= stage1p0+stage1p1;
216
                                        stage1a2 <= stage1p4+stage1p5;
217
                        end case;
218
                end process stage1adderProc;
219
                stage1a1 <= stage1p2-stage1p3;  -- This is always going to be a substraction
220
 
221
                -- Adder Instantiation (Stage 2)
222
                stage2a3 <= stage2a0+stage2p2;
223
                stage2a4 <= stage2p3+stage2a2;
224 77 jguarin200
 
225 27 jguarin200
        end generate useIeee;
226
        dontUseIeee:
227
        if use_std_logic_signed="NO" generate
228
                --! Adder 0, 16 bit carry lookahead low adder.
229
                a0low : adder
230 32 jguarin200
                generic map (16,carry_logic,"YES")      -- Carry Look Ahead Logic (More Gates Used, But Less Time)
231 27 jguarin200
                                                                                -- Yes instantiate Xor gates stage in the adder so we can substract on the opcode signal command.
232 28 jguarin200
                port map        (stage1p0(15 downto 0),stage1p1(15 downto 0),stageSRopcode,'0',stage1a0(15 downto 0),stage1_internalCarry(0));
233 27 jguarin200
                --Adder 0, 16 bit carry lookahead high adder.
234
                a0high : adder
235 32 jguarin200
                generic map (16,carry_logic,"YES")      -- Carry Look Ahead Logic (More Gates Used, But Less Time)
236 27 jguarin200
                                                                                -- Yes instantiate Xor gates stage in the adder so we can substract on the opcode signal command.
237 28 jguarin200
                port map        (stage1p0(31 downto 16),stage1p1(31 downto 16),stageSRopcode,stage1_internalCarry(0),stage1a0(31 downto 16),open);
238 27 jguarin200
                --! Adder 1, 16 bit carry lookahead low adder. 
239
                a1low : adder
240 32 jguarin200
                generic map (16,carry_logic,"YES")      -- Carry Look Ahead Logic (More Gates Used, But Less Time)
241 27 jguarin200
                                                                                -- Yes instantiate Xor gates stage in the adder so we can substract on the opcode signal command.
242
                port map        (stage1p2(15 downto 0),stage1p3(15 downto 0),'1','0',stage1a1(15 downto 0),stage1_internalCarry(1));
243
                --! Adder 1, 16 bit carry lookahead high adder.
244
                a1high : adder
245 32 jguarin200
                generic map (16,carry_logic,"YES")      -- Carry Look Ahead Logic (More Gates Used, But Less Time)
246 27 jguarin200
                                                                                -- Yes instantiate Xor gates stage in the adder so we can substract on the opcode signal command.
247
                port map        (stage1p2(31 downto 16),stage1p3(31 downto 16),'1',stage1_internalCarry(1),stage1a1(31 downto 16),open);
248
                --! Adder 2, 16 bit carry lookahead low adder. 
249
                a2low : adder
250 32 jguarin200
                generic map (16,carry_logic,"YES")      -- Carry Look Ahead Logic (More Gates Used, But Less Time)
251 27 jguarin200
                                                                                -- Yes instantiate Xor gates stage in the adder so we can substract on the opcode signal command.
252 28 jguarin200
                port map        (stage1p4(15 downto 0),stage1p5(15 downto 0),stageSRopcode,'0',stage1a2(15 downto 0),stage1_internalCarry(2));
253 27 jguarin200
                --! Adder 2, 16 bit carry lookahead high adder.
254
                a2high : adder
255 32 jguarin200
                generic map (16,carry_logic,"YES")      -- Carry Look Ahead Logic (More Gates Used, But Less Time)
256 27 jguarin200
                                                                                -- Yes instantiate Xor gates stage in the adder so we can substract on the opcode signal command.
257 28 jguarin200
                port map        (stage1p4(31 downto 16),stage1p5(31 downto 16),stageSRopcode,stage1_internalCarry(2),stage1a2(31 downto 16),open);
258 27 jguarin200
                -- Adder Instantiation (Stage 2)
259
                --! Adder 3, 16 bit carry lookahead low adder. 
260
                a3low : adder
261 32 jguarin200
                generic map (16,carry_logic,"NO")               -- Carry Look Ahead Logic (More Gates Used, But Less Time)
262 27 jguarin200
                                                                                -- Dont instantiate Xor gates stage in the adder.
263
                port map        (stage2a0(15 downto 0),stage2p2(15 downto 0),'0','0',stage2a3(15 downto 0),stage2_internalCarry(0));
264
                --Adder 3, 16 bit carry lookahead high adder.
265
                a3high : adder
266 32 jguarin200
                generic map (16,carry_logic,"NO")               -- Carry Look Ahead Logic (More Gates Used, But Less Time)
267 27 jguarin200
                                                                                -- Dont instantiate Xor gates stage in the adder.
268
                port map        (stage2a0(31 downto 16),stage2p2(31 downto 16),'0',stage2_internalCarry(0),stage2a3(31 downto 16),open);
269
                --! Adder 4, 16 bit carry lookahead low adder. 
270
                a4low : adder
271 32 jguarin200
                generic map (16,carry_logic,"NO")               -- Carry Look Ahead Logic (More Gates Used, But Less Time)
272 27 jguarin200
                                                                                -- Dont instantiate Xor gates stage in the adder.
273
                port map        (stage2p3(15 downto 0),stage2a2(15 downto 0),'0','0',stage2a4(15 downto 0),stage2_internalCarry(1));
274
                --! Adder 4, 16 bit carry lookahead high adder.
275
                a4high : adder
276 32 jguarin200
                generic map (16,carry_logic,"NO")               -- Carry Look Ahead Logic (More Gates Used, But Less Time)
277 27 jguarin200
                                                                                -- Dont instantiate Xor gates stage in the adder.
278
                port map        (stage2p3(31 downto 16),stage2a2(31 downto 16),'0',stage2_internalCarry(1),stage2a4(31 downto 16),open);
279
 
280
        end generate dontUseIeee;
281 8 jguarin200
        -- Incoming from opcoder.vhd signals into pipeline's stage 0.
282 15 jguarin200
        stage0mf00 <= m0f0;
283
        stage0mf01 <= m0f1;
284
        stage0mf10 <= m1f0;
285
        stage0mf11 <= m1f1;
286
        stage0mf20 <= m2f0;
287
        stage0mf21 <= m2f1;
288
        stage0mf30 <= m3f0;
289
        stage0mf31 <= m3f1;
290
        stage0mf40 <= m4f0;
291
        stage0mf41 <= m4f1;
292
        stage0mf50 <= m5f0;
293
        stage0mf51 <= m5f1;
294 8 jguarin200
 
295
        -- Signal sequencing: as the multipliers use registered output and registered input is not necessary to write the sequence of stage 0 signals to stage 1 signals.
296
        -- so the simplistic path is taken: simply connect stage 0 to stage 1 lines. However this would not apply for the opcode signal
297 15 jguarin200
        stage1p0 <= stage0p0;
298
        stage1p1 <= stage0p1;
299
        stage1p2 <= stage0p2;
300
        stage1p3 <= stage0p3;
301
        stage1p4 <= stage0p4;
302
        stage1p5 <= stage0p5;
303 8 jguarin200
 
304
 
305
        --Outcoming to the rest of the system (by the time i wrote this i dont know where this leads to... jeje)
306 15 jguarin200
        cpx <= stage1a0;
307
        cpy <= stage1a1;
308
        cpz <= stage1a2;
309
        dp0 <= stage2a3;
310
        dp1 <= stage2a4;
311 8 jguarin200
 
312
        -- Looking into the design the stage 1 to stage 2 are the sequences pipe stages that must be controlled in this particular HDL.
313 22 jguarin200
        --! Este proceso describe la manera en que se organizan las etapas de pipe.
314 67 jguarin200
        --! Todas las señales internas en las etapas de pipe, en el momento en que la entrada rst alcanza el nivel rstMasterValue, se colocan en '0'. N&oacute;tese que, salvo stageMopcode<=stageSRopcode, las señales que vienen desde la entrada hacia los multiplicadores en la etapa 0 y desde la salida de los multiplicadores desde la etapa0 hacia la etapa 1, no est&acute;n siendo descritas en este proceso, la explicaci&oacute;n de es simple: Los multiplicadores que se est&acute;n instanciado tienen registros a la entrada y la salida, permitiendo as&iacute;, registrar las entradas y registrar los productos o salidas de los  multiplicadores, hacia la etapa 1 o etapa de sumadores/restadores. 
315 22 jguarin200
 
316
        uf_seq: process (clk,rst)
317 8 jguarin200
        begin
318
 
319
                if rst=rstMasterValue then
320 28 jguarin200
                        stageMopcode    <= '0';
321
                        stageSRopcode   <= '0';
322 3 jguarin200
 
323 15 jguarin200
                        stage2a2 <= (others => '0');
324
                        stage2p3 <= (others => '0');
325
                        stage2p2 <= (others => '0');
326
                        stage2a0 <= (others => '0');
327 8 jguarin200
 
328
                elsif clk'event and clk = '1' then
329
 
330 15 jguarin200
                        stage2a2 <= stage1a2;
331
                        stage2p3 <= stage1p3;
332
                        stage2p2 <= stage1p2;
333
                        stage2a0 <= stage1a0;
334 3 jguarin200
 
335 8 jguarin200
                        -- Opcode control sequence
336 28 jguarin200
                        stageMopcode <= opcode;
337
                        stageSRopcode <= stageMopcode;
338 8 jguarin200
 
339
                end if;
340
        end process uf_seq;
341 15 jguarin200
 
342 50 jguarin200
        --! Codigo generado para realizar test bench
343
        tbgen:
344
        if testbench_generation="YES" generate
345
                tbproc0:
346
                process
347
                        variable buff : line;
348 55 jguarin200
                        variable theend : time :=30835 ns;
349 52 jguarin200
                        file mbuff : text open write_mode is "TRACE_multiplier_content.csv";
350 50 jguarin200
                begin
351 54 jguarin200
                write(buff,string'("#UF multipliers test benching"));
352 50 jguarin200
                writeline(mbuff, buff);
353 54 jguarin200
                write(buff,string'("#{Time} {m0result} {m1result} {m2result} {m3result} {m4result} {m5result}"));
354
                writeline(mbuff, buff);
355 50 jguarin200
                wait for 5 ns;
356
                wait until rst=not(rstMasterValue);
357
                wait until clk='1';
358
                wait for tclk2+tclk4; --! Garantizar la estabilidad de los datos que se van a observar en la salida.
359
                displayRom:
360
                loop
361 54 jguarin200
                        write (buff,string'("{"));
362 55 jguarin200
                        write (buff,now,unit =>ns);
363 54 jguarin200
                        write (buff,string'("}{"));
364 50 jguarin200
                        hexwrite_0 (buff,stage1p0(31 downto 0));
365 54 jguarin200
                        write (buff,string'("}{"));
366 50 jguarin200
                        hexwrite_0 (buff,stage1p1(31 downto 0));
367 54 jguarin200
                        write (buff,string'("}{"));
368 50 jguarin200
                        hexwrite_0 (buff,stage1p2(31 downto 0));
369 54 jguarin200
                        write (buff,string'("}{"));
370 58 jguarin200
                        hexwrite_0 (buff,stage1p3(31 downto 0));
371 54 jguarin200
                        write (buff,string'("}{"));
372 50 jguarin200
                        hexwrite_0 (buff,stage1p4(31 downto 0));
373 54 jguarin200
                        write (buff,string'("}{"));
374 50 jguarin200
                        hexwrite_0 (buff,stage1p5(31 downto 0));
375 54 jguarin200
                        write (buff,string'("}"));
376 50 jguarin200
                        writeline(mbuff,buff);
377
                        wait for tclk;
378 56 jguarin200
                        if now>theend then
379 54 jguarin200
                                wait;
380
                        end if;
381 50 jguarin200
                end loop displayRom;
382
                end process tbproc0;
383
                tbproc1:
384
                process
385
                        variable buff : line;
386 55 jguarin200
                        variable theend : time :=30795 ns;
387 52 jguarin200
                        file fbuff : text open write_mode is "TRACE_decoded_factors_content.csv";
388 50 jguarin200
                begin
389
 
390 54 jguarin200
                        write(buff,string'("#UF factors decoded test benching"));
391 50 jguarin200
                        writeline(fbuff, buff);
392 54 jguarin200
                        write(buff,string'("#{Time} {m0f0,m0f1}{m1f0,m1f1}{m2f0,m2f1}{m3f0,m3f1}{m4f0,m4f1}{m5f0,m5f1}"));
393
                        writeline(fbuff, buff);
394 50 jguarin200
                        wait for 5 ns;
395
                        wait until rst=not(rstMasterValue);
396
                        wait until clk='1';
397
                        wait for tclk2+tclk4; --! Garantizar la estabilidad de los datos que se van a observar en la salida.
398
                        displayRom:
399
                        loop
400 52 jguarin200
                                write (buff,string'(" { "));
401 54 jguarin200
                                write (buff,now,unit =>ns);
402
                                write (buff,string'(" } "));
403
                                write (buff,string'(" { "));
404 50 jguarin200
                                hexwrite_0 (buff,m0f0(17 downto 0));
405 52 jguarin200
                                write (buff,string'(","));
406 50 jguarin200
                                hexwrite_0 (buff,m0f1(17 downto 0));
407 52 jguarin200
                                write (buff,string'(" } { "));
408 50 jguarin200
                                hexwrite_0 (buff,m1f0(17 downto 0));
409 52 jguarin200
                                write (buff,string'(","));
410 50 jguarin200
                                hexwrite_0 (buff,m1f1(17 downto 0));
411 52 jguarin200
                                write (buff,string'(" } { "));
412 50 jguarin200
                                hexwrite_0 (buff,m2f0(17 downto 0));
413 52 jguarin200
                                write (buff,string'(","));
414 50 jguarin200
                                hexwrite_0 (buff,m2f1(17 downto 0));
415 52 jguarin200
                                write (buff,string'(" } { "));
416 50 jguarin200
                                hexwrite_0 (buff,m3f0(17 downto 0));
417 52 jguarin200
                                write (buff,string'(","));
418 50 jguarin200
                                hexwrite_0 (buff,m3f1(17 downto 0));
419 52 jguarin200
                                write (buff,string'(" } { "));
420 50 jguarin200
                                hexwrite_0 (buff,m4f0(17 downto 0));
421 52 jguarin200
                                write (buff,string'(","));
422
                                hexwrite_0 (buff,m4f1(17 downto 0));
423
                                write (buff,string'(" } { "));
424 50 jguarin200
                                hexwrite_0 (buff,m5f0(17 downto 0));
425 52 jguarin200
                                write (buff,string'(","));
426 50 jguarin200
                                hexwrite_0 (buff,m5f1(17 downto 0));
427 52 jguarin200
                                write (buff,string'(" }"));
428 50 jguarin200
                                writeline(fbuff,buff);
429
                                wait for tclk;
430 56 jguarin200
                                if now>theend then
431 55 jguarin200
                                        wait;
432
                                end if;
433 50 jguarin200
                        end loop displayRom;
434
                end process tbproc1;
435
 
436 77 jguarin200
                tbproc2:
437 50 jguarin200
                process
438
                        variable buff : line;
439 55 jguarin200
                        variable theend : time :=30855 ns;
440 52 jguarin200
                        file rbuff : text open write_mode is "TRACE_results_content.csv";
441 50 jguarin200
                begin
442
 
443 54 jguarin200
                        write(buff,string'("#UF results test benching"));
444 50 jguarin200
                        writeline(rbuff, buff);
445 54 jguarin200
                        write(buff,string'("#{Time} {CPX,CPY,CPZ}{DP0,DP1}"));
446
                        writeline(rbuff, buff);
447
 
448 50 jguarin200
                        wait for 5 ns;
449
                        wait until rst=not(rstMasterValue);
450
                        wait until clk='1';
451
                        wait for tclk2+tclk4; --! Garantizar la estabilidad de los datos que se van a observar en la salida.
452
                        displayRom:
453
                        loop
454 54 jguarin200
                                write (buff,string'(" { "));
455 50 jguarin200
                                write (buff,now,unit =>ns);
456 54 jguarin200
                                write (buff,string'(" }{ "));
457 50 jguarin200
                                hexwrite_0 (buff,stage1a0(31 downto 0));
458 52 jguarin200
                                write (buff,string'(","));
459 50 jguarin200
                                hexwrite_0 (buff,stage1a1(31 downto 0));
460 52 jguarin200
                                write (buff,string'(","));
461 50 jguarin200
                                hexwrite_0 (buff,stage1a2(31 downto 0));
462 54 jguarin200
                                write (buff,string'(" }{ "));
463 50 jguarin200
                                hexwrite_0 (buff,stage2a3(31 downto 0));
464 54 jguarin200
                                write (buff,string'("}{"));
465 50 jguarin200
                                hexwrite_0 (buff,stage2a4(31 downto 0));
466 52 jguarin200
                                write (buff,string'(" }"));
467 50 jguarin200
                                writeline(rbuff,buff);
468
                                wait for tclk;
469 56 jguarin200
                                if now>theend then
470 55 jguarin200
                                        wait;
471 77 jguarin200
                                end if;
472 50 jguarin200
                        end loop displayRom;
473
                end process tbproc2;
474
 
475
        end generate tbgen;
476 15 jguarin200
 
477
 
478 50 jguarin200
 
479
 
480 2 jguarin200
end uf_arch;

powered by: WebSVN 2.1.0

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