Wie benutze conv_integer, in ModelSim ?

OP (Firma: na) #6117427
Lesenswert?

Hallo,

um VHDL zu lernen würde ich mit ModelSim gerne ein paar existierene 
packages ausprobieren, z.B. bit convertierung. Allerdings bekomme ich 
das nicht hin:
1
use synopsys.arithmetic.all;

Modelsim sagt:
1
# -- Loading package STANDARD
2
# ** Error: C:/fpga/other/hellow.vhd(1): (vcom-1136) Unknown identifier "synopsys".
3
# 
4
# ** Error: C:/fpga/other/hellow.vhd(3): VHDL Compiler exiting

Hatjemand einen Vorschlag wie es klappen könnte? Vielen Dank!
OP (Firma: na) #6117498
Lesenswert?

Danke das war schonmal die Lösung zu meinem Problem. Allerdings bekomme 
ich den Wert noch nicht dargestellt mir "report".

Der gesamte Code gerade ist:
1
library synopsys;
2
library IEEE;
3
library std;
4

5
use IEEE.numeric_std.all;
6
use synopsys.arithmetic.all;
7
use std.textio.all;
8

9
entity hellow is
10
end entity;
11
 
12

13

14
architecture sim of hellow is
15
begin 
16
    process is
17
         variable val : integer; 
18

19
    begin
20

21
        report "Hello World!";
22
  val := conv_integer(21);
23
        report to_string(val);
24
        -- report conv_std_logic_vector(5, 6);
25

26
        wait;
27
 
28
    end process;
29
 
30
end architecture;

Der output gibt nun:
1
# Model Technology ModelSim PE Student Edition vcom 10.4a Compiler 2015.03 Apr  7 2015
2
# Start time: 11:42:58 on Jan 23,2020
3
# vcom -reportprogress 300 -work work -2002 -explicit -O0 C:/fpga/other/hellow.vhd 
4
# -- Loading package STANDARD
5
# -- Loading package TEXTIO
6
# -- Loading package std_logic_1164
7
# -- Loading package NUMERIC_STD
8
# -- Loading package ATTRIBUTES
9
# -- Loading package TYPES
10
# -- Loading package arithmetic
11
# -- Compiling entity hellow
12
# -- Compiling architecture sim of hellow
13
# ** Error: C:/fpga/other/hellow.vhd(24): (vcom-1136) Unknown identifier "to_string".
14
# 
15
# ** Error: C:/fpga/other/hellow.vhd(31): VHDL Compiler exiting
16
# End time: 11:42:58 on Jan 23,2020, Elapsed time: 0:00:00
17
# Errors: 2, Warnings: 0
18
# C:/Modeltech_pe_edu_10.4a/win32pe_edu/vcom failed.
Moderator (Firma: Titel) Persönliche Seite #6117621
Lesenswert?

Patrick M. schrieb:
> Der output gibt nun:
> vcom ... -2002 ...
>... Unknown identifier "to_string".
Ggfs. musst du den Simulator einfach nur auf VHDL 2008 umstellen. Ab 
dann geht auch to_string()...

>   val := conv_integer(21);
Ähem, val ist ein integer und 21 auch. Wozu noch konvertieren?

> use IEEE.numeric_std.all;
> use synopsys.arithmetic.all;
Never ever both together!
Sonst passiert dir ggfs. auch mal sowas wie im 
Beitrag "Error: Identifier "unsigned" is not directly visible."
Mein Tipp: nimm für Casts und Konvertierungen die numeric_std(). Die 
kann alles, was du brauchst.

BTW: wo hast du denn überhaupt die synopsys.arithmetic her?
Die hab ich ja noch nie gesehen...
#6117637
Lesenswert?

Moin,

Edit: Gerade obsolet geworden (dank Lothar):
wenn to_string nicht geht: hast du die VHDL08-Optionen an?
Nur so als Tip: Ich wuerde nicht numeric_std und synopsys-libs mischen.
Das hat in der Vergangenheit schon einiges an Verwirrung verursacht, bis 
zu fatalen Auswirkungen aufs Richtig-Rechnen, je nach Simulator.

Was ich sonst noch zum Anfangen und Einarbeiten in die Standards 
empfehlen kann, ist der GHDL-Simulator. Wo ModelSim teils die 
verstuemmelten 'Standards' der Hersteller frisst, ist GHDL eher streng. 
Kann Vorteile haben.
OP (Firma: na) #6117724
Lesenswert?

Danke für euer Feedback.
In der Tat, ghdl scheint für meine Lernzwecke auch sehr sinnvoll, z.B.:

https://ghdl.readthedocs.io/en/latest/examples/quick_start/hello/README.html

Die Synposys lib ist beim Download der ModelSim Student Edition dabei. 
Allerdings nicht ganz klar ob/wie vhdl2008 gesetzt wird um to_string zu 
benutzen. Mal schauen, es geht ja auch mit den anderen Konstrukten.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren