Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > std_logic vs bit

Reply
Thread Tools

std_logic vs bit

 
 
Mohammed A.khader
Guest
Posts: n/a
 
      09-10-2004
Hi all;

The significance of std_ulogic is to simulate the digital circuits
at electrical level, for synthesis it does'nt have any significance.
So when I write code for RTL synthesis I can use binary logic since
this the one which is going to be implemented. But many books suggest
to use std_logic though I am not using any buses . My question is why
should one choose other than bit logic for RTL synthesis . (Expection
is std_logic for bus).

Thanks in advance.

Regards,
A.khader.
 
Reply With Quote
 
 
 
 
Nicolas Matringe
Guest
Posts: n/a
 
      09-10-2004
Mohammed A.khader a écrit:
> Hi all;
>
> The significance of std_ulogic is to simulate the digital circuits
> at electrical level, for synthesis it does'nt have any significance.
> So when I write code for RTL synthesis I can use binary logic since
> this the one which is going to be implemented. But many books suggest
> to use std_logic though I am not using any buses . My question is why
> should one choose other than bit logic for RTL synthesis . (Expection
> is std_logic for bus).


Hi
There are many reasons.
If you use std_logic for busses, you will need std_logic for its
elements, logic feeding it or being fed by it, unless you want to use
conversion function.
You design for synthesis, that's OK. We all do that too. But before you
implement your code you will have to simulate it, and std_logic is much
nicer than bit (unitialized or conflicting signals appear, for example)

These are the 2 reasons that come to my mind but I'm sure I can think of
others )

--
____ _ __ ___
| _ \_)/ _|/ _ \ Adresse de retour invalide: retirez le -
| | | | | (_| |_| | Invalid return address: remove the -
|_| |_|_|\__|\___/

 
Reply With Quote
 
 
 
 
David Bishop
Guest
Posts: n/a
 
      09-12-2004
Mohammed A.khader wrote:
> Hi all;
>
> The significance of std_ulogic is to simulate the digital circuits
> at electrical level, for synthesis it does'nt have any significance.
> So when I write code for RTL synthesis I can use binary logic since
> this the one which is going to be implemented. But many books suggest
> to use std_logic though I am not using any buses . My question is why
> should one choose other than bit logic for RTL synthesis . (Expection
> is std_logic for bus).


There is a reason for this, but it's a silly one.

It turns out that in many synthesis tools, no matter what type
you give your ports (std_ulogic, std_ulogic_vector, signed, unsigned
bit_vector, etc) will always output ports of the type "std_logic_vector"
or "std_logic".

What I tell users to do is to make your ports at your top level
std_logic_vector and std_logic, then convert them to a more useful
type on the lower level.
 
Reply With Quote
 
Mohammed A.khader
Guest
Posts: n/a
 
      09-12-2004
Nicolas Matringe <> wrote in message news:<>...

> Hi
> There are many reasons.
> If you use std_logic for busses, you will need std_logic for its
> elements, logic feeding it or being fed by it, unless you want to use
> conversion function.


Yes, you are right, std_logic is needed for busses but all the
other logic is of type bit. conversion functions can be used once to
change logic to & fro std_logic.Using std_logic logic for this only
reason for the whole system makes the simulator much slower.

> You design for synthesis, that's OK. We all do that too. But before you
> implement your code you will have to simulate it, and std_logic is much
> nicer than bit (unitialized or conflicting signals appear, for example)


No, If a desingner assigns multiple sources to a signal mistakenly
then simulator would'nt show it as a error(mistake).
>
> These are the 2 reasons that come to my mind but I'm sure I can think of
> others )


Waiting for your more resons...

To believe as you think please answer one more question.
what would synthesis tool would do if I write this code.....

All signals are of type std_logic.
process (SEL, A, B, C, D)
begin
case SEL is
when "00" => MUX_OUT <= A;
when "01" => MUX_OUT <= B;
when "10" => MUX_OUT <= C;
when "11" => MUX_OUT <= D;
when others => MUX_OUT <= 'X';
end case;
end process;

what would synthesis tool would do if 1)I declare signals as of type
bit 2)I declare signals as of type std_logic.(what would it do with
others clause in this case).

Thanks in Advance.

Regards,
Mohamemd A.khader.
 
Reply With Quote
 
valentin tihomirov
Guest
Posts: n/a
 
      09-12-2004
> Yes, you are right, std_logic is needed for busses but all the
> other logic is of type bit.


I was sure it is bit_vector that is needed for describing buses.




 
Reply With Quote
 
rickman
Guest
Posts: n/a
 
      09-12-2004
valentin tihomirov wrote:
>
> > Yes, you are right, std_logic is needed for busses but all the
> > other logic is of type bit.

>
> I was sure it is bit_vector that is needed for describing buses.


The term bus is being misused to describe a signal shared between
multiple sources. Think tri-state bus.

--

Rick "rickman" Collins


Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX
 
Reply With Quote
 
rickman
Guest
Posts: n/a
 
      09-12-2004
