Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

std logic vector to natural conversion in VHDL

Status
Not open for further replies.

hithesh123

Full Member level 6
Joined
Nov 21, 2009
Messages
324
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
lax
Activity points
3,548
How do I convert at std logic vector to an Integer.
I tried to_integer(std_logic_vector). But got an error No feasible entries for subprogram "TO_INTEGER"."

The other way works - I just used std_logic_vector(integer);

using numeric_std.
 

You can decide for one of the below:
Code:
to_integer(unsigned(std_logic_vector))
to_integer(signed(std_logic_vector))
 

hmmm. That did not work. Got the following error -
"Target type ieee.NUMERIC_STD.UNSIGNED in variable assignment is different from expression type std.STANDARD.INTEGER."

Here's the part of the code giving me problems -

variable cnt : unsigned (n-1 downto 0); --declared inside process
preload_val : IN std_logic_vector (n-1 downto 0);

cnt:= to_integer(unsigned(preload_val));
 

Yes, that's unsigned, not integer. Presuming both are equal bit length, it's a simple type cast.
Code:
cnt:= unsigned(preload_val);
 

Thanks. That did it.

Do you know how to change the radix of a signal (in simulation window) using the .do file.
I am using .do file to add singals to wave, run for a particular interval etc.
 

If you apply manual changes to the waveform window, the respective commands will be listed in the log. You can simply copy them to the *.do file, if I remeber right.
 

If you apply manual changes to the waveform window, the respective commands will be listed in the log. You can simply copy them to the *.do file, if I remeber right.

Tried that before posting. Modelsim does not show anything in the command line window when I change the radix.
 

if you change the radix and save the signals in the wave window, it will ask you whether to override your "wave.do"<default file name> file. After saving that, if you point that wave file, from next run onwards you will get the same radix in which you have saved
 

if you change the radix and save the signals in the wave window, it will ask you whether to override your "wave.do"<default file name> file. After saving that, if you point that wave file, from next run onwards you will get the same radix in which you have saved

That worked. thanks.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top