Beispiel #1
0
	def setSails(self):
		# '''Sets the sails to the correct location for the wind data coming in. '''
		currentWindHeading=bank.bank('currentWindHeading')
		currentHeading=bank.bank('currentHeading')
		print 'current wind heading is: ', currentWindHeading
		print 'Current bot heading is: ', currentHeading
	
		windAngle=math.fabs(currentWindHeading-currentHeading)
		if windAngle>180:
			windAngle=math.fabs(windAngle-360)
		print 'calculated wind angle is:', windAngle
	
		if windAngle<0:
			print 'Error: negative wind angle!'
			sailDesired=40
		if windAngle<45:
			print 'Bot is in irons!'
			#outOfIrons()
		if (windAngle<180) & (windAngle>45):
			sailDesired=(.75*windAngle)-30
		if windAngle>180:
			sailDesired=90
			print 'Error: wind angle over 180 degrees'
		print 'Desired sail angle is: ', sailDesired
		return sailDesired
    def runTest(self):
        globals.init_openram("config_20_{0}".format(OPTS.tech_name))
        from bank import bank
        from sram_config import sram_config

        c = sram_config(word_size=4,
                        num_words=16)
        c.num_banks=2

        c.words_per_row=1
        debug.info(1, "No column mux")
        a = bank(c, name="bank1_multi")
        self.local_check(a)

        c.num_words=32
        c.words_per_row=2
        debug.info(1, "Two way column mux")
        a = bank(c, name="bank2_multi")
        self.local_check(a)

        c.num_words=64
        c.words_per_row=4
        debug.info(1, "Four way column mux")
        a = bank(c, name="bank3_multi")
        self.local_check(a)

        c.word_size=2
        c.num_words=128
        c.words_per_row=8
        debug.info(1, "Eight way column mux")
        a = bank(c, name="bank4_multi")
        self.local_check(a)
        
        globals.end_openram()
Beispiel #3
0
def heading_line():
	#gives the heading (angle in degrees from the +x axis) of the line to be followed
	import bank
	import math
	linstart=bank.bank('linstart')
	posDesired=bank.bank('posDesired')
	m=slope(posDesired,linstart)
	angle=math.degrees(math.atan(m/1))

	xcheck=(posDesired[0]-linstart[0])>0#if true, in I or IV
	ycheck=(posDesired[1]-linstart[1])>0#if true, in I or II
	#print 'x check: ' +str(xcheck) + '. y check:' +str(ycheck)+'.'

	if (ycheck==True) & (xcheck==False):  #quadrent 2
		angle=90+math.fabs(angle)
		#print 'Boat should be traveling into quadrent 2!'

	if  (xcheck==True) & (ycheck==False): #quadrent 4
		angle=270+math.fabs(angle)
		#print 'Boat should be heading into quadrent 4!'

	if (xcheck==False) & (ycheck==False): #quadrent 3
		angle =180+math.fabs(angle)
		#print 'Boat should be heading into quadrent 3!'
	#if quadrent 1, the angle doesn't need to be parsed.

	return angle
Beispiel #4
0
def headingToPoint():
    #gives the heading (angle in degrees from the +x axis) of the line to be followed

    posCurrent = bank.bank('posCurrent')  #robot's current position
    posDesired = bank.bank('posDesired')  #waypoint going toward
    m = slope(posDesired, posCurrent)
    angle = math.degrees(math.atan(m / 1))

    xcheck = (posDesired[0] - posCurrent[0]) > 0  #if true, in I or IV
    ycheck = (posDesired[1] - posCurrent[1]) > 0  #if true, in I or II
    #print 'x check: ' +str(xcheck) + '. y check:' +str(ycheck)+'.'

    if (ycheck == True) & (xcheck == False):  #quadrent 2
        angle = 90 + math.fabs(angle)
        #print 'Boat should be traveling into quadrent 2!'

    if (xcheck == True) & (ycheck == False):  #quadrent 4
        angle = 270 + math.fabs(angle)
        #print 'Boat should be heading into quadrent 4!'

    if (xcheck == False) & (ycheck == False):  #quadrent 3
        angle = 180 + math.fabs(angle)
        #print 'Boat should be heading into quadrent 3!'
    #if quadrent 1, the angle doesn't need to be parsed.

    return angle
Beispiel #5
0
    def runTest(self):
        globals.init_openram("config_20_{0}".format(OPTS.tech_name))
        # we will manually run lvs/drc
        OPTS.check_lvsdrc = False

        import bank

        debug.info(1, "No column mux")
        a = bank.bank(word_size=4, num_words=16, words_per_row=1, num_banks=2, name="bank1")
        self.local_check(a)

        debug.info(1, "Two way column mux")
        #a = bank.bank(word_size=4, num_words=32, words_per_row=2, num_banks=2, name="bank2")
        #self.local_check(a)

        debug.info(1, "Four way column mux")
        a = bank.bank(word_size=4, num_words=64, words_per_row=4, num_banks=2, name="bank3")
        self.local_check(a)

        # Eight way has a short circuit of one column mux select to gnd rail
        # debug.info(1, "Eight way column mux")
        # a = bank.bank(word_size=2, num_words=128, words_per_row=8, num_banks=2, name="bank4")
        # self.local_check(a)
        
        OPTS.check_lvsdrc = True
        globals.end_openram()
Beispiel #6
0
	def headingToPoint(self):
		#'''gives the heading (angle in degrees from the +x axis) of the line to be followed'''

		posCurrent=bank.bank('posCurrent') #robot's current position
		posDesired=bank.bank('posDesired') #waypoint going toward
		m=self.slope(posDesired,posCurrent)
		angle=math.degrees(math.atan(m/1))

		xcheck=(posDesired[0]-posCurrent[0])>0#if true, in I or IV
		ycheck=(posDesired[1]-posCurrent[1])>0#if true, in I or II
		#print 'x check: ' +str(xcheck) + '. y check:' +str(ycheck)+'.'

		if (ycheck==True) & (xcheck==False):  #quadrent 2
			angle=90+math.fabs(angle)
			#print 'Boat should be traveling into quadrent 2!'

		if  (xcheck==True) & (ycheck==False): #quadrent 4
			angle=270+math.fabs(angle)
			#print 'Boat should be heading into quadrent 4!'

		if (xcheck==False) & (ycheck==False): #quadrent 3
			angle =180+math.fabs(angle)
			#print 'Boat should be heading into quadrent 3!'
		#if quadrent 1, the angle doesn't need to be parsed.

		return angle
Beispiel #7
0
    def stearingDestoStrSvoDes(self):
        stearingDesired = bank.bank("stearingDesired")
        currentHeading = bank.bank("currentHeading")

        print "desired stearing is: ", stearingDesired
        print "current heading is: ", currentHeading

        if stearingDesired > currentHeading:  # bot needs to turn left!
            stearingServoDesired = 45 - (stearingDesired - currentHeading)

        if stearingDesired < currentHeading:  # bot needs to turn right!
            stearingServoDesired = 45 + (currentHeading - stearingDesired)

        print "desired servo stearing angle is: ", stearingServoDesired
        return stearingServoDesired
Beispiel #8
0
def stearingDestoStrSvoDes():
	stearingDesired=bank.bank('stearingDesired')
	currentHeading=bank.bank('currentHeading')
	
	print 'desired stearing is: ', stearingDesired
	print 'current heading is: ',currentHeading
	
	if stearingDesired>currentHeading: #bot needs to turn left!
		stearingServoDesired=45-(stearingDesired-currentHeading)
		
	if stearingDesired<currentHeading: #bot needs to turn right!
		stearingServoDesired=45+(currentHeading-stearingDesired)
		
	print 'desired servo stearing angle is: ',stearingServoDesired
	return stearingServoDesired
Beispiel #9
0
	def followLine(self):
		# '''Outputs the necessary, global heading for the robot to follow a line with specified endpoints'''
		
		bot_posVlin=self.above_below_on_line()
		lineheading=self.heading_line()
		botheading=bank.bank('currentHeading')
		print 'Line heading: '+str(lineheading)
		print 'Bot heading: '+str(botheading)
		
		#check through possible cases and assign the correct, desired, global heading accordingly
		if (bot_posVlin=='above') & (botheading>lineheading): #above line and heading away from it.
			print 'Bot above and heading away from line to be followed'
			headDesired=((lineheading-botheading)/2)+lineheading

		if (bot_posVlin=='below') & (botheading>lineheading): #below line and heading toward it.
			print 'Bot below and heading away from line to be followed'
			headDesired=((lineheading-botheading)/2)+lineheading

		if (bot_posVlin=='below') & (botheading<lineheading): #below line and heading away from it. 
			print 'Bot below and heading toward from line to be followed'
			headDesired=lineheading-math.fabs((lineheading-botheading)/2)

		if (bot_posVlin=='above') & (botheading<lineheading): #above line and heading toward it.
			print 'Bot above and heading toward from line to be followed'
			headDesired=lineheading-math.fabs((lineheading-botheading)/2)
		if bot_posVlin=='on': #on line! :)
			print 'Bot is on the line to be followed!'
			headDesired=lineheading
			
			
		print 'The desired heading for the bot is:' + str(headDesired)
		return headDesired
Beispiel #10
0
    def runTest(self):
        globals.init_AMC("config_20_{0}".format(OPTS.tech_name),
                         is_unit_test=False)

        global calibre
        import calibre
        OPTS.check_lvsdrc = False

        import bank

        debug.info(1, "Single Bank Test")
        """ range of acceptable value: 
        
        word_size is any number greater than 1
        word_per_row in [1, 2, 4] 
        num_rows in [32, 64, 128, 256, 512]
        num_subanks in [1, 2, 4, 8]
        two_level_bank [False, True] : if True split and merge cells will be added
        """
        a = bank.bank(word_size=32,
                      words_per_row=1,
                      num_rows=64,
                      num_subanks=2,
                      two_level_bank=True,
                      name="bank")

        self.local_check(a)

        OPTS.check_lvsdrc = True
        # return it back to it's normal state
        globals.end_AMC()
Beispiel #11
0
    def populateBanks(self, wTree):
        self.currentID = 0
        if self.banksList == []:
            self.currentBank = 'Bank 1'
            for i in range(bank.bank_max):
                self.banksList.append(bank(i))
        else:
            self.currentBank = 'Bank 1'

        self.bankNameEntry = wTree.get_object('bankNameEntry')
        if (self.bankNameEntry):
            self.bankNameEntry.set_text(self.currentBank)

        scrolledWindowBanks = wTree.get_object('scrolledWindowBanks')
        if (scrolledWindowBanks):
            table = gtk.Table(bank.bank_max, 1, True)
            scrolledWindowBanks.add_with_viewport(table)
            for i in range(bank.bank_max):
                label = gtk.Label(self.banksList[i])
                eventbox = gtk.EventBox()
                eventbox.add(label)
                eventbox.set_visible_window(False)
                eventbox.set_events(gtk.gdk.BUTTON_PRESS_MASK)
                eventbox.connect('button_press_event', self.updateBank, i)
                table.attach(eventbox, 0, 1, i, i + 1)
Beispiel #12
0
def followLine():
	import bank
	import math
	
	bot_posVlin=above_below_on_line()
	lineheading=heading_line()
	botheading=bank.bank('currentHeading')
	print 'Line heading: '+str(lineheading)
	print 'Bot heading: '+str(botheading)
	
	if (bot_posVlin=='above') & (botheading>lineheading): #above line and heading away from it.
		print 'Bot above and heading away from line to be followed'
		headDesired=((lineheading-botheading)/2)+lineheading

	if (bot_posVlin=='below') & (botheading>lineheading):
		print 'Bot below and heading away from line to be followed'
		headDesired=((lineheading-botheading)/2)+lineheading

	if (bot_posVlin=='below') & (botheading<lineheading):
		print 'Bot below and heading toward from line to be followed'
		headDesired=lineheading-math.fabs((lineheading-botheading)/2)

	if (bot_posVlin=='above') & (botheading<lineheading):
		print 'Bot above and heading toward from line to be followed'
		headDesired=lineheading-math.fabs((lineheading-botheading)/2)
	if bot_posVlin=='on':
		print 'Bot is on the line to be followed!'
		headDesired=lineheading
	print 'The desired heading for the bot is:' + str(headDesired)
Beispiel #13
0
    def create_modules(self):
        """ Create all the modules that will be used """

        # Create the control logic module
        self.control_logic = self.mod_control_logic(num_rows=self.num_rows)
        self.add_mod(self.control_logic)

        # Create the bank module (up to four are instantiated)
        self.bank = bank(word_size=self.word_size,
                         num_words=self.num_words_per_bank,
                         words_per_row=self.words_per_row,
                         num_banks=self.num_banks,
                         name="bank")
        self.add_mod(self.bank)

        # Conditionally create the
        if (self.num_banks > 1):
            self.create_multi_bank_modules()

        self.bank_count = 0

        self.power_rail_width = self.bank.vdd_rail_width
        # Leave some extra space for the pitch
        self.power_rail_pitch = self.bank.vdd_rail_width + 2 * drc[
            "metal3_to_metal3"]
