1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | from stratus import * |
---|
4 | |
---|
5 | # definition du bloc mux |
---|
6 | class mux ( Model ) : |
---|
7 | |
---|
8 | # declaration des connecteurs |
---|
9 | def Interface ( self ) : |
---|
10 | # recuperation du parametre |
---|
11 | self.n = self._param['nbit'] |
---|
12 | |
---|
13 | # connecteurs |
---|
14 | self.i0 = SignalIn ( "i0", self.n ) |
---|
15 | self.i1 = SignalIn ( "i1", self.n ) |
---|
16 | self.cmd = SignalIn ( "cmd", 1 ) |
---|
17 | self.s = SignalOut ( "s", self.n ) |
---|
18 | self.vdd = VddIn ( "vdd" ) |
---|
19 | self.vss = VssIn ( "vss" ) |
---|
20 | |
---|
21 | # instanciation des cellules |
---|
22 | def Netlist ( self ) : |
---|
23 | for i in range ( self.n ) : |
---|
24 | Inst ( "mx2_x2" |
---|
25 | , map = { 'i0' : self.i0[i] |
---|
26 | , 'i1' : self.i1[i] |
---|
27 | , 'cmd' : self.cmd |
---|
28 | , 'q' : self.s[i] |
---|
29 | , 'vdd' : self.vdd |
---|
30 | , 'vss' : self.vss |
---|
31 | } |
---|
32 | ) |
---|