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.

use real number in vhdl

Status
Not open for further replies.

electronical

Advanced Member level 4
Joined
Nov 4, 2011
Messages
104
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
1,975
hello all.how can I define 2 bit of signal that the type of it is std_logic_vector (12 downto 0) as decimal?
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,521
Helped
14,273
Reputation
28,809
Reaction score
12,977
Trophy points
1,393
Location
Bochum, Germany
Activity points
280,613
We would prefer a slightly clearer question. What is the relation of decimal <> real number <> 2 bit <> std_logic_vector ???
 

mrflibble

Advanced Member level 5
Joined
Apr 19, 2010
Messages
2,724
Helped
679
Reputation
1,360
Reaction score
651
Trophy points
1,393
Activity points
19,551
What is the relation of decimal <> real number <> 2 bit <> std_logic_vector ???

They occur within the same sentence. XD And that's about all the logic cohesion I can detect there, so an alternative version of that question would be helpful yes. :)
 

electronical

Advanced Member level 4
Joined
Nov 4, 2011
Messages
104
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
1,975
how I define 8 exponent bits and 3fraction bits?
 

electronical

Advanced Member level 4
Joined
Nov 4, 2011
Messages
104
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
1,975
I want multiply 0.5 with std_logic_vector(or integer) the result is saved and use in another program.i know that real number dont syn.in my search in google I found that std_logic_vector can define fraction bit.but I dont konw how can do it and use it?
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,069
Helped
2,078
Reputation
4,173
Reaction score
2,031
Trophy points
1,393
Activity points
39,156
well, you have 3 fractional bits and 8 integer bits (there are no exponential bits in fixed point).

0.5 = 2^-1, so its the most significant fractional bit.
so in an 11 bit std_logic_vector (why are you using std_logic_vectors to represent numbers??????? ) it would be:

"00000000100"
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top