Beispiel #14
0
    def add_modules(self):
        self.bitcell = factory.create(module_type=OPTS.bitcell)

        # Create the address and control flops (but not the clk)
        from dff_array import dff_array
        self.row_addr_dff = dff_array(name="row_addr_dff", rows=self.row_addr_size, columns=1)
        self.add_mod(self.row_addr_dff)

        if self.col_addr_size > 0:
            self.col_addr_dff = dff_array(name="col_addr_dff", rows=1, columns=self.col_addr_size)
            self.add_mod(self.col_addr_dff)
        else:
            self.col_addr_dff = None

        self.data_dff = dff_array(name="data_dff", rows=1, columns=self.word_size)
        self.add_mod(self.data_dff)
        
        # Create the bank module (up to four are instantiated)
        from bank import bank
        self.bank = bank(self.sram_config,
                         name="bank")
        self.add_mod(self.bank)

        # Create bank decoder
        if(self.num_banks > 1):
            self.add_multi_bank_modules()

        self.bank_count = 0

        self.supply_rail_width = self.bank.supply_rail_width
        self.supply_rail_pitch = self.bank.supply_rail_pitch
        
        #The control logic can resize itself based on the other modules. Requires all other modules added before control logic.
        self.all_mods_except_control_done = True

        c = reload(__import__(OPTS.control_logic))
        self.mod_control_logic = getattr(c, OPTS.control_logic)
        
        # Create the control logic module for each port type
        if len(self.readwrite_ports)>0:
            self.control_logic_rw = self.mod_control_logic(num_rows=self.num_rows,
                                                           words_per_row=self.words_per_row,
                                                           word_size=self.word_size,
                                                           sram=self, 
                                                           port_type="rw")
            self.add_mod(self.control_logic_rw)
        if len(self.writeonly_ports)>0:
            self.control_logic_w = self.mod_control_logic(num_rows=self.num_rows, 
                                                          words_per_row=self.words_per_row,
                                                          word_size=self.word_size,
                                                          sram=self, 
                                                          port_type="w")
            self.add_mod(self.control_logic_w)
        if len(self.readonly_ports)>0:
            self.control_logic_r = self.mod_control_logic(num_rows=self.num_rows, 
                                                          words_per_row=self.words_per_row,
                                                          word_size=self.word_size,
                                                          sram=self, 
                                                          port_type="r")
            self.add_mod(self.control_logic_r)
Beispiel #15
0
def mainAct(pl):
    clear()
    choice = pMenu([
        'hunt',
        'move',
        'heal',
        'party',
        'shop',
        'dex',
        'bank',
        pl.name,
        'save',
        'leave',
    ])
    if choice == 'hunt':
        if not pl.countawake():
            clear()
            print pl.name + ' is out of usable pokemon!'
            xxx = raw_input('\n\npress enter')
        else:
            hunt(pl)
    if choice == 'party':
        party(pl)
    if choice == pl.name:
        clear()
        print 'Status\n\n'
        print pl.name + '   $' + str(pl.money)
        for bt in pl.balls:
            if pl.balls[bt] > 0:
                print bt + ': ' + str(pl.balls[bt])
        print '\n'
        raw_input('enter to return')
        return 0
    if choice == 'shop':
        shop(pl)
    if choice == 'heal':
        heal(pl)
    if choice == 'dex':
        dexui(pl)
    if choice == 'bank':
        bank(pl)
    if choice == 'save':
        save(pl)
    if choice == 'leave':
        return 1
    if choice == 'move':
        move(pl)
Beispiel #16
0
	def sailDesToServoDes(self):
		#midbrain
		#converts from the sail theta to the equivelent theta for the sail winch
		import bank
		sailDesired=bank.bank('sailDesired')
		sailServoDesired= (sailDesired-20)/2
		print 'The servo set angle is: ' +str(sailServoDesired) + ' degrees'
		return sailServoDesired
def limitSailServo():
    sailDesired = bank.bank('sailDesired')
    if sailDesired > 180:
        sailDesired = 180
    if sailDesired < 0:
        sailDesired = 0

    print "The sail angle sent to the servo is:", sailDesired
Beispiel #18
0
    def limitStearingServo(self):
        stearingDesired = bank.bank("stearingDesired")
        if stearingDesired > 90:
            stearingDesired = 90
        if stearingDesired < 0:
            stearingDesired = 0

        print "The sail angle sent to the servo is:", stearingDesired
def limitStearingServo():
    sailDesired = bank.bank('sailDesired')
    if sailDesired > 90:
        sailDesired = 90
    if stearingDesired < 0:
        sailDesired = 0

    print "The sail angle sent to the servo is:", sailDesired
Beispiel #20
0
    def limitSailServo(self):
        sailDesired = bank.bank("sailDesired")
        if sailDesired > 180:
            sailDesired = 180
        if sailDesired < 0:
            sailDesired = 0

        print "The sail angle sent to the servo is:", sailDesired
def limitStearingServo():
	sailDesired=bank.bank('sailDesired')
	if sailDesired >90:
		sailDesired=90
	if stearingDesired<0:
		sailDesired=0
		
	print "The sail angle sent to the servo is:", sailDesired
Beispiel #22
0
	def mtnHeading(self):
		# '''Keeps the robot on a desired heading. Output: desired, global heading'''
		currentHeading=bank.bank('currentHeading')
		desiredHeading=bank.bank('desiredHeading')
		print 'Current heading: ' + str(currentHeading)
		print 'Desired heading:' +str(desiredHeading)
		delta=abs((currentHeading-desiredHeading)/2)
		print 'Delta: '+ str(delta)
		if currentHeading > desiredHeading:
			desiredStearing=currentHeading-delta
			print 'desired greater than current'
		if currentHeading<desiredHeading:
			desiredStearing=currentHeading+delta
			print 'current greater than desired'
	
		print 'the desired stearing angle is: ' + str(desiredStearing)
		return desiredStearing
Beispiel #23
0
def sailDesToServoDes():
    #midbrain
    #converts from the sail theta to the equivelent theta for the sail winch
    import bank
    sailDesired = bank.bank('sailDesired')
    sailServoDesired = (sailDesired - 20) / 2
    print 'The servo set angle is: ' + str(sailServoDesired) + ' degrees'
    return sailServoDesired
