Giter VIP home page Giter VIP logo

Comments (5)

pjdennis avatar pjdennis commented on August 29, 2024 1

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:

CLK  A    B    NC   NC   NC   NC   NC   NC   NC   NC   GND
/CS  Q1   Q2   NC   NC   NC   NC   NC   NC   NC   NC   VCC

/Q1.R = A * B
/Q2.R = /Q1

---

Start with A Low; B Low
Toggle CLK twice
Result: Q1 High; Q2 Low but should be Q1 High; Q2 High

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.

from galasm.

pjdennis avatar pjdennis commented on August 29, 2024 1

Fixed in commit c376d56

from galasm.

and3rson avatar and3rson commented on August 29, 2024

I think I figured it out.

GALasm implicitly changes S0 of OLMC if polarities of pin definition and pin equation differ.

e.g.

/CS /Q ; ...

/Q.R = A * B

; Q: S0 = 1, S1 = 0
/CS /Q ; ...

Q.R = A * B

; Q: S0 = 0, S1 = 1

from galasm.

and3rson avatar and3rson commented on August 29, 2024

Another update. Consider the following equations:

/Q1.R = A * B
Q2.R = Q1

When assembled with galasm and then disassembled with jed2eqn, I get the following equations:

/Q1 := A * B
Q2 := /Q1

I expected Q1 & Q2 to be equal, but they are not. In other words - I expected /X = equation to be a different way of writing X = /equation (which helps when having multiple OR terms). I could also reproduce the same behavior with https://github.com/simon-frankau/galette.

from galasm.

and3rson avatar and3rson commented on August 29, 2024

I think the offending line is galasm:1605 which shouldn't be there, since it inverts the pin (inside equation) if it is active-low. But being active-low should not affect any equations (as per the datasheet).
Seems like this line is needed due to register feedback being from a negative flip-flop output. So the spurious inversion might be coming from a different place.

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:

; Source
A  B
Q1 Q2

/Q1.R = A * B
Q2.R = Q1

; Disassembled (before fix)
/Q1 := A * B
Q2 := /Q1    ; WRONG

; Disassembled (after fix)
/Q1 := A * B
Q2 := Q1
; Source
 A  B
/Q1 Q2

Q1.R = A * B
Q2.R = Q1

; Disassembled (before fix)
/Q1 := A * B
Q2 := Q1     ; WRONG

; Disassembled (after fix)
/Q1 := A * B
Q2 := /Q1

from galasm.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.