Hi Andy,

Sorry for the delay in replying. I did look at personalities a little while ago and didn't really get my head around it at the time. I have to admit I didn't put much time into it.

Looking at the code this looks suspect:

out(i) = (bargraph) ? (in > i) : (in == i);

Shouldn't it be:

out[i] = (bargraph) ? (in > i) : (in == i);

I have no idea why the compiler would have let that through.

Do you want to commit your version? It is better than mine. You might as well put your name on it as there isn't much left of what I wrote ;-)

Les

On 17/08/2017 00:18, andy pugh wrote:
On 16 August 2017 at 19:49, Les Newell <[email protected]> wrote:
This is the inverse of the mux components. It takes an integer value and
decodes it to up to 16 outputs.
I don't know how much comp has changed since the date on that comp,
but it could be simpler and have variable size.
Something like this. (but, I will point out that this core-dumped with
a sig11 on my VM, but it does compile and make the pins)


/********************************************************************
* Description: Demux16 HAL component.
*
* Author: Les Newell <les at sheetcam dot com>
* License: GPL Version 2 or later
*
* Copyright (c) 2009 All rights reserved.
*
********************************************************************/

component demux "Turn on one of N outputs depending on one input";
pin in u32 in "input in the range 0-N.";
pin out bit out-##[1 : personality] """One output goes on if the input
is in the range 0-15. Any other value results in no outputs on""";

param rw bit bargraph = 0 """If true the all outputs up to the input
value turn on. Note in bargraph mode the range is 0-16 where 0= all off.
In normal mode the range is 0-15 where 0= output 0 on""";

option personality;

license "GPL";
function _;
;;
FUNCTION(_){
int i;
for (i = 0; i < personality ; i++) {
out(i) = (bargraph) ? (in > i) : (in == i);
}
}




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to