It seems like I'm always replying to something
that is already out of date.  I either type too 
slow or I type too much.  Or both.  :-)

I decided to start looking at the code.  I don't
have a dev setup, I'm just looking at gitweb.
I hope I'm accessing the latest, although
for hal_lib I imagine there haven't been many
changes.

The code below is from hal_lib.h, line numbers
hopefully match the current revision.

Note that "net" isn't a core hal_lib command.
The core commands are creating a signal
and linking a single pin to a signal.  A net
command is parsed and translated into 
multiple core commands.  If the signal doesn't
exist it is created, then each pin is individually
linked to it in the order that they appear in
the net command.

This code is from the link command:

Enforcement of linking rules, either of 
these can reject the link command:

1077     /* linking output pin to sig that already has output or I/O pins? */
1078     if ((pin->dir == HAL_OUT) && ((sig->writers > 0) || (sig->bidirs > 0 
))) {

1085     /* linking bidir pin to sig that already has output pin? */
1086     if ((pin->dir == HAL_IO) && (sig->writers > 0)) {

If the link is allowed, the counts are updated:

1098     /* update the signal's reader/writer/bidir counts */
1099     if ((pin->dir & HAL_IN) != 0) {
1100         sig->readers++;
1101     }
1102     if (pin->dir == HAL_OUT) {
1103         sig->writers++;
1104     }
1105     if (pin->dir == HAL_IO) {
1106         sig->bidirs++;
1107     }

I think that HAL_DRIVING_VALUE more-or-less
duplicates this functionality.


Implementation of the "copy dummy to signal" fix would look
something like:


1093     /* everything is OK, make the new link */
1094     data_ptr_addr = SHMPTR(pin->data_ptr_addr);
1095     comp = SHMPTR(pin->owner_ptr);
1096     data_addr = comp->shmem_base + sig->data_ptr;
1097     *data_ptr_addr = data_addr;
new      if (( sig->readers == 0 ) && ( sig->writers == 0 ) && ( sig->bidirs == 
0 )) {
new          /* this is the first pin for this signal, copy value from pin's 
"dummy" field */
new          memcpy(data_addr, &pin->dummysig, sizeof(hal_data_u));
1098     /* update the signal's reader/writer/bidir counts */


-- 
  John Kasunich
  [email protected]

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to