FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-23-2007, 08:43 PM
John Smith
Guest
 
Posts: n/a
Default out ports on the right side

Is there a good reason why VHDL doesnt allow to appear out ports on right side?

For example:
a <= s1;
This is allowed when s1 is signal and a is out port.

a <= b;
Isnt allowed when b is "out"


Thanks
Reply With Quote
  #2 (permalink)  
Old 09-23-2007, 08:55 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: out ports on the right side

John Smith wrote:
> Is there a good reason why VHDL doesnt allow to appear out ports on
> right side?


Yes. The are OUT ports, not IN ports.

> For example:
> a <= s1;
> This is allowed when s1 is signal and a is out port.
> a <= b;
> Isnt allowed when b is "out"


The OUT port ID goes on the left
and the value goes on the right.
The value can be a constant, variable,
signal, or and expression using these.
For example:

q <= std_logic_vector(reg_v);

see http://home.comcast.net/~mike_treseler/
for more examples.

-- Mike Treseler
Reply With Quote
  #3 (permalink)  
Old 09-23-2007, 09:06 PM
John Smith
Guest
 
Posts: n/a
Default Re: out ports on the right side

Mike Treseler wrote:
> John Smith wrote:
>> Is there a good reason why VHDL doesnt allow to appear out ports on
>> right side?

>
> Yes. The are OUT ports, not IN ports.
>
>> For example:
>> a <= s1;
>> This is allowed when s1 is signal and a is out port.
>> a <= b;
>> Isnt allowed when b is "out"

>
> The OUT port ID goes on the left
> and the value goes on the right.
> The value can be a constant, variable,
> signal, or and expression using these.
> For example:
>
> q <= std_logic_vector(reg_v);
>
> see http://home.comcast.net/~mike_treseler/
> for more examples.
>
> -- Mike Treseler


Yes, maybe somebody can clear what is the reason that OUT ports cannot appear on
the right side.

Thanks for your help.
Reply With Quote
  #4 (permalink)  
Old 09-24-2007, 09:58 AM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: out ports on the right side

On Sun, 23 Sep 2007 22:06:57 +0200, John
Smith <john.smith@hotmail.com> wrote:

>Yes, maybe somebody can clear what is the reason
> that OUT ports cannot appear on
> the right side.


It's a rule of the language, and a standard FAQ.

Let's try some reasons. Decide for yourself which,
if any, you find convincing. All have some truth
in them.

1) User discipline
~~~~~~~~~~~~~~~~~~
It's an OUT port. You're sending information out
of the design unit. It is probably a user error to
attempt to read it, because there is a risk that you
imagine you are reading a value that came in through
the port from the outside world - which, of course,
would need an input or inout port.

2) Port transparency
~~~~~~~~~~~~~~~~~~~~
Unlike Verilog, ports in VHDL are completely transparent.
After the model has been elaborated, the signal inside
the design unit and the connected signal outside are
one and the same signal; there is no implicit driver
across the port boundary. Consequently, reading an
OUT port makes no sense because there *might* be another
driver on the signal, outside your design unit. When
you try to read an OUT port, do you want the value
that you are driving, or do you want the value that
appears on the signal as a result of its multiple
drivers? It's too ambiguous. VHDL has a very simple
solution to the first question - use an internal
variable, and drive that variable onto the out port - and
a simple solution to the second question - use inout.
You decide; there is no ambiguity, everyone knows what
you are trying to do, and your design unit's behaviour
is (as we would hope) unaffected by its environment.

3) Delta delays
~~~~~~~~~~~~~~~
It is a common newbie VHDL error to write something like
this:

process (A)
begin
B <= A + 1;
Y <= B + 1; -- newbie expects to get Y = A+2
end process;

We can't stop people making that mistake on internal
signals, but making OUT ports unreadable is a way to
reduce the risk in at least some situations.

4) Job protection
~~~~~~~~~~~~~~~~~
If VHDL did not put obstacles of this kind in the beginner's
way, I might be out of a job soon.


Oh, and you might like to find out about buffer ports, and
the VHDL-2002 changes that affect how you can connect buffer
and out ports to one another.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Reply With Quote
  #5 (permalink)  
Old 09-24-2007, 02:41 PM
Shannon
Guest
 
Posts: n/a
Default Re: out ports on the right side

On Sep 24, 1:58 am, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
wrote:
> Oh, and you might like to find out about buffer ports, and
> the VHDL-2002 changes that affect how you can connect buffer
> and out ports to one another.


And as a beginner that has recently been through all this, I would
suggest looking into the difference between ports, signals, and
variables. If 'b' in the above example was a signal for example...all
would be fine.

Shannon

Reply With Quote
  #6 (permalink)  
Old 09-24-2007, 03:34 PM
Andy
Guest
 
Posts: n/a
Default Re: out ports on the right side

On Sep 24, 8:41 am, Shannon <sgo...@sbcglobal.net> wrote:
> On Sep 24, 1:58 am, Jonathan Bromley <jonathan.brom...@MYCOMPANY.com>
> wrote:
>
> > Oh, and you might like to find out about buffer ports, and
> > the VHDL-2002 changes that affect how you can connect buffer
> > and out ports to one another.

>
> And as a beginner that has recently been through all this, I would
> suggest looking into the difference between ports, signals, and
> variables. If 'b' in the above example was a signal for example...all
> would be fine.
>
> Shannon


I suspect you meant to say "if 'b' was a VARIABLE". But it still would
not work... you'd need to change the assignment operator to ":=" too.

Just one of the many reasons I like variables: the code "reads" like
software. The synthesis tool will insert registers (or not) to make
the hardware behave the same way that the code executes, and the code
executes the same way that it reads.

Andy

Reply With Quote
  #7 (permalink)  
Old 09-25-2007, 10:21 AM
Tricky
Guest
 
Posts: n/a
Default Re: out ports on the right side


>
> Just one of the many reasons I like variables: the code "reads" like
> software. The synthesis tool will insert registers (or not) to make
> the hardware behave the same way that the code executes, and the code
> executes the same way that it reads.
>
> Andy


That is true, but that can make the code harder to read for someone
else. If you use variables to imply registers or not, then it can be
hard for someone to work out when or if a register is implied. Never
hold a variable value over a clock edge.

I find it best to use variables ONLY for combinational logic and let
Signals imply the registers. It then makes the code easier to read for
others. It also means if you need to access that that register value
in another process, its always available.

Reply With Quote
  #8 (permalink)  
Old 09-25-2007, 12:22 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: out ports on the right side

Tricky wrote:

> That is true, but that can make the code harder to read for someone
> else. If you use variables to imply registers or not, then it can be
> hard for someone to work out when or if a register is implied.


Fortunately, synthesis works this out for me.
I verify my work with simulation, not by
synthesizing the code in my head.

Here are some synthesis examples and results
using *no* signals at all.
http://home.comcast.net/~mike_treseler/

> Never
> hold a variable value over a clock edge.


That is strictly a matter of style.
If I followed that rule, it would
be much more difficult for me to
match the algorithms that I need to synthesize.

> I find it best to use variables ONLY for combinational logic and let
> Signals imply the registers.


You are free to use that style.
Many do. But this is not a logical
reason for others be accept such
a limitation.

> It then makes the code easier to read for
> others.


Some others perhaps. Not me.
I prefer reading code with
well-named procedures and functions.

> It also means if you need to access that that register value
> in another process, its always available.


In a single process entity, this is also true.
See my examples.

-Mike Treseler

Reply With Quote
  #9 (permalink)  
Old 09-25-2007, 04:43 PM
Andy
Guest
 
Posts: n/a
Default Re: out ports on the right side

On Sep 25, 4:21 am, Tricky <Trickyh...@gmail.com> wrote:
> That is true, but that can make the code harder to read for someone
> else. If you use variables to imply registers or not, then it can be
> hard for someone to work out when or if a register is implied. Never
> hold a variable value over a clock edge.
>
> I find it best to use variables ONLY for combinational logic and let
> Signals imply the registers. It then makes the code easier to read for
> others. It also means if you need to access that that register value
> in another process, its always available.


I find most "readers" are more interested in the functionality, rather
than the resulting structure of the implementation. Thus, a
description that executes more like SW (what most folks are most used
to reading) is more "readable".