Beispiel #24
0
def missionMannager():
	
	number_of_modes=int(raw_input('How many modes would you like to have in your mission?'))
	
	mission=[]
	
	for mode in range (0,number_of_modes):
		mode=raw_input('What mode would you like to use here? choces: "line follow," "obstacle avoid," "go to point," "maintain heading" ')
		if mode=='line follow':
			pt1=raw_input('GPS Coordinates of first point (in brackets:[])? ')
			pt2=raw_input('GPS Coordinates of second point (in brackets:[])? ')
			mission.append(['line follow',pt1,pt2])
			
		if mode=='obstacle avoid':
			timeT=raw_input('How long would you like it to avoid obstacles on its own?')
			mission.append(['obstacle avoid',timeT])
			
		if mode=='go to point':
			pt=raw_input('GPS coordinates of point (in brackets:[])? ')
			mission.append(['go to point',pt])
			
		if mode=='maintain heading':
			heading=raw_input('Desired global heading (in degrees)?')
			timeT=timeT=raw_input('How long would you like it to maintain this heading?')
			mission.append(['maintain heading',heading,timeT])
			
	print 'Mission is:', mission
	
	for mis in mission:
		print mis[0]
		if mis[0]=='line follow':
			while bank.bank('posCurrent')!=mis[2]:
				followLine.followLine()
				time.sleep(.25)
		if mis[0]=='obstacle avoid':
			for t in range (0,2*int(mis[1])):
				obsAvoid.obsAvoid()
		if mis[0]=='go to point':
			while bank.bank('posCurrent')!=mis[1]:
				goToPoint.goToPoint()
				time.sleep(.25)
		if mis[0]=='maintain heading':
			for t in range (0,4*int(mis[2])):
				mtnHeading.mtnHeading()
				time.sleep(.25)
Beispiel #25
0
def mtnHeading():
    # Keeps the robot on a desired heading
    import bank
    currentHeading = bank.bank('currentHeading')
    desiredHeading = bank.bank('desiredHeading')
    print 'Current heading: ' + str(currentHeading)
    print 'Desired heading:' + str(desiredHeading)
    delta = abs((currentHeading - desiredHeading) / 2)
    print 'Delta: ' + str(delta)
    if currentHeading > desiredHeading:
        desiredStearing = currentHeading - delta
        print 'desired greater than current'
    if currentHeading < desiredHeading:
        desiredStearing = currentHeading + delta
        print 'current greater than desired'

    print 'the desired stearing angle is: ' + str(desiredStearing)
    return desiredStearing
Beispiel #26
0
	def readPosition(self):
		# '''Reads the current GPS position from the GPS chip.'''
		#data=self.GPS.readline()
		
		#test data set: 
		data='$GPGGA,001038.00,3334.2313457,S,11211.0576940,W,2,04,5.4,354.682,M,-26.574,M,7.0,0138*74'
		ckStng=data[1:data[14].find('*')-2]

		ckSum=0
		for i in ckStng:
			ckSum = ckSum ^ ord(i)
		#print 'Check sum caluclated: hex:', hex(ckSum), 'dec:', ckSum
		data=data.split(',')
		ckSumSat=data[14].split('*')

		
		if str(hex(ckSum)) != '0x'+str(ckSumSat[1]): #use  check sum from GPS vs calculated to verify string isn't corrupted:
			print 'Check Sum Error from the GPS! :('
			positionUse=bank.bank('posPast')
			return positionUse
			
		else: #if the GPS string isn't corrupted, use it:
			print 'Good GPS data! :)'					
			if data[6]==0: #if there isn't a GPS lock, assume the robot hasn't moved
				print 'No GPS Lock! :('
				positionUse=bank.bank('posPast')
				return positionUse
				
			if data[6]==1:
				print 'GPS fix!'
			if data[6]==2:
				print 'DGPS fix!'
				
			latitude=data[2]
			longitude=data[4]
			latitude=int(latitude[:2])+(float(latitude[2:])/60)
			if data[3]=='S': #convert to negative if on the negative side of the earth
				latitude=latitude*-1
			longitude=int(longitude[:2])+(float(longitude[2:])/60)
			if data[5]=='W': #convert to negative if on the negative side of the world
				longitude=longitude*-1
			print 'Processed latitude:',latitude
			print 'Processed longitude:',longitude
			return [latitude,longitude]
Beispiel #27
0
def goToPoint():

	currentHeading=bank.bank('currentHeading')
	headingtoPoint=headingToPoint()
	print 'currentHeading' +str(currentHeading)
	print 'headingtoPoint' +str(headingtoPoint)
	
	desiredHeading=float(currentHeading+headingtoPoint)/2
	print 'the desire heading is:'+str(desiredHeading)
	return desiredHeading
Beispiel #28
0
def mtnHeading():
    # Keeps the robot on a desired heading
    import bank

    currentHeading = bank.bank("currentHeading")
    desiredHeading = bank.bank("desiredHeading")
    print "Current heading: " + str(currentHeading)
    print "Desired heading:" + str(desiredHeading)
    delta = abs((currentHeading - desiredHeading) / 2)
    print "Delta: " + str(delta)
    if currentHeading > desiredHeading:
        desiredStearing = currentHeading - delta
        print "desired greater than current"
    if currentHeading < desiredHeading:
        desiredStearing = currentHeading + delta
        print "current greater than desired"

    print "the desired stearing angle is: " + str(desiredStearing)
    return desiredStearing
Beispiel #29
0
def goToPoint():

    currentHeading = bank.bank('currentHeading')
    headingtoPoint = headingToPoint()
    print 'currentHeading' + str(currentHeading)
    print 'headingtoPoint' + str(headingtoPoint)

    desiredHeading = float(currentHeading + headingtoPoint) / 2
    print 'the desire heading is:' + str(desiredHeading)
    return desiredHeading
Beispiel #30
0
def above_below_on_line():
	# gives whether the bot is above, below, or on the line it should be following.
	#tested to work at 13:14 on 6/11/14
	# Based on: http://math.stackexchange.com/questions/324589/detecting-whether-a-point-is-above-or-below-a-slope
	import bank
	posCurrent=bank.bank('posCurrent')
	posDesired=bank.bank('posDesired')
	linstart=bank.bank('linstart')
	m=slope(posDesired, linstart)
	b=posDesired[1]-(m*posDesired[0])
	check=m*posCurrent[0]+b
	if check<posCurrent[1]:
		print 'Bot is above the line'
		return 'above'
	if check>posCurrent[1]:
		print 'Bot is below the line'
		return 'below'
	if check == posCurrent[1]:
		print 'Bot is on the line!'
		return 'on'
Beispiel #31
0
	def goToPoint(self):
		# '''outputs the necessary, global heading in order to go toward a point'''

		currentHeading=bank.bank('currentHeading')
		headingtoPoint=headingToPoint()
		print 'currentHeading' +str(currentHeading)
		print 'headingtoPoint' +str(headingtoPoint)
	
		desiredHeading=float(currentHeading+headingtoPoint)/2
		print 'the desire heading is:'+str(desiredHeading)
		return desiredHeading
Beispiel #32
0
	def obsAvoid(self):
		# '''works with IR sensor to avoid obstacles. Essentially integral control.'''
	
		dist_to_object=bank.bank('dist_to_object') #distance to object from PIR/Sharp sensor
		if  dist_to_object >50:
			print "Servo moving necessary so I don't hit a rock!"
			stearingDesired = 30*dist_to_object/256; 
			#sailDesired = bank.bank('sailDesired') + 1
			sailDesired=bank.sailDesiredF()
			print 'desired stearing is: ' + str(stearingDesired) + ' degrees'
			print 'desired sail is: ' + str(sailDesired) + ' degrees'
			return (stearingDesired, sailDesired)
Beispiel #33
0
def obsAvoid():
    #works with PIR sensor to avoid obstacles. Essentially integral control.
    import bank

    dist_to_object = bank.bank(
        'dist_to_object')  #distance to object from PIR/Sharp sensor
    if dist_to_object > 50:
        print "Servo moving necessary so I don't hit a rock!"
        stearingDesired = 30 * dist_to_object / 256
        #sailDesired = bank.bank('sailDesired') + 1
        sailDesired = bank.sailDesiredF()
        print 'desired stearing is: ' + str(stearingDesired) + ' degrees'
        print 'desired sail is: ' + str(sailDesired) + ' degrees'
        return (stearingDesired, sailDesired)
    def runTest(self):
        globals.init_openram("config_20_{0}".format(OPTS.tech_name))
        global verify
        import verify

        from bank import bank
        from sram_config import sram_config
        OPTS.bitcell = "pbitcell"

        # testing layout of bank using pbitcell with 1 RW port (a 6T-cell equivalent)
        OPTS.num_rw_ports = 1
        OPTS.num_w_ports = 0
        OPTS.num_r_ports = 0
        c = sram_config(word_size=4, num_words=16)
        c.words_per_row = 1
        debug.info(1, "No column mux")
        a = bank(c, name="bank1_1rw_0w_0r_single")
        self.local_check(a)

        c.num_words = 32
        c.words_per_row = 2
        debug.info(1, "Two way column mux")
        a = bank(c, name="bank1_1rw_0w_0r_single")
        self.local_check(a)

        c.num_words = 64
        c.words_per_row = 4
        debug.info(1, "Four way column mux")
        a = bank(c, name="bank1_1rw_0w_0r_single")
        self.local_check(a)

        c.num_words = 128
        c.words_per_row = 8
        debug.info(1, "Four way column mux")
        a = bank(c, name="bank1_1rw_0w_0r_single")
        self.local_check(a)
        """
Beispiel #35
0
def setSails():
	currentWindHeading=bank.bank('currentWindHeading')
	currentHeading=bank.bank('currentHeading')
	print 'current wind heading is: ', currentWindHeading
	print 'Current bot heading is: ', currentHeading
	
	windAngle=math.fabs(currentWindHeading-currentHeading)
	if windAngle>180:
		windAngle=math.fabs(windAngle-360)
	print 'calculated wind angle is:', windAngle
	
	if windAngle<0:
		print 'Error: negative wind angle!'
		sailDesired=40
	if windAngle<45:
		print 'Bot is in irons!'
		#outOfIrons()
	if (windAngle<180) & (windAngle>45):
		sailDesired=(.75*windAngle)-30
	if windAngle>180:
		sailDesired=90
		print 'Error: wind angle over 180 degrees'
	print 'Desired sail angle is: ', sailDesired
	return sailDesired
Beispiel #36
0
    def add_modules(self):
        """ Create all the modules that will be used """
        c = reload(__import__(OPTS.bitcell))
        self.mod_bitcell = getattr(c, OPTS.bitcell)
        self.bitcell = self.mod_bitcell()
        
        c = reload(__import__(OPTS.control_logic))
        self.mod_control_logic = getattr(c, OPTS.control_logic)

        
        from control_logic import control_logic
        # Create the control logic module
        self.control_logic = self.mod_control_logic(num_rows=self.num_rows)
        self.add_mod(self.control_logic)

        # Create the address and control flops (but not the clk)
        from dff_array import dff_array
        self.row_addr_dff = dff_array(name="row_addr_dff", rows=self.row_addr_size*self.total_ports, columns=1)
        self.add_mod(self.row_addr_dff)

        if self.col_addr_size > 0:
            self.col_addr_dff = dff_array(name="col_addr_dff", rows=1, columns=self.col_addr_size*self.total_ports)
            self.add_mod(self.col_addr_dff)
        else:
            self.col_addr_dff = None

        self.data_dff = dff_array(name="data_dff", rows=1, columns=self.word_size*self.total_write)
        self.add_mod(self.data_dff)
        
        # Create the bank module (up to four are instantiated)
        from bank import bank
        self.bank = bank(self.sram_config,
                         name="bank")
        self.add_mod(self.bank)

        # Create bank decoder
        if(self.num_banks > 1):
            self.add_multi_bank_modules()

        self.bank_count = 0

        self.supply_rail_width = self.bank.supply_rail_width
        self.supply_rail_pitch = self.bank.supply_rail_pitch
Beispiel #37
0
    def runTest(self):
        globals.init_openram("config_20_{0}".format(OPTS.tech_name))
        # we will manually run lvs/drc
        OPTS.check_lvsdrc = False

        import bank

        # override these from the config file
        OPTS.word_size = 8
        OPTS.num_words = 128
        OPTS.num_banks = 1

        debug.info(1, "Testing sample 8bit, 64word BANK")
        a = bank.bank(word_size=OPTS.num_words,
                      num_words=OPTS.num_words,
                      words_per_row=2,
                      num_banks=OPTS.num_banks,
                      name="test_sram1")
        OPTS.check_lvsdrc = True
        self.local_check(a)
Beispiel #38
0
def tester():
    test_bank = bank()

    #adds a user
    #alex
    print(
        parser(
            "+17208378697",
            "create 2666f08a-bfbb-42fb-80f8-e1ef974d5343 1Edw3z8dkgjqch5UFvkgBuUeaP2mAU2LvT 1234567890",
            test_bank))
    #sam create 2666f08a-bfbb-42fb-80f8-e1ef974d5343 1Edw3z8dkgjqch5UFvkgBuUeaP2mAU2LvT 1234567890
    print(
        parser(
            "+17209991335",
            "create 4620ffe2-86d6-4b63-ac16-4b8decfaa6f5 1KoQFBAEASCykCmnvK4kz7FRV4a1bqQu1Q Boondock2013",
            test_bank))
    #C1rissalazar
    print(
        parser(
            "+15122842178",
            "create c972c797-2595-4fb6-91e4-0547ef268c80 1G4kUxVk8wEfKCwNehmP9Fot4pAnAJMAaY C1rissalazar",
            test_bank))

    #gives their acount_info alex
    print(parser("+17208378697", "account_info", test_bank))
    #gives the
    print(parser("+17208378697", "balance", test_bank))

    #gives their acount_info sam
    print(parser("+17209991335", "acount_info", test_bank))
    #gives the balance
    print(parser("+17209991335", "balance", test_bank))

    #gives their acount_info cris
    print(parser("+15122842178", "acount_info", test_bank))
    #gives the balance
    print(parser("+15122842178", "balance", test_bank))
Beispiel #39
0

@app.route('/', methods=['GET', 'POST'])
def home():
    balance = get_balance(bank)
    tradebalance = get_balance(trade)
    if request.method == "POST":
        if request.values["send"] == "send":
            amount = float(request.values["transfer_amount"])
            bank.transfer_out(amount)
    return render_template("index.html",
                           bankbalance=balance,
                           tradebalance=tradebalance)


def setcookie():
    resp = make_response("setting up")
    resp.set_cookie("UID", uid)
    return resp


if __name__ == '__main__':
    crypto_wallet = {"ETH": 0, "BTC": 0}  #虛擬貨幣錢包
    bank = bank.bank(10000)
    trade = trade.trade_account(0)
    print(get_balance(bank))
    app.run(host="0.0.0.0", port=8080)
    uid = uuid.uuid4
    resp = make_response("setting up")
    resp.set_cookie("UID", uid)
Beispiel #40
0
 def setUp(self):
     for i in range(bank.bank_max):
         bank(i)
Beispiel #41
0
    def __init__(self, id, view, N, max_requests=None):
        self.view_backlog = {}
        self.max_requests = max_requests
        self.kill_flag = False
        # self.ecdsa_key = ecdsa_sig.get_verifying_key(0)
        #f = open("hello_0.dat", 'r')
        #self.hello_sig = f.read()
        #f.close()
        self.connections = 0
        signal.signal(signal.SIGINT, self.debug_print_bank)
        self.id = id  # id
        self.view = view  # current view number
        self.view_active = True  # If we have majority agreement on view number
        self.N = N  # total number of replicas
        self.f = int((N - 1) / 3)  # number of failues tolerated
        self.low_bound = 0  # lower bound for acceptable sequence numbers
        self.high_bound = 0  # upper bound for acceptable sequence numbers
        self.primary = view % N
        self.seq = 0  # next available sequence number if this node is primary
        self.last_executed = 0
        self.last_stable_checkpoint = 0
        self.checkpoint_proof = []
        self.checkpoint_interval = 100
        self.vmin = 0  # used for view changes
        self.vmax = 0
        self.client_backlog = []
        self.waiting = {}
        self.timeout = 1  # time interval in seconds before we trigger a view change
        self.vc_timer = Timer(self.timeout, self.handle_timeout, [0, 0])
        self.lock = Lock()
        self.clientbuff = ""
        self.clientlock = Lock()

        self.fdmap = {}  # file descriptor to socket mapping
        self.buffmap = {}  # file descriptor to incomming (recv) buffer mapping
        self.outbuffmap = {}
        self.p = select.epoll()  # epoll object
        self.node_message_log = {
            "PRPR": {},
            "PREP": {},
            "COMM": {},
            "INIT": {},
            "REQU": {},
            "VCHA": {},
            "NEVW": {},
            "CHKP": {},
            "FLAG": {},
        }  # message log for node communication related to the PBFT protocol: [type][seq][id] -> request
        self.client_message_log = {
        }  # message log for client communication (requests) [client id][timestamp] -> request
        self.prep_dict = {
        }  # dictionary for prepare messages (digest -> (number prepares received, 'prepared'[T/F])
        self.comm_dict = {}
        self.prepared = {
        }  # dictionary for all requests that have prepared (seq -> request)
        self.active = {}  # dictionary for all currently active requests
        self.view_dict = {}  # [view num] -> [list of ids]
        self.key_dict = {}
        self.replica_map = {}
        self.replica_direct_map = {}
        self.bank = bank.bank(id, 1000)

        self.request_types = {
            "REQU": self.process_client_request,
            "PRPR": self.process_preprepare,
            "PREP": self.process_prepare,
            "COMM": self.process_commit,
            "INIT": self.process_init,
            "VCHA": self.process_view_change,
            "NEVW": self.process_new_view,
            "CHKP": self.process_checkpoint,
            "FLAG": print,
        }

        self.commitlog = open("replica" + str(self.id) + "_commits.txt", 'wb',
                              1)  # log for executed commands
        self.debuglog = open("replica" + str(self.id) + "_log.txt", 'wb',
                             1)  # log for debug messages
Beispiel #42
0
	def readPosition(self):
		'''Reads the current GPS position from the GPS chip.'''
		for i in range(8):
		
			data=self.GPS.readline() #uncomment when on BB
		
			#test data set: 
			#data='$GPGGA,001038.00,3334.2313457,S,11211.0576940,W,2,04,5.4,354.682,M,-26.574,M,7.0,0138*74' #comment out when on BB
		
			if data.startswith('$GPGGA')==True:
				print 'Raw GPGGA string: ', data
				ckStng=data[1:data[14].find('*')-2]

				ckSum=0
				for i in ckStng:
					ckSum = ckSum ^ ord(i)
				print 'Check sum caluclated: hex:', hex(ckSum), 'dec:', ckSum
				data=data.split(',')
				ckSumSat=data[14].split('*')
	
			
				#if str(hex(ckSum)) != '0x'+str(ckSumSat[1]): #use  check sum from GPS vs calculated to verify string isn't corrupted:
					#print 'Check Sum Error from the GPS! :('
					#positionUse=bank.bank('posPast')
					#return positionUse
				
				if False: #TODO: uncomment above checksum stuff, delete this placeholder
					pass 
				
				else: #if the GPS string isn't corrupted, use it:
					print 'Good GPS data! :)'					
					if data[6]==0: #if there isn't a GPS lock, assume the robot hasn't moved
						print 'No GPS Lock! :('
						positionUse=bank.bank('posPast')
						return positionUse
					
					if data[6]==1:
						print 'GPS fix!'
					if data[6]==2:
						print 'DGPS fix!'
				
					latitude=data[2]
					longitude=data[4]
					
					print 'longitude data (raw) is: ',longitude
					print 'splitting longitude', longitude[1:3]
					print 'second part: ', float(longitude[2:])/60
					longitude2=int(float(longitude[1:3]))+(float(longitude[2:])/60 )
					print 'longitude 2 is: ', longitude2
					latitude=int(latitude[:2])+(float(latitude[2:])/60)
					if data[3]=='S': #convert to negative if on the negative side of the earth
						latitude=latitude*-1

					longitude=int(longitude[:2])+(float(longitude[2:])/60) #casts to a float in the process
				
					#print '[:2]', str(longitude)[1;3]
					if data[5]=='W': #convert to negative if on the negative side of the world
						longitude=longitude*-1
					print 'Processed latitude:',latitude
					print 'Processed longitude:',longitude
					#return [latitude,longitude]	#TODO: uncomment when are actually using GPS data
					return [0,1]
Beispiel #43
0
 def test_bank(self):
     """
     Тестовый случай с обычным банковским вкладом.
     """
     self.assertEqual(bank(10000, 7), 19487)
Beispiel #44
0
class BranchHandler(SocketServer.BaseRequestHandler):
    HOST = None
    PORT = None
    BRANCH_NAME = None
    BANK_ob = bank()
    Socket_Pool_ob = socket_pool()
    Chandy_Lamport_ob = chandy_lamport()

    ###########################
    # I am the one handling messages from different branches and controller
    def handle(self):
        self.BRANCH_NAME = self.server.branchname
        self.HOST = self.server.hostname
        self.PORT = self.server.portno

        self.BANK_ob.initialize(self.Socket_Pool_ob, self.Chandy_Lamport_ob,
                                self.BRANCH_NAME)

        self.Socket_Pool_ob.initialize(self.BRANCH_NAME)

        self.Chandy_Lamport_ob.initialize(self.Socket_Pool_ob, self.BANK_ob)

        header = self.request.recv(4)
        message_length, = unpack('>I', header)  #unpack always returns a tuple.

        message = self.request.recv(message_length)
        pb_message = bank_pb2.BranchMessage()
        pb_message.ParseFromString(message)
        print pb_message

        if pb_message.HasField("init_branch"):
            # INIT BRANCH MESSAGE
            balance = pb_message.init_branch.balance
            list = pb_message.init_branch.all_branches
            self.BANK_ob.initBranch(balance, list)
        elif pb_message.HasField("transfer"):
            # TRANSFER MONEY MESSAGE
            ReceivingBranch = self.request.recv(24)
            gotmoney = pb_message.transfer.money
            self.BANK_ob.ReceiveMoney(gotmoney, ReceivingBranch)
        elif pb_message.HasField("init_snapshot"):
            # INIT SNAPSHOT MESSAGE
            snapshotnum = pb_message.init_snapshot.snapshot_id
            self.Chandy_Lamport_ob.initSnapshot(snapshotnum)
        elif pb_message.HasField("retrieve_snapshot"):
            # RETRIVE SNAPSHOT MESSAGE
            snapshotnum = pb_message.retrieve_snapshot.snapshot_id
            snapshotmsg = self.Chandy_Lamport_ob.return_snapshot(snapshotnum)
            message = snapshotmsg

            try:
                x = pack('>I', len(message))
                self.request.send(x)
                self.request.send(message)
            except:
                print "EXCEPTION ! Socket exception in handle. retrieve_snapshot message"
                sys.exit(0)

        elif pb_message.HasField("marker"):
            # MARKER MESSAGE
            snapshotnum = pb_message.marker.snapshot_id
            ReceivingBranch = self.request.recv(24)
            self.Chandy_Lamport_ob.ReceiveMarker(snapshotnum, ReceivingBranch)
Beispiel #45
0
from bank import bank
z=bank('bob',500)
x=bank('tom',1000)
##a=bank('mark',2000)
##z.display()
##x.display()
##a.display()
z.deposit_money()
z.withdraw_money()
z.transfermoney()
Beispiel #46
0
#this is the twiml stuff
import twilio.twiml
from twilio.rest import TwilioRestClient 

#our own classes 
from bank import bank
from parser import parser

ACCOUNT_SID = "AC2a9e06ea97e4a1a785361f0e8064e870" 
AUTH_TOKEN = "bc96d318cbda7ef495f1418baed042f4" 
 
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
app = Flask(__name__)

test_bank = bank()


#this function takes in two strings and cats them together with a space. 
def space(return_string, input):
    return (return_string + " " + input)

def bank_init():
    test_bank = bank()
    return test_bank

#this actually crafts the message for the person. Currently it grabs all messages and only selects the first inbound one, we should find a way to reduce this
def returner(bank,debug):
    messages = client.messages.list() 
    for m in messages:
        if (m.direction == 'inbound' and debug == False):
Beispiel #47
0
def bank_init():
    test_bank = bank()
    return test_bank
Beispiel #48
0
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import portal
import bank
import manage





if __name__ == '__main__':
    while True:
        print '''\033[34;1m请输入您需要的功能:
1、商城系统
2、银行系统
3、管理系统\033[0m
'''
        num = raw_input("\033[32;1m请输入您功能项:")
        if num == '1':
            portal.buy()
        elif num == '2':
            bank.bank()
        elif num == '3':
            manage.manage_api()
        else:
            continue
Beispiel #49
0
    def readPosition(self):
        '''Reads the current GPS position from the GPS chip.'''
        for i in range(8):

            data = self.GPS.readline()  #uncomment when on BB

            #test data set:
            #data='$GPGGA,001038.00,3334.2313457,S,11211.0576940,W,2,04,5.4,354.682,M,-26.574,M,7.0,0138*74' #comment out when on BB

            if data.startswith('$GPGGA') == True:
                print 'Raw GPGGA string: ', data
                ckStng = data[1:data[14].find('*') - 2]

                ckSum = 0
                for i in ckStng:
                    ckSum = ckSum ^ ord(i)
                print 'Check sum caluclated: hex:', hex(ckSum), 'dec:', ckSum
                data = data.split(',')
                ckSumSat = data[14].split('*')

                #if str(hex(ckSum)) != '0x'+str(ckSumSat[1]): #use  check sum from GPS vs calculated to verify string isn't corrupted:
                #print 'Check Sum Error from the GPS! :('
                #positionUse=bank.bank('posPast')
                #return positionUse

                if False:  #TODO: uncomment above checksum stuff, delete this placeholder
                    pass

                else:  #if the GPS string isn't corrupted, use it:
                    print 'Good GPS data! :)'
                    if data[6] == 0:  #if there isn't a GPS lock, assume the robot hasn't moved
                        print 'No GPS Lock! :('
                        positionUse = bank.bank('posPast')
                        return positionUse

                    if data[6] == 1:
                        print 'GPS fix!'
                    if data[6] == 2:
                        print 'DGPS fix!'

                    latitude = data[2]
                    longitude = data[4]

                    print 'longitude data (raw) is: ', longitude
                    print 'splitting longitude', longitude[1:3]
                    print 'second part: ', float(longitude[2:]) / 60
                    longitude2 = int(float(
                        longitude[1:3])) + (float(longitude[2:]) / 60)
                    print 'longitude 2 is: ', longitude2
                    latitude = int(latitude[:2]) + (float(latitude[2:]) / 60)
                    if data[3] == 'S':  #convert to negative if on the negative side of the earth
                        latitude = latitude * -1

                    longitude = int(
                        longitude[:2]) + (float(longitude[2:]) / 60
                                          )  #casts to a float in the process

                    #print '[:2]', str(longitude)[1;3]
                    if data[5] == 'W':  #convert to negative if on the negative side of the world
                        longitude = longitude * -1
                    print 'Processed latitude:', latitude
                    print 'Processed longitude:', longitude
                    #return [latitude,longitude]	#TODO: uncomment when are actually using GPS data
                    return [0, 1]
Beispiel #50
0
#Тренировки
import arithmetic
import is_year_leap
import square
import season
import bank
import is_prime
import date
import XOR_cipher

print(is_year_leap.is_year_leap(2004))
print(square.square(5))
print(arithmetic.arithmetic(4, 3, '+'))
print(season.season(13))
print(bank.bank(1000, 3))
print(is_prime.is_prime(47))
print(date.date(29, 2, 2000))
print(XOR_cipher.XOR_cipher('help', '3'))
    def runTest(self):
        globals.init_openram("config_{0}".format(OPTS.tech_name))
        from bank import bank
        from sram_config import sram_config
        OPTS.bitcell = "pbitcell"

        # testing layout of bank using pbitcell with 1 RW port (a 6T-cell equivalent)
        OPTS.num_rw_ports = 1
        OPTS.num_w_ports = 0
        OPTS.num_r_ports = 0
        c = sram_config(word_size=4, num_words=16)

        c.words_per_row = 1
        factory.reset()
        c.recompute_sizes()
        debug.info(1, "No column mux")
        name = "bank1_{0}rw_{1}w_{2}r_single".format(OPTS.num_rw_ports,
                                                     OPTS.num_w_ports,
                                                     OPTS.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)

        c.num_words = 32
        c.words_per_row = 2
        factory.reset()
        c.recompute_sizes()
        debug.info(1, "Two way column mux")
        name = "bank2_{0}rw_{1}w_{2}r_single".format(OPTS.num_rw_ports,
                                                     OPTS.num_w_ports,
                                                     OPTS.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)

        c.num_words = 64
        c.words_per_row = 4
        factory.reset()
        c.recompute_sizes()
        debug.info(1, "Four way column mux")
        name = "bank3_{0}rw_{1}w_{2}r_single".format(OPTS.num_rw_ports,
                                                     OPTS.num_w_ports,
                                                     OPTS.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)

        c.word_size = 2
        c.num_words = 128
        c.words_per_row = 8
        factory.reset()
        c.recompute_sizes()
        debug.info(1, "Four way column mux")
        name = "bank4_{0}rw_{1}w_{2}r_single".format(OPTS.num_rw_ports,
                                                     OPTS.num_w_ports,
                                                     OPTS.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)

        # testing bank using pbitcell in various port combinations
        # layout for multiple ports does not work yet
        """
        OPTS.netlist_only = True

        c.num_words=16
        c.words_per_row=1
        
        OPTS.num_rw_ports = c.num_rw_ports = 2
        OPTS.num_w_ports = c.num_w_ports = 2
        OPTS.num_r_ports = c.num_r_ports = 2

        debug.info(1, "No column mux")
        name = "bank1_{0}rw_{1}w_{2}r_single".format(c.num_rw_ports, c.num_w_ports, c.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)

        OPTS.num_rw_ports = c.num_rw_ports = 0
        OPTS.num_w_ports = c.num_w_ports = 2
        OPTS.num_r_ports = c.num_r_ports = 2

        debug.info(1, "No column mux")
        name = "bank1_{0}rw_{1}w_{2}r_single".format(c.num_rw_ports, c.num_w_ports, c.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)
        
        OPTS.num_rw_ports = c.num_rw_ports = 2
        OPTS.num_w_ports = c.num_w_ports = 0
        OPTS.num_r_ports = c.num_r_ports = 2

        debug.info(1, "No column mux")
        name = "bank1_{0}rw_{1}w_{2}r_single".format(c.num_rw_ports, c.num_w_ports, c.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)
        
        OPTS.num_rw_ports = c.num_rw_ports = 2
        OPTS.num_w_ports = c.num_w_ports = 2
        OPTS.num_r_ports = c.num_r_ports = 0

        debug.info(1, "No column mux")
        name = "bank1_{0}rw_{1}w_{2}r_single".format(c.num_rw_ports, c.num_w_ports, c.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)
        
        OPTS.num_rw_ports = c.num_rw_ports = 2
        OPTS.num_w_ports = c.num_w_ports = 0
        OPTS.num_r_ports = c.num_r_ports = 0

        debug.info(1, "No column mux")
        name = "bank1_{0}rw_{1}w_{2}r_single".format(c.num_rw_ports, c.num_w_ports, c.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)
        
        # testing with various column muxes
        OPTS.num_rw_ports = c.num_rw_ports = 2
        OPTS.num_w_ports = c.num_w_ports = 2
        OPTS.num_r_ports = c.num_r_ports = 2
        
        c.num_words=32
        c.words_per_row=2
        debug.info(1, "Two way column mux")
        name = "bank2_{0}rw_{1}w_{2}r_single".format(c.num_rw_ports, c.num_w_ports, c.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)

        c.num_words=64
        c.words_per_row=4
        debug.info(1, "Four way column mux")
        name = "bank3_{0}rw_{1}w_{2}r_single".format(c.num_rw_ports, c.num_w_ports, c.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)

        # Eight way has a short circuit of one column mux select to gnd rail
        c.word_size=2
        c.num_words=128
        c.words_per_row=8
        debug.info(1, "Eight way column mux")
        name = "bank4_{0}rw_{1}w_{2}r_single".format(c.num_rw_ports, c.num_w_ports, c.num_r_ports)
        a = bank(c, name=name)
        self.local_check(a)
        """

        globals.end_openram()
Beispiel #52
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 31 12:49:16 2020

@author: ANANTHA KRISHNAN O M
"""

import random as rn
from bank import bank


print(" \n \n \n Welcome to POPCORN ATM")


bal=int(rn.randrange(5000,100000))

c=bank(bal)
c.atm()
Beispiel #53
0
#this is the twiml stuff
import twilio.twiml
from twilio.rest import TwilioRestClient

#our own classes
from bank import bank
from parser import parser

ACCOUNT_SID = "AC2a9e06ea97e4a1a785361f0e8064e870"
AUTH_TOKEN = "bc96d318cbda7ef495f1418baed042f4"

client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
app = Flask(__name__)

test_bank = bank()


#this function takes in two strings and cats them together with a space.
def space(return_string, input):
    return (return_string + " " + input)


def bank_init():
    test_bank = bank()
    return test_bank


#this actually crafts the message for the person. Currently it grabs all messages and only selects the first inbound one, we should find a way to reduce this
def returner(bank, debug):
    messages = client.messages.list()
Beispiel #54
0
def bank_init():
    test_bank = bank()
    return test_bank