Closed logoliv closed 3 months ago
This is a bug in Antares' handling of the bit accessor. Thank you for reporting this!
Unfortunately, I don't see a workaround until the bug is fixed. Sorry for the inconvenience.
Same error message in this situation : data is input 16 bit, address is output 16 bit
var adr = (address and 0b0000000001111111)
address = (data and 0b1111111110000000) or adr
I need in a certain case to replace the 9 higher bits from address by the ones from data. No way to find a workaround (I first tried with a for loop and bit accessor with address@i = data@i, as you see I also tried with an intermediate variable). It's the reference to an output that causes problem I think : if you only keep "address = (data and 0b1111111110000000)" it works.
You should prioritize the resolution of this bug for 1.14, as it will quickly become blocking for my project...
The problem is that the bit accessor works on variables, but not yet on pins
There's no accessor in my second case, it's just an AND between numbers. Plus I've already tried something like :
var adr = address
address = (data and 0b1111111110000000) or (adr and 0b0000000001111111)
and I doesn't work either, though I use a variable for the AND instead of the output pin. The problem appears as soon as I use the output pin as reference to do some operation.
Yes, the problem is reading values from output pins. Scripting in Antares so far only supports reading values from input pins.
The bit accessor needs to read the output pin to get the value in which a bit has to be changed. I'll fix this.
Your second scenario is not so clear. Since address is an output: What value would you address to possess the first time the script is executed? Anyway, this will be fixed as well, and my fix will at least avoid that the second scenario produces an error.
Here is the component stripped from all the circuitry : Copy of inc dec.zip
It's an incrementer/decrementer and the limit6 input limits the carry propagation to the bit 6, so that bits 7 to 15 are left untouched. I always try to make a script in addition to the circuitry of the medium complexity components, to optimize speed in case of "flat simulation".
It's fine when i work with an intermediate variable instead of the output :
if ('carry in') {
var adr = 0x0000
if (decrement) adr = data - 1
else adr = data + 1
if (limit6) address = (data and 0b1111111110000000) or (adr and 0b0000000001111111)
else address = adr
}
else address = data
I just defined a 100% scripted subcircuit with an 8 bit input (inp) and a 16 bit output (out). The script is :
When running the simulation I have the issue "Input port 'out' not found at 0:0". If I just replace the last line by "out = in" everything is fine.
Subcircuit joined nbits output.zip