1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | ############################################################### |
---|
4 | ### ### |
---|
5 | ### File : mux.py ### |
---|
6 | ### Date : December 10 2009 ### |
---|
7 | ### Version : 1.02 ### |
---|
8 | ### Author : Belloeil Sophie ### |
---|
9 | ### ### |
---|
10 | ### Origin : This description has been developed at LIP6 ### |
---|
11 | ### University Paris 6 - Pierre et Marie Curie ### |
---|
12 | ### 4 Place Jussieu 75252 Paris Cedex 05 - France ### |
---|
13 | ### ### |
---|
14 | ############################################################### |
---|
15 | |
---|
16 | from stratus import * |
---|
17 | |
---|
18 | # Definition du bloc mux |
---|
19 | class mux ( Model ) : |
---|
20 | |
---|
21 | # Declaration des connecteurs |
---|
22 | def Interface ( self ) : |
---|
23 | # Recuperation du parametre 'nbit' |
---|
24 | self.n = self._param['nbit'] |
---|
25 | |
---|
26 | # Connecteurs |
---|
27 | self.i0 = SignalIn ( "i0", self.n ) |
---|
28 | self.i1 = SignalIn ( "i1", self.n ) |
---|
29 | self.cmd = SignalIn ( "cmd", 1 ) |
---|
30 | self.s = SignalOut ( "s", self.n ) |
---|
31 | self.vdd = VddIn ( "vdd" ) |
---|
32 | self.vss = VssIn ( "vss" ) |
---|
33 | |
---|
34 | # Instanciation des cellules |
---|
35 | def Netlist ( self ) : |
---|
36 | # Boucle for utilisant le parametre |
---|
37 | for i in range ( self.n ) : |
---|
38 | Inst ( "mx2_x2" |
---|
39 | , map = { 'i0' : self.i0[i] |
---|
40 | , 'i1' : self.i1[i] |
---|
41 | , 'cmd' : self.cmd |
---|
42 | , 'q' : self.s[i] |
---|
43 | , 'vdd' : self.vdd |
---|
44 | , 'vss' : self.vss |
---|
45 | } |
---|
46 | ) |
---|