Duke Scarring schrieb:
> Das macht der Simulator
Active HDL sagt dazu:
1 | # Simulation has been initialized
|
2 | # Selected Top-Level: test_negative_overflow (test)
|
3 | run
|
4 | # KERNEL: WARNING: NUMERIC_STD.TO_SIGNED: vector truncated
|
5 | # KERNEL: Time: 0 ps, Iteration: 0, Instance: /test_negative_overflow, Process: line__13.
|
6 | # KERNEL: Simulation has finished. There are no more test vectors to simulate.
|
Diese Meldung kommt aus der numeric_std:
1 | -- Id: D.4
|
2 | function TO_SIGNED(ARG: INTEGER; SIZE: NATURAL) return SIGNED is
|
3 | variable RESULT: SIGNED (SIZE-1 downto 0) ;
|
4 | variable b_val : STD_LOGIC:= '0' ;
|
5 | variable i_val : INTEGER:= ARG ;
|
6 | begin
|
7 | if (SIZE < 1) then return NAS; end if;
|
8 | if (ARG<0) then
|
9 | b_val := '1' ;
|
10 | i_val := -(ARG+1) ;
|
11 | end if ;
|
12 | for i in 0 to RESULT'left loop
|
13 | if (i_val MOD 2) = 0 then
|
14 | RESULT(i) := b_val;
|
15 | else
|
16 | RESULT(i) := not b_val ;
|
17 | end if;
|
18 | i_val := i_val/2 ;
|
19 | end loop;
|
20 | if ((i_val/=0) or (b_val/=RESULT(RESULT'left))) then
|
21 | assert NO_WARNING
|
22 | report "numeric_std.TO_SIGNED : vector truncated" --<<<-----
|
23 | severity WARNING ;
|
24 | end if;
|
25 | return RESULT;
|
26 | end TO_SIGNED;
|
C. A. Rotwang schrieb:
> Es ist also keine "Initialisierung" wie der TO es nennt. Bei
> Initialisierungen wird ein ":=" verwendet.
Und blöderweise stört sich nicht jeder Compiler an der fehlerhaften
Initialisierung, und gibt auch die Warnung aus der numeric_std nicht
aus...
Duke Scarring schrieb:
> Dafür warnt der Simulator (vsim und run -all) jetzt zweimal...
Der Compiler vom Active-HDL stört sich auch nicht an der
Initialisierung (0 Errors, 0 Warnings). Aber der Simulator warnt
zweimal, einmal bei der Elaboration (wg. Initialisierung) und einmal zur
Runtime (wg Zuweisung). Man muss aber auch dort schon sehr genau
hinschauen:
1 | restart
|
2 | # ELBREAD: Elaboration process.
|
3 | # ELBREAD: Elaboration time 0.0 [s].
|
4 | #
|
5 | # KERNEL: Main thread initiated.
|
6 | # KERNEL: Kernel process initialization phase.
|
7 | # KERNEL: Time resolution set to 1ps.
|
8 | # ELAB2: Elaboration final pass...
|
9 | # ELAB2: Create instances ...
|
10 | # KERNEL: WARNING: NUMERIC_STD.TO_SIGNED: vector truncated
|
11 | # KERNEL: Time: 0 ps, Iteration: 0, TOP instance.
|
12 | # ELAB2: Create instances complete.
|
13 | # SLP: Started
|
14 | # SLP: Elaboration phase ...
|
15 | # SLP: Elaboration phase ... skipped, nothing to simulate in SLP mode : 0.0 [s]
|
16 | # SLP: Finished : 0.0 [s]
|
17 | # ELAB2: Elaboration final pass complete - time: 0.0 [s].
|
18 | # KERNEL: Warning: You are using the Active-HDL Lattice Edition. The performance of simulation is running at a reduced rate.
|
19 | # KERNEL: Warning: Contact Aldec for available upgrade options - sales@aldec.com.
|
20 | # KERNEL: Kernel process initialization done.
|
21 | # Allocation: Simulator allocated 5948 kB (elbread=1023 elab2=4775 kernel=149 sdf=0)
|
22 | # KERNEL: ASDB file was created in location C:\Projekte\FPGA\Lattice\ConversionOverflow\neg_overflow\src\wave.asdb
|
23 | # 12:50, Mittwoch, 13. September 2017
|
24 | # Simulation has been initialized
|
25 | # Selected Top-Level: test_negative_overflow (test)
|
26 | # Waveform file 'untitled.awc' connected to 'C:/Projekte/FPGA/Lattice/ConversionOverflow/neg_overflow/src/wave.asdb'.
|
27 | run 100 ns
|
28 | # KERNEL: WARNING: NUMERIC_STD.TO_SIGNED: vector truncated
|
29 | # KERNEL: Time: 0 ps, Iteration: 0, Instance: /test_negative_overflow, Process: line__13.
|
30 | # KERNEL: stopped at time: 100 ns
|
31 | # KERNEL: Simulation has finished. There are no more test vectors to simulate.
|