Jump to content
ELFORUM - Forumul electronistilor

Creare numarator pe 4 biti


Guest Adi Aioanei

Recommended Posts

Guest Adi Aioanei

Salut, vreau sa imi creez un numarator pe 4 biti ce urmeaza sa fie programat pe un circuit GAL.

Am facut codul urmator:

MODULE adi
TITLE 'Numarator pe 3 biti cu pin de selectare a sensului'
declarations
CLK PIN;
Q3..Q0 PIN istype 'reg';
Q = [Q3, Q2, Q1, Q0];
"Q7,Q6,Q5,Q4,Q3,Q2,Q1,Q0 pin 19,18,17,16,15,14,13,12 istype 'reg';
"Q = [Q7, Q6, Q5, Q4, Q3, Q2, Q1, Q0];
"qout pin 19 istype 'reg';

S0 = [0, 0, 0, 0];
S1 = [0, 0, 0, 1];
S2 = [0, 0, 1, 0];
S3 = [0, 0, 1, 1];
S4 = [0, 1, 0, 0];
S5 = [0, 1, 0, 1];
S6 = [0, 1, 1, 0];
S7 = [0, 1, 1, 1];
S8 = [1, 0, 0, 0];
S9 = [1, 0, 0, 1];
S10 = [1, 0, 1, 0];
S11 = [1, 0, 1, 1];
S12 = [1, 1, 0, 0];
S13 = [1, 1, 0, 1];
S14 = [1, 1, 1, 0];
S15 = [1, 1, 1, 1];
State_diagram [Q3, Q2, Q1, Q0]
State S0:
GoTo S1;
State S1:
GoTo S2;
State S2:
GoTo S3;
State S3:
GoTo S4;
State S4:
GoTo S5;
State S5:
GoTo S6;
State S6:
GoTo S7;
State S7:
GoTo S8;
State S8:
GoTo S9;
State S10:
GoTo S11;
State S11:
GoTo S12;
State S12:
GoTo S13;
State S13:
GoTo S0;

equations
Q.CLK = CLK;
"@alternate
"Q0 := /Q0;
"Q1 := Q1 :+: Q0;
"Q2 := Q2 :+: (Q1 *Q0);
"Q3 := Q3 :+: (Q2 * Q1 * Q0);

"@alternate
"am luat doar ecuatiile de la gray
"Q7 = Q7.FB;
"Q6 = Q7.FB :+: Q6.FB;
"Q5 = Q6.FB :+: Q5.FB;
"Q4 = Q5.FB :+: Q4.FB;

test_vectors
"([CLK, OE,Q7,Q6,Q5,Q4,Q3,Q2,Q1,Q0]->[Q7,Q6,Q5,Q4,Q3,Q2,Q1,Q0])
"[x, 0,0,0,0,0,0,0,0,0]->[x,x,x,x,x,x,x,x];
"([clk]->[qout])
"(.X.)->[.X.];
([CLK]->[Q3,Q2,Q1,Q0])
[.X.]->[.X.,.X.,.X.,.X.];
END

Insa problema e ca la simulare nu imi ia nici macar CLK-ul si nu reusesc sa rezolv problema.
Nu am nici erori nici avertizari. 

Link to comment
  • Replies 0
  • Created
  • Last Reply

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines