Shift - Easy way to instantiate a shifter
netOut <= netCmd.Shift ( netIn, direction, type )
This method is a method of net. The net which this method is applied to is the command of the shifter, it's the one which defines the number of bits to shift. The net given as parameter is the input net. The other arguments set the different patameters. The method returns a net : the output net.
Note that it is possible to change the generator instanciated with the SetShift
method.
netIn
: the net which is going to be shifted
direction
: this string represents the direction of the shift :
type
: this string represents the type of the shift :
class essai ( Model ) : def Interface ( self ) : self.A = SignalIn ( "a", 4 ) self.Cmd = SignalIn ( "cmd", 2 ) self.S1 = SignalOut ( "s1", 4 ) self.S2 = SignalOut ( "s2", 4 ) self.S3 = SignalOut ( "s3", 4 ) self.Vdd = VddIn ( "vdd" ) self.Vss = VssIn ( "vss" ) def Netlist ( self ) : self.S1 <= self.Cmd.Shift ( self.A, "right", "logical" ) self.S2 <= self.Cmd.Shift ( self.A, "right", "arith" ) self.S3 <= self.Cmd.Shift ( self.A, "left", "circular" )If the value of "a" is "0b1001" and the value of "cmd" is "0b10", we will have :
Some errors may occur :
[Stratus ERROR] Shift :
The input net does not have a positive arity.
[Stratus ERROR] Shift :
The direction parameter must be "left" or "right".
[Stratus ERROR] Shift :
The type parameter must be "logical" or "arith" or "circular".
Introduction Netlist Instanciation of a multiplexor Instanciation of a register Instanciation of constants Boolean operations Arithmetical operations Comparison operations
Sophie BELLOEIL