How to use set_master method in lisa

Best Python code snippet using lisa_python

xppu.py

Source:xppu.py Github

copy

Full Screen

...180 end = h2i(self.b512m_end)181 else:182 sys.exit("Fatal Error!")183 return (start, end)184 def set_master(self, idx, master):185 k = mid_offset_start + (idx * 4)186 if k in self.masters:187 self.masters[k] = master188 # print(hex(k), master)189 def get_master(self, idx):190 k = mid_offset_start + (idx * 4)191 if k in self.masters:192 return self.masters[k]193 def get_master_by_smid(self, mid):194 for m in self.masters:195 if self.masters[m] is not None:196 if h2i(self.masters[m].mid) == mid:197 return int((m - mid_offset_start) / 4)198 return None199 def get_master_by_smrw(self, mid, mask, rw):200 for m in self.masters:201 if self.masters[m] is not None:202 m_inst = self.masters[m]203 if (204 h2i(m_inst.mid) == mid205 and h2i(m_inst.mask) == mask206 and m_inst.rw == rw207 ):208 return int((m - mid_offset_start) / 4)209 return None210 def get_master_addr(self, idx):211 k = mid_offset_start + (idx * 4)212 if k in self.masters:213 return hex(int(self.baseaddr, 16) + k)214 def get_master_val(self, idx):215 k = mid_offset_start + (idx * 4)216 if k in self.masters:217 return 0 if self.masters[k] is None else self.masters[k].val()218 def mid_name_to_idxx(self, name):219 return list(self.masters).index(name)220 def get_ctrl_reg_val(self):221 return hex((APER_PARITY << 2) | (MID_PARITY << 1))222 def get_ien_reg_addr_val(self):223 reg_addr = h2i(self.baseaddr) + 0x18224 reg_val = 0225 for istr, ival in Interrupts.items():226 reg_val = reg_val | (ival[0] << ival[1])227 return hex(reg_addr), hex(reg_val)228 def get_aperture(self, master_list):229 aperture = 0230 for pos, m in self.masters.items():231 if m is not None and m.name in master_list:232 pos = self.mid_name_to_idxx(pos)233 aperture = aperture | (1 << pos)234 aperture = aperture | (TZ << 27) # TrustZone235 return aperture236 def set_default_aperture(self, mask):237 self.def_apermask = mask238 # print("SET:", self.name, self.def_apermask)239 def get_default_aperture(self):240 # return hex(self.get_aperture(DEF_MASTERS))241 # print("GET:", self.name, self.def_apermask)242 return hex(self.def_apermask)243 def get_nondef_rw_aperture(self):244 def_aperture = int(self.get_default_aperture(), 16)245 return hex(def_aperture | self.get_aperture(["ANY_RW"]))246 def get_nondef_ro_aperture(self):247 def_aperture = int(self.get_default_aperture(), 16)248 return hex(def_aperture | self.get_aperture(["ANY_RO"]))249 def get_master_list_from_aperture(self, aper_mask):250 midx = (i for i in range(20) if ((aper_mask >> i) & 0x1) == 1)251 mid_list = [self.masters[list(self.masters)[idx]].name for idx in midx]252 return mid_list[::-1]253def mid(master, rw, parity):254 if master in MIDL:255 mid = MIDL[master][0]256 midm = MIDL[master][1]257 else:258 print("Error: missing MID in the list!")259 return MasterId(master, mid, midm, rw, parity)260def init_masters(xppu):261 xppu.set_master(0, mid("PSM", RW, MID_PARITY)) # PSM262 xppu.set_master(1, mid("RPU0", RW, MID_PARITY)) # RPU0263 xppu.set_master(2, mid("RPU1", RW, MID_PARITY)) # RPU1264 # xppu.set_master(3, mid('APU', RW, MID_PARITY)) # APU265 xppu.set_master(3, mid("APU0", RW, MID_PARITY)) # APU0266 xppu.set_master(4, mid("APU1", RW, MID_PARITY)) # APU1267 xppu.set_master(5, mid("HSDP_DPC", RW, MID_PARITY)) # HSDP_DPC268 xppu.set_master(6, mid("DAP", RW, MID_PARITY)) # DAP269 xppu.set_master(7, mid("PPU1", RW, MID_PARITY)) # PPU1 (PMC)270 xppu.set_master(8, mid("PPU0", RW, MID_PARITY)) # PPU0271 xppu.set_master(9, mid("PMC_DMA0", RW, MID_PARITY)) # PMC DMA0272 xppu.set_master(10, mid("PMC_DMA1", RW, MID_PARITY)) # PMC DMA1273 # -- RO (APU)274 xppu.set_master(11, mid("APU0_RO", RO, MID_PARITY)) # APU0 (RO)275 xppu.set_master(12, mid("APU1_RO", RO, MID_PARITY)) # APU1 (RO)276 # -- RO (RPU)277 xppu.set_master(13, mid("RPU0_RO", RO, MID_PARITY)) # RPU0278 xppu.set_master(14, mid("RPU1_RO", RO, MID_PARITY)) # RPU1279 # Skip -- the middle entries for now280 xppu.set_master(18, mid("ANY_RO", RO, MID_PARITY)) # Any master (RO)281 xppu.set_master(19, mid("ANY_RW", RW, MID_PARITY)) # Any master (RW)282def print_masters(xppu):283 for m in range(MASTERS):284 print(xppu.get_master_addr(m), xppu.get_master_val(m))285def print_apertures(xppu):286 def_aper = xppu.get_default_aperture()287 rw_aper = xppu.get_nondef_rw_aperture()288 ro_aper = xppu.get_nondef_ro_aperture()289 print("def_aper:", def_aper, "rw_aper:", rw_aper, "ro_aper:", ro_aper)290 # for k, v in xppu.apermap.items():291 # print('{0} : {1} - {2}'.format(k, hex(v[0]), hex(v[1])))292def init_xppu(name):293 x = xppu_hw[name]294 nodes[name] = Xppu(name, x[0], x[1], x[2], x[3], x[4])295 return nodes[name]...

Full Screen

Full Screen

test_game.py

Source:test_game.py Github

copy

Full Screen

...4class TestGame(TestCase):5 def test_not_master(self):6 game = Game()7 game.start()8 game.set_master(1)9 word = game.get_word(2)10 self.assertEqual('', word)11 def test_master(self):12 game = Game()13 game.start()14 game.set_master(1)15 word = game.get_word(1)16 self.assertEqual(game._current_word, word)17 def test_answered(self):18 game = Game()19 game.start()20 game.set_master(1)21 is_answered = game.is_word_answered(2, game._current_word)22 self.assertTrue(is_answered)23 def test_not_answered(self):24 game = Game()25 game.start()26 game.set_master(1)27 is_answered = game.is_word_answered(2, " ")28 self.assertFalse(is_answered)29 def test_adding_rating(self):30 game = Game()31 game.start()32 user = User(1, 'a')33 user.update_rating()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful