ini
[aversive.git] / projects / microb2009 / tests / encoders_at90s2313 / gen_tableau.py
1 def gray2nat(x):
2     if (x==3):return 2
3     if (x==2):return 3
4     return x
5
6 # C1(t-1) C2(t-1) C1 C2
7 for i in range(256):
8     cod1 = (i&0x0C)>>2
9     cod2 = (i&0x03)>>0
10     cod1_prec = (i&0xC0)>>6
11     cod2_prec = (i&0x30)>>4
12
13     inc1 = gray2nat(cod1) - gray2nat(cod1_prec)
14     if inc1==3: texte1= "moins"
15     if inc1==2: texte1= "zero"
16     if inc1==1: texte1= "plus"
17     if inc1==0: texte1= "zero"
18     if inc1==-1: texte1= "moins"
19     if inc1==-2: texte1= "zero"
20     if inc1==-3: texte1= "plus"
21
22     inc2 = gray2nat(cod2) - gray2nat(cod2_prec)
23     if inc2==3: texte2= "moins"
24     if inc2==2: texte2= "zero"
25     if inc2==1: texte2= "plus"
26     if inc2==0: texte2= "zero"
27     if inc2==-1: texte2= "moins"
28     if inc2==-2: texte2= "zero"
29     if inc2==-3: texte2= "plus"
30
31                                                      
32     print
33     print "     ;; VAL = %3d -  C1(t-1) C2(t-1) C1 C2 (naturel) %3d %3d %3d %3d"%(i,gray2nat(cod1_prec),gray2nat(cod2_prec),
34                                            gray2nat(cod1),gray2nat(cod2))
35     print "     rjmp %s_%s"%(texte1,texte2)