Example #1
0
 def decode_phi(self, xlow, xup):
     """
     for the HW represntation: the phi variable goes across 32bit word boundary
     at the boundary a control bit is reserved
     """
     # this is a specialized function because phi reaches over the word boundary
     ctrl_mask = bithlp.get_mask(31, 31)
     # +1 because dinyar shaves off the 32nd bit in the vhdl-file
     raw_mask = bithlp.get_mask(xlow, xup+1)
     # mask is 11110111111 for phi
     mask = raw_mask ^ ctrl_mask
     raw_val = self.bitword & mask
     raw_val = raw_val >> xlow
     lsw_mask = bithlp.get_mask(0, 5)
     msw_mask = bithlp.get_mask(7, 10)
     val = (raw_val & lsw_mask) + ((raw_val & msw_mask) >> 1)
     return val
Example #2
0
 def decode_phi(self, xlow, xup):
     """
     for the HW represntation: the phi variable goes across 32bit word boundary
     at the boundary a control bit is reserved
     """
     # this is a specialized function because phi reaches over the word boundary
     ctrl_mask = bithlp.get_mask(31, 31)
     # +1 because dinyar shaves off the 32nd bit in the vhdl-file
     raw_mask = bithlp.get_mask(xlow, xup+1)
     # mask is 11110111111 for phi
     mask = raw_mask ^ ctrl_mask
     raw_val = self.bitword & mask
     raw_val = raw_val >> xlow
     lsw_mask = bithlp.get_mask(0, 5)
     msw_mask = bithlp.get_mask(7, 10)
     val = (raw_val & lsw_mask) + ((raw_val & msw_mask) >> 1)
     return val
Example #3
0
 def encode_phi(self, phi):
     """
     As the hardware expects a control bit on position 31 and phi
     goes across the word boundary we need to put a zero in the
     middle.
     """
     mask_lsw = bithlp.get_mask(0, 5)  # 0-5 for phi
     lsw = int(phi) & mask_lsw
     msw = int(phi) >> 6
     encoded_phi = lsw + (msw << 7)
     return encoded_phi
Example #4
0
 def encode_phi(self, phi):
     """
     As the hardware expects a control bit on position 31 and phi
     goes across the word boundary we need to put a zero in the
     middle.
     """
     mask_lsw = bithlp.get_mask(0, 5)  # 0-5 for phi
     lsw = int(phi) & mask_lsw
     msw = int(phi) >> 6
     encoded_phi = lsw + (msw << 7)
     return encoded_phi