If I cannot divine the implemented structure from a piece of code, I
run it through a synthesis tool and look at the schematic (RTL or
gates) view. Synplify Pro is really good at that. Besides, if you rely
on the structure you think you will get from reading the code, you
will likely miss optimizations, etc. that a specific synthesis tool
will make (or not).

If I wanted my code to describe the smallest structural level of the
design (i.e. gates & flops), I'd code a net list. The whole point of
HDL is to be able to describe a functionality over time, and have the
tool figure out the best way to implement that in gates and flops. If
I don't like that implementation (it takes up too much time and/or
resources), then I worry about giving more hints about a structure I
think will help. But that is a last, rather than a first, resort.

Using variables also PREVENTS other processes from accessing the data,
unless it is "passed" to them on a signal. This keeps local things
local, and global things global (within an architecture). I could use
blocks and signals to accomplish that, but I prefer variables for
other reasons, as stated. In my designs, signals are used ONLY for
data passed between processes and/or ports. This also makes
synchronization boundaries easier to police without requiring separate
blocks or entity/architectures.

Andy

Reply With Quote
  #10 (permalink)  
Old 09-30-2007, 11:21 PM
Jim Lewis
Guest
 
Posts: n/a
Default Re: out ports on the right side

> Is there a good reason why VHDL doesnt allow to appear out ports on
> right side?
>
> For example:
> a <= s1;
> This is allowed when s1 is signal and a is out port.
>
> a <= b;
> Isnt allowed when b is "out"
>
>
> Thanks


This is fixed in the next revision of VHDL (Accellera VHDL-2006).
So if you want this feature, submit a bug report against it.

Jim
Reply With Quote
  #11 (permalink)  
Old 10-01-2007, 05:48 AM
Shannon
Guest
 
Posts: n/a
Default Re: out ports on the right side

On Sep 30, 3:21 pm, Jim Lewis <j...@synthworks.com> wrote:
> > Is there a good reason why VHDL doesnt allow to appear out ports on
> > right side?

>
> > For example:
> > a <= s1;
> > This is allowed when s1 is signal and a is out port.

>
> > a <= b;
> > Isnt allowed when b is "out"

>
> > Thanks

>
> This is fixed in the next revision of VHDL (Accellera VHDL-2006).
> So if you want this feature, submit a bug report against it.
>
> Jim


Fixed? How is it broken? Seems fine to me.

Shannon

Reply With Quote
  #12 (permalink)  
Old 10-02-2007, 07:48 PM
Jim Lewis
Guest
 
Posts: n/a
Default Re: out ports on the right side

Shannon wrote:
> On Sep 30, 3:21 pm, Jim Lewis <j...@synthworks.com> wrote:
>>> Is there a good reason why VHDL doesnt allow to appear out ports on
>>> right side?
>>> For example:
>>> a <= s1;
>>> This is allowed when s1 is signal and a is out port.
>>> a <= b;
>>> Isnt allowed when b is "out"
>>> Thanks

>> This is fixed in the next revision of VHDL (Accellera VHDL-2006).
>> So if you want this feature, submit a bug report against it.
>>
>> Jim

>
> Fixed? How is it broken? Seems fine to me.


The feature came from ADA. ADA removed the feature
in its 1995 revision.

When you start to write assertions (such as PSL in VHDL
- also a new capability with Accellera VHDL-2006),
you need to be able to read outputs. Sometimes these are
written by Verification engineers who are not permitted
to change the VHDL code.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Side-BUFG, BRAMS and clock routing Paul Boven FPGA 2 08-27-2008 06:57 AM
How to start DMA from user_logic.vhdl (hardware side) fatfpga@googlemail.com FPGA 0 06-26-2008 01:42 PM
what is the difference between system side XAUI and line side XAUI? cationebox@gmail.com FPGA 0 12-29-2007 07:11 AM
Data-side BRAM xenix FPGA 0 09-18-2007 01:37 PM
how do we connect internals signals(not ports) of submodules in the top level design to trigger ports of the ila core? CMOS FPGA 2 01-08-2007 03:15 PM


All times are GMT +1. The time now is 06:42 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved