Replies: 2 comments
-
When you use icX you must use IcX :) Do not use registers in icX. this interferes with the "memory manager"
Maybe I should add a warning message when using registers in icx P.S |
Beta Was this translation helpful? Give feedback.
0 replies
-
You've understood it fine :-) I was thinking also about minifying the ic10 result. If that's not necessarily a project goal for you, your idea of adding a warning will still be helpful to prevent this issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Proposal
If icx code refers to a register directly, such as
r0
, and the sum count of "scratch registers" and regular variables does not exceed the limit of 16, reserve the used registers as "scratch registers" automatically.Describe the problem scenario
I have some complex scripts in ic10 I'd like to move to icx. The aim is to make it easier to read while also making it so I can minify the end-result without losing comments and organisational whitespace. I and others have conventions to use the lower registers such as r0/r1 as scratch registers. This means these registers are normally only used for temporary values that we immediately discard.
Unfortunately, using these registers as scratch registers conflicts with the registers icx uses when converting to ic10. I'm sure there's a different way to handle this besides my suggestion - but this is the simplest thing I could think of at this time.
Example simple non-ICX script
This ic10 script uses two strategically-placed daylight sensors to send a signal of whether or not it is nighttime to a Logic Memory unit. This is so indoor and outdoor lights can be turned on during dawn/dusk without any period of darkness.
Take note of line 5
alias nighttime r4
and line 16l r0 east_daylight_sensor Activate
.Converted into icx:
Converted back into ic10:
When we convert the script to icx, we can no longer specify that we want the variables to use registers starting with
r4
. Thenighttime
variable ends up being assigned asr0
, which then conflicts with the linel r0 east_daylight_sensor Activate
. A "workaround" would be to start making extra unnecessary variables such asdaytime
orscratch
, or to start using r15 as the scratch variable. Unfortunately without complex logics or math, such asnighttime = not (east_daylight_sensor.Activate or west_daylight_sensor.Activate)
, these scratch registers are still very convenient.Desired Result
By avoiding the conflict, in the example above, the ic10 output in line 1 would say
alias nighttime r2
, instead ofalias nighttime r0
, as bothr0
andr1
are explicitly referenced elsewhere in the icx script.Beta Was this translation helpful? Give feedback.
All reactions