"Mohammed A.khader" wrote:
>
> To believe as you think please answer one more question.
> what would synthesis tool would do if I write this code.....
>
> All signals are of type std_logic.
> process (SEL, A, B, C, D)
> begin
> case SEL is
> when "00" => MUX_OUT <= A;
> when "01" => MUX_OUT <= B;
> when "10" => MUX_OUT <= C;
> when "11" => MUX_OUT <= D;
> when others => MUX_OUT <= 'X';
> end case;
> end process;


I believe synthesis tools ignore the others since all of the states of
interest to a synthesis tool have been listed. You will get warnings in
a simulator, but in synthesis you can leave off the "others" clause.


> what would synthesis tool would do if 1)I declare signals as of type
> bit 2)I declare signals as of type std_logic.(what would it do with
> others clause in this case).


The same in both cases. Why don't you try it and let us know if you get
a difference?


--

Rick "rickman" Collins


Ignore the reply address. To email me use the above address with the XY
removed.

Arius - A Signal Processing Solutions Company
Specializing in DSP and FPGA design URL http://www.arius.com
4 King Ave 301-682-7772 Voice
Frederick, MD 21701-3110 301-682-7666 FAX
 
Reply With Quote
 
ivailokroumov
Guest
Posts: n/a
 
      09-12-2004
Hi Mohammed,
You know me just through my e-mail. I am Ivaylo Krumov from Bulgaria.
About your question
"My question is why should one choose other than bit logic for RTL
synthesis"
You should use std_logic because it can be syntesisable and this type
cover different electronic levels. You know that has logic "0" and logic
"1" where represent LOW and HIGH levels It's OK of course, these are real
representation about 0 Voltage and Vcc. Actually this is something
relative. For digital circuits are recognized different Vil, Vih, Vol and
Voh. These are different logic levels. And of course, if you use TTL logi
they are with values Vil belongs between 0 and 0,8V and Vih belongs
between 2V and 5V. Vol belongs between 0 and 0.4V VoH belongs between 2.4V
and 5V. These values are different for other kind logic like LV, CMOS,
HCMOS, HCTMOS, F, ALS, ALVC e.g.
In this way, imagine that you operate with 2-input XOR and need to manage
input_A with different bits either "0" or "1" Actually You can connect
this input directly to ground or Vcc. it is going to be either HARD 1 or
HARD 0 and if you use bit type everything is OK. But imagine that you are
going to connect this input through resistor, it's going to represent wake
"0" or wake "1" Actually these aren't real "0" and "1" and if you use bit
type, you cann't produce implementation. At rise time of digital
electronic and design different company showed up to 46 different leves
for coverring. So you neet to use std_logic or std_logic_vector if you
wish to make syntesisable models and to see real design. But if you wish
just to make models or design, for simulation, no problem to use bit or
bit_vector.
At the other view point, has difference betweeen std_logic and std_ulogic,
std_logic_vector and std_ulogic_vector. The difference is that std_ulogic
or std_ulogic_vector kinds are used in components that have JUST one
driving source. Where as The signals aren't share between the sources
Best Regards:
Ivaylo Krumov

 
Reply With Quote
 
Jim Lewis
Guest
Posts: n/a
 
      09-13-2004
Mohammed,
> process (SEL, A, B, C, D)
> begin
> case SEL is
> when "00" => MUX_OUT <= A;
> when "01" => MUX_OUT <= B;
> when "10" => MUX_OUT <= C;
> when "11" => MUX_OUT <= D;
> when others => MUX_OUT <= 'X';
> end case;
> end process;
>
> what would synthesis tool would do if 1)I declare signals as of type
> bit 2)I declare signals as of type std_logic.(what would it do with
> others clause in this case).

1) Syntax error: bit does not support an 'X'
However, once you fix that, I would expect both to be
the same.

The real difference is in simulation. Since bit does not
have an 'X', it gets a '0' at initialization. Hence,
what happens if you forget to reset the register that
drives SEL? With bit it looks like it was reset, with
std_logic it has "UU" and propagates the 'X'.

I have heard of projects where they have spent many iterations
through synthesis just to get all the required registers reset.

If you have a sound reset strategy, perhaps it does not matter.
However, does bit really buy you simulation performance?
Logically maybe, but what happens after optimization?

Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training private.php?do=newpm&u=
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      09-14-2004
David Bishop wrote:

>
> What I tell users to do is to make your ports at your top level
> std_logic_vector and std_logic, then convert them to a more useful
> type on the lower level.


For vectors, I agree.
For in or out bit ports, std_ulogic will map
without conversion to a std_logic wrapper port.

--Mike Treseler
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BIT, STD_LOGIC,STD_ULOGIC RealInfo VHDL 16 01-10-2009 04:06 PM
bit vector to std_logic conversion query pavithrashinde@gmail.com VHDL 1 06-08-2006 04:12 PM
bit vs std_logic ? Squidge VHDL 3 05-31-2005 06:22 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit, Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new ! vvcd Computer Support 0 09-17-2004 08:15 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit,Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new! Ionizer Computer Support 1 01-01-2004 07:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57