New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected inversion when using inverted registered outputs #16
Comments
I think I figured it out. GALasm implicitly changes S0 of OLMC if polarities of pin definition and pin equation differ. e.g.
|
Another update. Consider the following equations:
When assembled with
I expected Q1 & Q2 to be equal, but they are not. In other words - I expected |
EDIT: Possible fix: diff --git a/src/galasm.c b/src/galasm.c
index 052ad70..9788e91 100644
--- a/src/galasm.c
+++ b/src/galasm.c
@@ -1600,8 +1600,10 @@ void SetAND(int row, int pinnum, int negation, int gal_type)
/* is it a registered OLMC pin? */
/* yes, then correct the negation */
- if ((pinnum >= 14 && pinnum <= 23) && !Jedec.GALS1[23 - pinnum])
+ if ((pinnum >= 14 && pinnum <= 23) && !Jedec.GALS1[23 - pinnum] && Jedec.GALXOR[23 - pinnum])
{
negation = negation ? 0 : 1;
} This prevents inversion of registered pin if it's active-low. Tests after applying this fix:
|
I tried out the initial example on an ATF22V10C without the proposed fix and confirmed wrong behavior - Q2 is inverted from what it should be:
With the proposed fix, this example works correctly, as does the modified example having Q1 and Q2 inverted in the pin definitions. The proposed fix seems reasonable, based on the fact that feedback is unaffected by pin inversion in registered mode. I'll spend a bit more time reviewing before pushing the update. Thanks @and3rson for the report and detailed info. |
Fixed in commit c376d56 |
Consider this example:
If I invert
Q1
andQ2
in pin definitions as such:...I can observe the following difference in fuses:
I would expect only the S0 bit to change. However, the actual column is also getting changed (from true to inverted).
I checked the datasheet (http://web.mit.edu/6.115/www/document/gal22v10.pdf). On page 4 in the top section (S1=0) it's stated that the feedback originates from
/Q
while the pin itself is driven byQ
, so pin inversion does not have any influence on the feedback since it's driven by a separate driver.This means that
S0=0,S1=0
andS0=1,S1=0
should only change the behavior of the physical output, not the matrix. In other words, inverting a pin in the definition section should only change the S0 flag.Is this a bug or am I misunderstanding something?
The text was updated successfully, but these errors were encountered: