def loop(self):
        if not ranges.inrange():
            relay.set(0)
            return

#Get Sensor presence
#print('Waiting PIR...')
        self.presence = pir.get()
        if self.presence:
            if not self.before:
                print('Switch on')
                relay.set(1)
                self.counter = 0
                register(relay.status())
        elif relay.get() == 1:
            self.counter += 1
            if self.counter > self.timeout:
                print('Timeout: switch off')
                relay.set(0)
                self.counter = 0
                register(relay.status())
            else:
                print(self.counter, end='..')

    # Save it for next loop
        self.before = self.presence
def loggin(user):
    print('')
    username = input('Username: '******'Password: '******'users/' + username, 'r')
        textLine = f.readline()
        if (textLine[9:].rstrip() == password):
            loadUser(user, username, password)
            f.close()
            return True
        else:
            print('Password is incorrect')
            f.close()
            return False

    else:
        print('User does not exist. Do you want to register? [y/n]')
        cmd = input()

        if ('Y' == cmd.upper()):
            register()

        else:
            return False
Exemple #3
0
 def menudrive(self):
     print("1. Admin \n 2. register")
     choice = int(input("enter the choice"))
     if choice == 1:
         admin().adetails()
     if choice == 2:
         register().reg()
Exemple #4
0
def main_register():
    username = input("\nEnter username: "******"Enter password: "******"\n")

    register.register(username, password)
    return 1.1
 def loop_time(self):
     if ranges.inrange():
         print('Timeout: switch on')
         relay.set(1)
     else:
         print('Timeout: switch off')
         relay.set(0)
     register(relay.status())
Exemple #6
0
def main():
    try:
        # Check if db file is included in main.py call
        if len(sys.argv) != 2:
            print("Not enough arguments!")
            exit(0)
        # Check if valid db file by comparing last 3 letters
        elif sys.argv[1][len(sys.argv[1]) - 3:] != ".db":
            print("Not a database (.db) file!")
            exit(0)

        path = sys.argv[1]
        conn = sqlite3.connect(path)
        os.system('clear')
        print("Connection successful!")

    except:
        print("Input error, exiting...")

    db = conn.cursor()

    # Menu action will run every time there input error
    while True:

        print("********************************")
        print()
        print("1. Register")
        print("2. Login")
        print("3. Exit")
        print()
        print("********************************")
        print()
        action = input("Choose from one of the above: ")

        try:
            action = int(action)
        except:
            os.system('clear')
            print("Input could not be casted to integer. Please enter digit")
            continue

        # If input integer:

        if action == 1:
            register(conn, db)

        elif action == 2:
            login(conn, db)

        elif action == 3:
            print("Exiting...")
            exit(0)

        else:
            os.system('clear')
            print("Input not available! Try again")
            continue
Exemple #7
0
def login():
    form = loginForm()
    if request.method == 'GET':
        return render_template('register.html', form=form)
    elif form.validate_on_submit():
        username = request.form.get('user')
        password = request.form.get('password')
        register.register(username, password, 2)
        return '注册成功'
Exemple #8
0
 def do_register(self, line):
     username = raw_input("Username: "******"Password: "******"Confirm: "))
     if password != confirm:
         print "Passwords didn't match"
         self.do_register(line)
     else:
         print register.register(username, password)
Exemple #9
0
 def do_register(self, line):
     username = raw_input("Username: "******"Password: "******"Confirm: "))
     if password != confirm:
         print "Passwords didn't match"
         self.do_register(line)
     else:
         print register.register(username, password)
Exemple #10
0
def run(args, work_dir):
	if args.repo_url is None and args.module_path is None:
		print 'No deploy target found'
		return 1
	
	repo_url = args.repo_url if args.repo_url is not None else config.get_config('deploy.default.repo')
	branch_name = args.branch if args.branch is not None else config.get_config('deploy.default.branch')
	module_path = args.module_path if args.module_path is not None else config.get_config('deploy.default.module_path')
	should_register = args.register

	build_source = ''.join([repo_url, '#', branch_name])
	build_source = ''.join([build_source, (':' + module_path if module_path is not '' else '')])

	deployment_url = util.get_github_raw_content_url(config.get_config('deploy.default.deployment_yaml_path'), repo_url, branch_name, module_path)
	service_url = util.get_github_raw_content_url(config.get_config('deploy.default.service_yaml_path'), repo_url, branch_name, module_path)
	ingress_url = util.get_github_raw_content_url(config.get_config('deploy.default.ingress_yaml_path'), repo_url, branch_name, module_path)

	deployment_file_path = ''.join([work_dir, '/deployment.yaml'])
	service_file_path = ''.join([work_dir, '/service.yaml'])
	ingress_file_path = ''.join([work_dir, '/ingress.yaml'])
	
	if should_register:
		registry_url = util.get_github_raw_content_url(config.get_config('register.default.registry_yaml_path'), repo_url, branch_name, module_path)
		registry_file_path = ''.join([work_dir, '/registry.yaml'])
	
	try:
		print 'Downloading deployment files'

		MSG_DEPLOYMENT_FILE_NOT_FOUND = 'Deployment file: %s not found'
		download_files = ((deployment_url, deployment_file_path, True, MSG_DEPLOYMENT_FILE_NOT_FOUND % config.get_config('deploy.default.deployment_yaml_path')),
			(service_url, service_file_path, True, MSG_DEPLOYMENT_FILE_NOT_FOUND % config.get_config('deploy.default.service_yaml_path')),
			(ingress_url, ingress_file_path, False))

		if should_register:
			download_files += download_files + ((registry_url, registry_file_path, False),)
		
		try:
			success = util.retrieve_files(*download_files)
		except RuntimeError:
			return 1

		print 'Deployment files downloaded'

		deployment_info = util.convert_yaml_to_object(deployment_file_path)
		tag = deployment_info['spec']['template']['spec']['containers'][0]['image']

		deploy(build_source, tag,
			deployment_file_path,
			service_file_path,
			ingress_file_path if success[ingress_file_path] else None)

		if should_register:
			register.register(registry_file_path)

	except subprocess.CalledProcessError as e:
		print 'ERROR: ' , e
Exemple #11
0
def indexo():
    print('********************MAIN PAGE*********************')
    print('1.Admin\n2.Registration\n3.Forgotten Password\n4.Receipt')
    formatoba()
    ch = int(input("Enter choice from above: "))
    formatoba()

    if ch == 1:
        x = logino()
        if x == 1:
            print("Access granted")
            input("Press enter to continue...")
            os.system('cls')
            custo()
            formatoba()
            os.system('cls')

        else:
            print("Wrong password")
            input("Press enter to retry....")
            os.system('cls')
            formatoba()
            indexo()

    if ch == 2:
        register()
        formatoba()
        input("Press enter to continue...")
        os.system('cls')
        indexo()

    if ch == 3:
        forgotpwd()
        formatoba()
        input("Press enter to continue... ")
        os.system('cls')
        indexo()

    if ch == 4:
        x = logino()
        if x == 1:
            print('********************RECEIPT PAGE*********************\n\n')
            os.system('cls')
            receipt()
            formatoba()
            os.system('cls')
        else:
            print("Wrong password")
            input("Press enter to retry....")
            os.system('cls')
            formatoba()
            indexo()
Exemple #12
0
def main():
    """main function"""

    # continue the program while true
    while True:
        print('\nSelect the following')
        print('---------------------')
        print('1.Course Detail.')
        print('2.Registration.')
        print('3.Display all student information.')
        print('4.Update the student information.')
        print('\nEnter the integer to select')

        # runs until user give integer value
        while True:
            val = input('Select: ')
            try:
                choice = int(val)
                if choice < 5:
                    break
                else:
                    #validate for less than 5
                    print('\nSorry.Enter the value from 1-4')
            except ValueError:
                # validate for integer type
                print('\nSorry.Enter the integer number from 1-4')

        # Selection of course details
        if choice == 1:
            print('\n Course Details: ')
            course_detail()
            if input("Press 'b' to go back (otherwise exit.) ").lower() == 'b':
                main()

        #registration
        elif choice == 2:
            register()

        elif choice == 3:
            student_info()

        elif choice == 4:
            print('Update student is on progress.')

        elif choice == 5:
            print('Delet student is on progress')

        do_continue = input('Do you want to continue? y/n: ').lower()
        if do_continue != 'y':
            break
        else:
            continue
Exemple #13
0
def run():
    try:
        register.register((100003, 3, IPPROTO_TCP, 2049))
        register.register((100005, 3, IPPROTO_TCP, 5555))

        th_mountd = threadutil.start_daemon_thread(mountd)
        th_nfsd = threadutil.start_daemon_thread(nfsd)

        th_mountd.join()
        th_nfsd.join()

    except KeyboardInterrupt:
        sys.exit(0)
def main_menu():
    while (True):
        selection = input(
            '\n1. Prijava na sistem\n2. Registracija\n3. Izlazak iz aplikacije\n\n@-->'
        )
        if (selection == '1'):
            login()
        elif (selection == '2'):
            register()
        elif (selection == '3'):
            print('\nIzlazak iz aplikacije...')
            exit()
        else:
            print("\nGreska!!! Unesi jednu od ponudjenih opcija")
            continue
def userfactory(i):
    try:
        redisname = 'msg#code#244ee18b-2e51-40c9-9bde-31875fb8b711' + str(i)
        msgcodeid = '244ee18b-2e51-40c9-9bde-31875fb8b711' + str(i)
        print msgcodeid
        redisvalue = '73917'
        qian = i / 1000
        bai = i / 100 % 10
        shi = i / 10 % 10
        ge = i % 10
        mobile = '1700000' + str(qian) + str(bai) + str(shi) + str(ge)
        print mobile

        #mobile='13588120225'
        setredispara(redisname, redisvalue)
        datatemp={"mobile":mobile,"msgcodeid":msgcodeid,\
                  "msgcode":redisvalue,"passwd":"123456","secretkey":"2a7d228d-4dbd-4167-a3dd-882968efd685"}
        resulttemp = register.register(datatemp)
        print resulttemp
        try:
            deleteredispara(redisname)
        except Exception, e:
            print "delete redis param error %s" % e
    except Exception, e:
        print "make user %s failed,because error is %s" % (mobile, e)
Exemple #16
0
def functionChoice(methodData):
    if methodData == "postFormError":
        return HttpResponse(util.errorJsonWrapper("post数据没有method字段"))
    else:
        try:
            data = json.loads(methodData)
        except ValueError:
            return HttpResponse(util.errorJsonWrapper("json数据格式错误,无法解析"))
        try:
            funcName = data["name"]
        except KeyError:
            return HttpResponse(util.errorJsonWrapper("json数据格式中没有name字段"))
        try:
            funcArgs = data["args"]
        except KeyError:
            return HttpResponse(util.errorJsonWrapper("json数据格式中没有args字段"))

        if funcName == "register":
            return HttpResponse(register.register(funcArgs))
        elif funcName == "login":
            return HttpResponse(login.login(funcArgs))
        elif funcName == "issueAdoptPetInfo":
            return HttpResponse(issueAdoptPetInfo.issueAdoptPetInfo(funcArgs))
        elif funcName == "getAdoptDetailList":
            return HttpResponse(
                getAdoptDetailList.getAdoptDetailList(funcArgs))
        elif funcName == "issueFosterPetInfo":
            return HttpResponse(
                issueFosterPetInfo.issueFosterPetInfo(funcArgs))
        elif funcName == "getInfoList":
            return HttpResponse(getInfoList.getInfoList(funcArgs))
        else:
            return HttpResponse(util.errorJsonWrapper(funcName + u":暂不支持该函数"))
Exemple #17
0
def userfactory(i):
    try:
        redisname='msg#code#244ee18b-2e51-40c9-9bde-31875fb8b711'+str(i)
        msgcodeid='244ee18b-2e51-40c9-9bde-31875fb8b711'+str(i)
        print msgcodeid
        redisvalue='73917'
        qian=i/1000
        bai=i/100%10
        shi=i/10%10
        ge=i%10
        mobile='1700000'+str(qian)+str(bai)+str(shi)+str(ge)
        print mobile
        
        #mobile='13588120225'
        setredispara(redisname, redisvalue)
        datatemp={"mobile":mobile,"msgcodeid":msgcodeid,\
                  "msgcode":redisvalue,"passwd":"123456","secretkey":"2a7d228d-4dbd-4167-a3dd-882968efd685"}
        resulttemp=register.register(datatemp)
        print resulttemp
        try:
            deleteredispara(redisname)
        except Exception,e:
            print "delete redis param error %s"%e
    except Exception,e:
        print "make user %s failed,because error is %s"%(mobile,e)
Exemple #18
0
def functionChoice(post, files):
    methodData = post.get("method", "postFormError")

    if methodData == "postFormError":
        return HttpResponse(util.errorJsonWrapper("post数据没有method字段"))
    else:
        try:
            data = json.loads(methodData)
        except ValueError:
            return HttpResponse(util.errorJsonWrapper("json数据格式错误,无法解析"))
        try:
            funcName = data["name"]
        except KeyError:
            return HttpResponse(util.errorJsonWrapper("json数据格式中没有name字段"))
        try:
            funcArgs = data["args"]
        except KeyError:
            return HttpResponse(util.errorJsonWrapper("json数据格式中没有args字段"))

        if funcName == "register":
            return HttpResponse(register.register(funcArgs))
        elif funcName == "completeUserInfo":
            return HttpResponse(completeUserInfo.completeUserInfo(funcArgs,files))
        elif funcName == "login":
            return HttpResponse(login.login(funcArgs))
        elif funcName == "issueAdoptPetInfo":
            return HttpResponse(issueAdoptPetInfo.issueAdoptPetInfo(funcArgs,files))
        elif funcName == "issueFosterPetInfo":
            return HttpResponse(issueFosterPetInfo.issueFosterPetInfo(funcArgs))
        elif funcName == "getInfoList":
            return HttpResponse(getInfoList.getInfoList(funcArgs))
        elif funcName == "getAdoptDetailList":
            return HttpResponse(getAdoptDetailList.getAdoptDetailList(funcArgs))
        else:
            return HttpResponse(util.errorJsonWrapper(funcName+u":暂不支持该函数"))
Exemple #19
0
 def test_username_lt6(self):
     """注册失败,用户名大于18位"""
     data = ("zhangtestzhangtestzhangtest", "zhang123456", "zhang123456"
             )  # 测试数据
     expected = {'code': 0, 'msg': '用户名和密码必须是6-18位!'}  # 预期结果
     result = register(*data)  # 把测试数据传到被测试的代码,接收实际结果
     self.assertEqual(expected, result)  # 断言,预期结果与实际结果是否一致,一致即用例通过
Exemple #20
0
 def __init__(self, raw_instructions):
     self.execution_instructions = instructions(raw_instructions)
     self.registers = []
     i = 97
     while i < 105:
         self.registers.append(register(chr(i)))
         i += 1
     self.mul_count = 0
Exemple #21
0
def mainApp():
    while True:
        try:
            choice = '\n 1) Login \n 2) Register \n 3) Exit \n\n Your Choice (Only with number)>>'
            menu = input(choice)
            if menu == '1':
                login.login()
            elif menu == '2':
                register.register()
            elif menu == '3':
                print('App closed,Thanks for using!')
                exit()
            else:
                print('\nError:wrong Input,Please check and try again\n')
        except KeyboardInterrupt:
            print('\nApp closed,Thanks for using!')
            exit()
Exemple #22
0
 def test_password_dis(self):
     """两次密码不一样"""
     # 预期结果:
     excepted = {"code": 0, "msg": "两次密码不一致"}
     # 参数:data
     data = ('python1', '1234567', '123456')
     # 调用被测试的功能函数,传入参数,获取实际结果:
     res = register(*data)
     self.assertEqual(excepted, res)
Exemple #23
0
 def test_register(self):
     """正常注册"""
     # 预期结果:
     excepted = {"code": 1, "msg": "注册成功"}
     # 参数:data
     data = ('python1', '123456', '123456')
     # 调用被测试的功能函数,传入参数,获取实际结果:
     res = register(*data)
     self.assertEqual(excepted, res)
Exemple #24
0
 def test_password_is_none(self):
     """密码为空"""
     # 预期结果:
     excepted = {'code': 0, 'msg': '所有参数不能为空'}
     # 参数:data
     data = ('python678', "", "")
     # 调用被测试的功能函数,传入参数,获取实际结果:
     res = register(*data)
     self.assertEqual(excepted, res)
Exemple #25
0
 def test_user_gt18(self):
     """账号长度大于18"""
     # 预期结果:
     excepted = {"code": 0, "msg": "账号和密码必须在6-18位之间"}
     # 参数:data
     data = ('python1234561234567', '1234567', '1234567')
     # 调用被测试的功能函数,传入参数,获取实际结果:
     res = register(*data)
     self.assertEqual(excepted, res)
Exemple #26
0
 def test_user_is_none(self):
     """账号为空"""
     # 预期结果:
     excepted = {'code': 0, 'msg': '所有参数不能为空'}
     # 参数:data
     data = ("", '1234567', '1234567')
     # 调用被测试的功能函数,传入参数,获取实际结果:
     res = register(*data)
     self.assertEqual(excepted, res)
Exemple #27
0
def register_certificate(domain, ip, der_cert):
    cert_pem = ssl.DER_cert_to_PEM_cert(der_cert)
    cert_x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
                                                cert_pem)
    pubkey = OpenSSL.crypto.dump_publickey(OpenSSL.crypto.FILETYPE_PEM,
                                           cert_x509.get_pubkey())
    # Parse text of public key
    pubkey = pubkey.decode('utf-8')
    pubkey = pubkey.replace('-----BEGIN PUBLIC KEY-----', '')
    pubkey = pubkey.replace('-----END PUBLIC KEY-----', '')
    pubkey = pubkey.replace('\n', '')
    # Decode from Base64 to Hex (note that the blockchain requires upper-case A-F)
    pubkey = base64.b64decode(pubkey).hex().upper()
    # Insert : every 2 characters
    pubkey = ':'.join(pubkey[i:i + 2] for i in range(0, len(pubkey), 2))

    # Save the domain to the blockchain
    register(domain, 'Proxy', ip, '{}', pubkey)
Exemple #28
0
 def test_register(self):
     # 预期结果:
     excepted = eval(self.case_data["excepted"])
     # 参数:data
     #这里加eval的意思是从excle中读取的数据以字符串的方式保存在列表中的
     data = eval(self.case_data['data'])
     # 调用被测试的功能函数,传入参数,获取实际结果:
     res = register(*data)
     self.assertEqual(excepted, res)
Exemple #29
0
 def test_password_lt6(self):
     """密码长度少于6位"""
     # 预期结果:
     excepted = {"code": 0, "msg": "账号和密码必须在6-18位之间"}
     # 参数:data
     data = ('python1', '12345', '12345')
     # 调用被测试的功能函数,传入参数,获取实际结果:
     res = register(*data)
     self.assertEqual(excepted, res)
Exemple #30
0
 def register_set_up(self):
     self.registers = []
     for idx, ins in enumerate(self.instructions):
         found = False
         for reg_idx, reg in enumerate(self.registers):
             if (reg.get_name() == ins.get_register()):
                 found = True
         if (not found):
             self.registers.append(register(ins.get_register()))
Exemple #31
0
    def test_user_register(self):
        """账号已经被注册"""
        # 预期结果:
        excepted = {"code": 0, "msg": "该账户已存在"}
        # 参数:data
        data = ('python18', '1234567', '123456')
        # 调用被测试的功能函数,传入参数,获取实际结果:
        res = register(*data)

        self.assertEqual(excepted, res)
Exemple #32
0
def main_screen():
    print("Welcome to Crowd Funding")
    user_input = input(
        "Please pick an option:\n1)Login  \n2)Register\n3)Exit\n")
    if user_input == "1" or user_input.lower() == "login":
        os.system("cls")
        login()
    elif user_input == "2" or user_input.lower() == "register":
        os.system("cls")
        register()
        main_screen()
    elif user_input == "3" or user_input.lower() == "exit":
        os.system("cls")
        print("Thank you for using crowd funding")
        exit()
    else:
        os.system("cls")
        print("Wrong choice")
        main_screen()
Exemple #33
0
def main():
    import os
    import sys

    args = sys.argv[1:]

    if not args:
        show_msg()
    if args[0] in ('-v', '--version'):
        show_msg(VERSION)
    elif args[0] in ('-h', '--help'):
        show_msg()
    elif args[0] in ('register'):
        if len(args[1:]) != 3:
            show_msg()

        import imghdr

        if not os.path.exists(args[1]) or imghdr.what(args[1]) != 'png':
            show_msg('Target image must be a valid image contained in a ' +
                     'PNG file. For example: /home/user/my_dir/image001.png.')
        if not os.path.exists(args[2]) or imghdr.what(args[2]) != 'png':
            show_msg('Source image must be a valid image contained in a ' +
                     'PNG file. For example: /home/user/my_dir/image001.png.')
        if not args[3].startswith('--dest=/'):
            show_msg('An existing destination directory must be specified. ' +
                     'For example: --dest=/home/user/my_dir')
        if not os.path.exists(args[3][7:]):
            show_msg('Destination directory does not exist.')

        fix_im_fname = args[1]
        mov_im_fname = args[2]
        dest_dir = args[3][7:]
    else:
        show_msg()

    from register import register

    try:
        register(fix_im_fname, mov_im_fname, dest_dir)
    except Exception as e:
        print(e)
Exemple #34
0
 def __init__(self, *auto_connect):
   """
   Optional four arguments (host, username, password, database) are passed
   to mysql.connect. Allows for auto-connect functionality for less LOC in a
   single-file application.
   """
   # Establish database connection
   self.register = register(self)
   Query.mysql = self
   Model.mysql = self
   # Only connect if passed 4 parameters
   # TODO: Add more connection options for greater flexibility.
   if len(auto_connect) is 4: self.connect(*auto_connect)
Exemple #35
0
    def __init__(self, cb=None):
        self.RANGE   = range(8)
        self.EGNAR   = range(7,-1,-1)
        self.RANGE3  = range(3)
        self.RANGE16 = range(16)
        self.EGNAR16 = range(15,-1,-1)

        self.PAUSE = True
        self.NOSTEP = False
        self.RUN = True

        self.ALU = alu()
        self.REGISTER = register()
        self.CONTROL = control()

        self.DATABUS = [0,0,0,0,0,0,0,0]
        self.ADDRESSBUS = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

        self.MEMORY = memory()
        
        self.CALLBACK = cb

        self.CONTROLREGISTER = [0,0,0] # Cy, Z, S
        
        self.Inst = [0,0,0,0,0,0,0,0]

        self.regLoadMap = { (0,0,0) : self.loadA, \
                            (0,0,1) : self.loadB, \
                            (0,1,0) : self.loadC, \
                            (0,1,1) : self.loadD, \
                            (1,0,0) : self.loadM1, \
                            (1,0,1) : self.loadM2, \
                            (1,1,0) : self.loadX, \
                            (1,1,1) : self.loadY }

        self.regSelectMap = { (0,0,0) : self.selectA, \
                              (0,0,1) : self.selectB, \
                              (0,1,0) : self.selectC, \
                              (0,1,1) : self.selectD, \
                              (1,0,0) : self.selectM1, \
                              (1,0,1) : self.selectM2, \
                              (1,1,0) : self.selectX, \
                              (1,1,1) : self.selectY }
        
        self.start = time()
        self.H = ""
        self.M = ""
        self.S = ""

        self.ENCODER = encodercore()
def account_register():
#test: curl -i -H "Content-Type: application/json" -X GET -d "{"""u_name""":"""test12""","""u_surname""":"""test3""","""u_mail""":"""test3""","""u_pass""":"""test3""","""u_phone""":"""test3""","""u_facebookid""":"""test3"""}" http://localhost:5000/api/v1.0/account/register/

    if( not 'u_name' in request.json or
       not 'u_surname' in request.json or
       not 'u_mail' in request.json or
       not 'u_pass' in request.json or
       not 'u_phone' in request.json or
       not 'u_facebookid' in request.json ):
        return HandleError( 1002 )    
    u_name = request.json['u_name']
    u_surname = request.json['u_surname']
    u_mail = request.json['u_mail']
    u_pass = request.json['u_pass']
    u_phone = request.json['u_phone']
    u_facebookid = request.json['u_facebookid']
    import register
    res = register.register(u_name,u_surname,u_mail,u_pass,str(u_phone),u_facebookid)
    if( res == True ):
        return jsonify( { 'register': "True" } ), 201
    else:
        return jsonify( { 'register': "False" } ), 201
Exemple #37
0
import memory
import alu
import translator
import reportor

# Check Input Argument
if len(sys.argv)!=2:
  print "[-] Usage: python " + sys.argv[0] + " [Assembly File]"

#Get all line from input file
input_file = sys.argv[1]
lines = [e.strip() for e in open(input_file)]

#Init class
mem = memory.memory(ins=lines)
reg = register.register()
tran = translator.translator()
re = reportor.reportor(numMemory=len(lines), startSign='@@@', mem=mem.getAll(), reg=reg.getAll(), pc=0)

#Init variable
exited = False
exception = False
cause = ""
pc = 0

re.report()

#Start Simulator
while not exited:
  #Fetch ins from mem and translate it
  ins = mem.get(pc)
Exemple #38
0
    def do_checkaddr(self, line):
        line = line.split()
        try:
            addr = line[0]
            print check_addr.check_addr(addr)
        except:
            pass
    def do_help(self, line):
        print """

        BlooCoin Client Commands

        send <amt> <addr> - Send coins to an address.
        coins - Shows the amount of coins that you have.
        addr - Shows your BLC address.
        transactions - Shows all transactions you have made.
        totalcoins - Shows all coins in curculation.
        checkaddr <addr> - Checks how many coins belong to a specific address.
        help - Displays this prompt.

        """

    def do_exit(self, line):
        exit()
if __name__ == "__main__":
    if not os.path.exists("bloostamp"):
        register.register()
    
    BlooClient().cmdloop()
         
Exemple #39
0
def do_match(*varargin):
    
    nargin = len(varargin)
    if nargin > 0:
        f1 = varargin[0]
    if nargin > 1:
        f2 = varargin[1]
    if nargin == 0:
        f1 = 'DB1_B\\105_4.tif'
        f2 = 'DB1_B\\105_6.tif'
    #load template fingerprint
    X = np.genfromtxt(f1+'.X',delimiter=',')
    m1 = np.genfromtxt(f1+'.m',delimiter=',')
    oX = np.genfromtxt(f1+'.o',delimiter=',')
    rX = np.genfromtxt(f1+'.r',delimiter=',')
    nX = np.genfromtxt(f1+'.n',delimiter=',')
    roX = np.genfromtxt(f1+'.ro',delimiter=',')
    orient_img_x = np.array([]) #load( [char(f1) '.oi']);
    or_x = np.array([]) #load( [char(f1) '.oi']);

    #load test fingerprint
    Y = np.genfromtxt(f2+'.X',delimiter=',')
    m2 = np.genfromtxt(f2+'.m',delimiter=',')
    oY = np.genfromtxt(f2+'.o',delimiter=',')
    rY = np.genfromtxt(f2+'.r',delimiter=',')
    nY = np.genfromtxt(f2+'.n',delimiter=',')
    roY = np.genfromtxt(f2+'.ro',delimiter=',')
    orient_img_y = np.array([])     #load( [char(f2) '.oi']);
    or_y = np.array([])    #load( [char(f2) '.oi']);

    
    #Make sure all minutiae type are ridge endings, bifurcations, or primary cores (pseudo minutia).
    i1 = np.flatnonzero(m1[:, 2] < 7) + 1
    i2 = np.flatnonzero(m2[:, 2] < 7) + 1
    X = X[(i1 -1), :]
    m1 = m1[(i1 -1), :]
    Y = Y[(i2 -1), :]
    m2 = m2[(i2 -1), :]
    m1r = m1[:, 3].copy()
    m2r = m2[:, 3].copy()
    m1[:, 3] = np.remainder(m1[:, 3], np.pi)
    m2[:, 3] = np.remainder(m2[:, 3], np.pi)


    #Attempt to retrieve index of both test and template fingerprint core indexes (provided they exist).
    test = m1[:, 2].copy()
    ic1 = np.flatnonzero(test == 5) + 1
    c1o = - 1
    c2o = - 1
    test = m2[:, 2].copy()
    ic2 = np.flatnonzero(test == 5) + 1


    #Build fingerprint feature structure.
    f1 = {'X': X, 'M': m1, 'O': oX, 'R': rX, 'N': nX, 'RO':roX, 'OIMG': orient_img_x, 'OREL': or_x}
    f2 = {'X': Y, 'M': m2, 'O': oY, 'R': rY, 'N': nY, 'RO':roY, 'OIMG': orient_img_y, 'OREL': or_y}

    #Bending energy
    E = 0

    #Detect if the core is near the edge of the fingerprint. Edge core comparisons have their similarity 
    #reduced since they are more prone to error due to lack of distributed coverage about the core point 
    #(i.e. much more possible alignment combinations are achieved when minutiae only lie on one side 
    # of a core point since we have less rotational contraints).
    edge_core = 0
    if ic1.size > 0 and ic2.size > 0:
        a = f1['X'][:,0].max()
        b = f1['X'][:,0].min()
        if f1['X'][ic1-1, 0] > a - 0.02 or f1['X'][ic1-1, 0] < b + 0.02:
            edge_core = 1
        a = f2['X'][:, 0].max()
        b = f2['X'][:, 0].min()
        if f2['X'][ic2-1, 0] > a - 0.02 or f2['X'][ic2-1, 0] < b + 0.02:
            edge_core = 1

    #Swap structures to make sure X represents the fingerprint with fewer minutiae
    if X.shape[0] > Y.shape[0]:
        temp = f1
        f1 = f2
        f2 = temp
        temp = ic1
        ic1 = ic2
        ic2 = temp
        temp = m1r
        m1r = m2r
        m2r = temp

    display_flag = 0
    GC = 0

    mean_dist_global = np.array([])    # use [] to estimate scale from the data
    
    nbins_theta = 19
    nbins_r = 5
    eps_dum = 1
    r = 0.35     # annealing rate
    beta_init = 0.8     # initial regularization parameter (normalized)
    
    r_inner = 1 / 8
    r_outer = 1 / 2

    #Register fingerprints
    [ft, res] = rs.register(f1, f2) # nargout=2
    angle = 0
    nsamp1 = f1['X'].shape[0]
    nsamp2 = f2['X'].shape[0]
    out_vec_1 = np.zeros(shape=(1, nsamp1), dtype='float16')
    out_vec_2 = np.zeros(shape=(1, nsamp2), dtype='float16')

    d1 = ds.dist2(f1['X'], f1['X'])
    d2 = ds.dist2(f2['X'], f2['X'])

    o_res = np.array([])
    sc_res = np.array([])
    mc_res = np.array([])
    ro_res = np.array([])

    #Map out binding box for overlap region.
    xt = np.min(ft['X'][:, 1]) 
    xb = np.max(ft['X'][:, 1])
    xl = np.min(ft['X'][:, 0])
    xr = np.max(ft['X'][:, 0])
    yt = np.min(f2['X'][:, 1])
    yb = np.max(f2['X'][:, 1])
    yl = np.min(f2['X'][:, 0])
    yr = np.max(f2['X'][:, 0])
    region_t = max(xt, yt)
    region_b = min(xb, yb)
    region_r = min(xr, yr)
    region_l = max(xl, yl)
    region_a = np.dot((region_b - region_t), (region_r - region_l))

    #Find all indices within bounding box
    ind1 = np.intersect1d(np.intersect1d(np.flatnonzero(ft['X'][:, 0] > region_l), np.flatnonzero(ft['X'][:, 0] < region_r)), np.intersect1d(np.flatnonzero(ft['X'][:, 1] > region_t), np.flatnonzero(ft['X'][:, 1] < region_b)))
    ind2 = np.intersect1d(np.intersect1d(np.flatnonzero(f2['X'][:, 0] > region_l), np.flatnonzero(f2['X'][:, 0] < region_r)), np.intersect1d(np.flatnonzero(f2['X'][:, 1] > region_t), np.flatnonzero(f2['X'][:, 1] < region_b)))

    #get minutiae count for each image in overlap region
    ng_samp1 = ind1.size
    ng_samp2 = ind2.size

    if res['map'].size > 0:
        if ic1.size > 0 and ic2.size > 0:
            GC = 1

        f1 = ft.copy()
        inda1 = res['map1'].copy()
        inda2 = res['map2'].copy()

        #find tighter minutiae count if possible for non core images 
        #which are more likely to have a much smaller overlap area 
        #then suggested by the bounding box. Convex hull structures
        #may be more accurate here.

        if GC != 1 and np.dot(ng_samp1, ng_samp2) > np.dot(inda1.size, inda2.size):
            # overlap region minutiae counts are set to nearest neighbour minutiae index counts
            ng_samp1 = inda1.size
            ng_samp2 = inda2.size

        # overlap region index sets have anchor minutiae indexes removed.
        inda1 = np.setdiff1d(inda1[np.flatnonzero(f1['M'][inda1-1, 2] < 5)], res['map'][:, 0])
        inda2 = np.setdiff1d(inda2[np.flatnonzero(f2['M'][inda2-1, 2] < 5)], res['map'][:, 1])

        y = 0
        redo = np.array([])
        #   for i=1:size(res['map'],1)
        #       a1=mod(m1r[res['map'][i -1,0])-res.angle,2*pi);
        #       a2=m2r[res['map'][i -1,2));
        #       if min(abs(a1-a2), 2*pi-abs(a1-a2)) > pi/8 && f1['M'][res['map'][i -1,0],2] == f2['M'][res['map'][i -1,1],2]
        #          y=y+1;
        #          redo(y)=i;
        #          inda1(numel(inda1)+1)=res['map'][i -1,1);
        #          inda2(numel(inda2)+1)=res['map'][i -1,1];
        #       end
        #   end

        res['map'] = res['map'][np.setdiff1d(range(1, (res['map'].shape[0] +1)), redo)-1, :]
        f1['M'][:, 3] = np.mod(m1r - res['angle'], np.dot(2, np.pi))

        orients = np.zeros((inda1.size, inda2.size))
        for i in range(1, (inda1.size +1)):
            for j in range(1, (inda2.size +1)):
                if f1['M'][inda1[(i -1)]-1, 2] < 5 and f2['M'][inda2[(j -1)]-1, 2] < 5:
                    orients[(i -1), (j -1)] = calc_orient(np.tile(f1['X'][inda1[(i -1)]-1, :],(1,1)), np.tile(f1['R'][inda1[(i -1)]-1, :],(1,1)), np.tile(f2['X'][inda2[(j -1)]-1, :],(1,1)), np.tile(f2['R'][inda2[(j -1)]-1, :],(1,1)))[0]
                else:
                    orients[(i -1), (j -1)] = 0
        
        if np.logical_and(inda1.size > 1, inda2.size > 1):
            if inda1.size > inda2.size:
                orients = orients.T
                t_res_map = res['map'][:,[1, 0]]
                [sc_cost3, E, cvec, angle] = tim.tps_iter_match_1(f2['M'], f1['M'], f2['X'], f1['X'], orients, nbins_theta, nbins_r, r_inner, r_outer, 3, r, beta_init, np.tile(inda2,(1,1)), np.tile(inda1,(1,1)), t_res_map) # nargout=4
                if cvec.size > 0:
                    cvec = np.tile(cvec,(1,1))
                    xx = np.vstack((inda1[(cvec[:, 1] -1)], inda2[(cvec[:, 0] -1)])).T
                    res['map'] = np.vstack((res['map'], xx))
            else:
                [sc_cost3, E, cvec, angle] = tim.tps_iter_match_1(f1['M'], f2['M'], f1['X'], f2['X'], orients, nbins_theta, nbins_r, r_inner, r_outer, 3, r, beta_init, np.tile(inda1,(1,1)), np.tile(inda2,(1,1)), res['map']) # nargout=4
                if cvec.size > 0:
                    cvec = np.tile(cvec,(1,1))
                    xx = np.vstack((inda1[(cvec[:, 0] -1)], inda2[(cvec[:, 1] -1)])).T
                    res['map'] = np.vstack((res['map'], xx))

        d1 = np.sqrt(ds.dist2(f1['X'], f1['X']))
        d2 = np.sqrt(ds.dist2(f2['X'], f2['X']))

        s1 = np.flatnonzero(f1['M'][:, 2] < 5).size
        s2 = np.flatnonzero(f2['M'][:, 2] < 5).size
    else:
        res['map'] = np.array([])
        res['o_res'] = np.array([])

    nX = np.array([])
    nY = np.array([])

    ns = 3
    #n_weight = np.array([])
    n_weight = []
    #same_type = np.array([])
    same_type = []

    if res['map'].size > 0:
        for i in range(1, (res['map'].shape[0] +1)):
            if res['map'][i -1, 0] == 0:
                continue
            x = m1[(res['map'][i -1, 0] -1), 0]
            y = m1[(res['map'][i -1, 0] -1), 1]

            bonus = 1
            a1 = np.mod(m1r[(res['map'][i -1, 0] -1)] - res['angle'], np.dot(2, np.pi))
            a2 = m2r[(res['map'][i -1, 1] -1)]

            bonus = np.dot(bonus, math.exp(- np.minimum(abs(a1 - a2), np.dot(2, np.pi) - abs(a1 - a2))))

            if np.logical_and(GC == 1, f1['M'][res['map'][i -1, 0]-1, 2] != f2['M'][res['map'][i -1, 1]-1, 2]):
                bonus = bonus - 0.1
                same_type.append(0)
            else:
                same_type.append(1)

            dx = np.sort(d1[(res['map'][i -1, 0] -1), :]) # nargout=2
            ii = np.argsort(d1[(res['map'][i -1, 0] -1), :])
            dy = np.sort(d2[(res['map'][i -1, 1] -1), :]) # nargout=2
            jj = np.argsort(d2[(res['map'][i -1, 1] -1), :])
            dd1 = f1['N'][np.ix_(np.array(range(np.dot((res['map'][i -1, 0] - 1), (s1 - 1)) + 1, (np.dot((res['map'][i -1, 0] - 1), (s1 - 1)) + ns +1)))-1, np.array(range(3, 10))-1)]
            dd2 = f2['N'][np.ix_(np.array(range(np.dot((res['map'][i -1, 1] - 1), (s2 - 1)) + 1, (np.dot((res['map'][i -1, 1] - 1), (s2 - 1)) + ns +1)))-1, np.array(range(3, 10))-1)]
            dd1[:, 2] = np.mod(dd1[:, 2] - res['angle'], np.dot(2, np.pi))
            dd2[:, 2] = np.mod(dd2[:, 2], np.dot(2, np.pi))
            dd1[:, 6] = np.mod(dd1[:, 2], np.pi)
            dd2[:, 6] = np.mod(dd2[:, 2], np.pi)

            used = []
            m_score = 0
            t = 1
            for x in range(1, (ns +1)):
                for y in range(1, (ns +1)):
                    if np.flatnonzero(np.array(used) == y).size:
                        continue
                    a_diff = np.minimum(abs(dd1[(x -1), 2] - dd2[(y -1), 2]), np.dot(2, np.pi) - abs(dd1[(x -1), 2] - dd2[(y -1), 2]))
                    dist_diff = abs(dd1[(x -1), 0] - dd2[(y -1), 0])
                    lo_diff = abs(dd1[(x -1), 5] - dd2[(y -1), 5])
                    o_diff = np.minimum(abs(dd1[(x -1), 6] - dd2[(y -1), 6]), np.pi - abs(dd1[(x -1), 6] - dd2[(y -1), 6]))
                    if np.logical_and(dist_diff < 0.05, a_diff < np.pi / 2):
                        m_score = m_score + np.dot(np.dot(math.exp(- o_diff), math.exp(- dist_diff)), math.exp(- a_diff))
                        used.append(y)
                        t = t + 1
            n_weight = np.insert(n_weight, i-1, m_score + bonus)

            rox = f1['RO'][res['map'][i -1, 0]-1, :]
            roy = f2['RO'][res['map'][i -1, 1]-1, :]
            mox = f1['M'][res['map'][i -1, 0]-1, 3]
            moy = f2['M'][res['map'][i -1, 1]-1, 3]
            z = np.dot(np.minimum(abs(mox - moy), abs(np.pi - abs(mox - moy))), 2) / np.pi

            t1 = np.flatnonzero(rox < 0)
            t2 = np.flatnonzero(roy < 0)
            t = np.hstack([t1,t2,np.array([8])])
            if np.min(t).size > 0:
                rox = rox[0:np.min(t)]
                roy = roy[0:np.min(t)]
                ro_res = np.insert(ro_res, i-1, np.max(abs(rox - roy)))
                if np.logical_and(ro_res[(i -1)] < 0.1, np.min(t+1) > 4):
                    n_weight[(i -1)] = n_weight[(i -1)] + 0.2
            else:
                ro_res = np.insert(ro_res, i-1, 0)

            [o_res_sim, ih, anony] = calc_orient(np.tile(f1['O'][res['map'][i -1, 0]-1, :],(1,1)), np.tile(f1['R'][res['map'][i -1, 0]-1, :],(1,1)), np.tile(f2['O'][res['map'][i -1, 1]-1, :],(1,1)), np.tile(f2['R'][res['map'][i -1, 1]-1, :],(1,1))) # nargout=2
            o_res = np.insert(o_res, i-1, o_res_sim)
            mc_res = np.insert(mc_res, i-1, z)
            sc_res = np.insert(sc_res, i-1, 1)#costmat[res['map'][i -1,1),res['map'][i -1,2));
            res['map'][np.setdiff1d(np.array([i-1]),np.flatnonzero(res['map'][:, 0] == res['map'][i -1, 0])), 0] = 0
            res['map'][np.setdiff1d(np.array([i-1]),np.flatnonzero(res['map'][:, 1] == res['map'][i -1, 1])), 0] = 0

    sc_cost = 100

    if o_res.size > 1:
        inda1 = np.union1d(inda1, res['map'][:, 0])
        inda2 = np.union1d(inda2, res['map'][:, 1])

        A = f1['X'][inda1-1, :]
        B = f2['X'][inda2-1, :]
        out_vec_1 = np.zeros(shape=(1, A.shape[0]), dtype='float16')
        out_vec_2 = np.zeros(shape=(1, B.shape[0]), dtype='float16')

        BH1, mean_dist_1 = sc_compute(A.T, f1['M'][inda1-1, 3].T, mean_dist_global, nbins_theta, nbins_r, r_inner, r_outer, out_vec_1) # nargout=2
        BH2, mean_dist_2 = sc_compute(B.T, f2['M'][inda2-1, 3].T, mean_dist_1, nbins_theta, nbins_r, r_inner, r_outer, out_vec_2) # nargout=2
        #compute pairwise cost between all shape contexts
        costmat = hist_cost_2(BH1, BH2, r_inner, r_outer, nbins_theta, nbins_r)
        sc_vals = np.array([])

        for i in range(1, (int(res['map'].size / 2) +1)):
            if costmat[(np.flatnonzero(inda1 == res['map'][i -1, 0])), (np.flatnonzero(inda2 == res['map'][i -1, 1]))].size > 0:
                sc_vals = np.insert(sc_vals, (i -1), costmat[(np.flatnonzero(inda1 == res['map'][i -1, 0])), (np.flatnonzero(inda2 == res['map'][i -1, 1]))])
            else:
                sc_vals = np.insert(sc_vals, (i -1), 10)
        sc_cost = np.mean(sc_vals)
        #/exp(-(0.7-max(sqrt(res['area']),0))) 
    
    unknown_c = np.flatnonzero(o_res == - 1).size

    ind = np.intersect1d(np.flatnonzero(o_res > 0.25), np.flatnonzero(ro_res < 0.897))

    for i in range(1, (ind.size +1)):
        dd1 = f1['N'][np.ix_(np.array(range(np.dot((res['map'][ind[(i-1)], 0] -1), (s1 - 1)) + 1, (np.dot((res['map'][ind[(i-1)], 0] -1), (s1 - 1)) + ns +1)))-1, range(2, 9))]
        dd2 = f2['N'][np.ix_(np.array(range(np.dot((res['map'][ind[(i-1)], 1] -1), (s2 - 1)) + 1, (np.dot((res['map'][ind[(i-1)], 1] -1), (s2 - 1)) + ns +1)))-1, range(2, 9))]
    
    o_res = o_res[ind]
    ro_res = ro_res[ind]
    mc_res = mc_res[ind]
    sc_res = sc_res[ind]
    n_weight = n_weight[ind]
    same_type = np.array(same_type)[ind]
    #o_res=o_res.*n_weight;

##    res['sc'] / res['area']
##    res['sc']
##    ro_res     #=1/(sum(ro_res)/numel(ro_res))
##    o_res     #=sum(o_res)/numel(o_res)
##    n_weight
##    mc_res     #=1/sum(mc_res)/numel(mc_res)
##    sc_res

    nX = np.intersect1d(nX, ind1)
    nY = np.intersect1d(nY, ind2)
##    ind.size
##    res['map'].shape[0]

    ns1 = nX.size
    ns2 = nY.size

    ng_samp1 = ng_samp1 - unknown_c #=ns1;     #ng_samp1+(ns1/2);
    ng_samp2 = ng_samp2 - unknown_c     #=ns2;     #ng_samp2+(ns2/2);
    
    ic1 = np.flatnonzero(f1['M'][:, 2] == 5)
    ic2 = np.flatnonzero(f2['M'][:, 2] == 5)

    #a=abs(ns1-ng_samp1) + abs(ns2-ng_samp2)
    #4

    o_a = np.zeros(shape=(ind.size, ind.size), dtype='float16')
    o_b = np.zeros(shape=(ind.size, ind.size), dtype='float16')
    for i in range(1, (ind.size +1)):
        for j in range(i + 1, (ind.size +1)):
            [o_a[(i -1), (j -1)], ia, ra] = calc_orient(np.tile(f1['O'][res['map'][i -1, 0] -1, :],(1,1)), np.tile(f1['R'][res['map'][i -1, 0] -1, :],(1,1)), np.tile(f1['O'][res['map'][j-1, 0] -1, :],(1,1)), np.tile(f1['R'][res['map'][j-1, 0] -1, :],(1,1))) # nargout=3
            [o_b[(i -1), (j -1)], ib, rb] = calc_orient(np.tile(f2['O'][res['map'][i -1, 1] -1, :],(1,1)), np.tile(f2['R'][res['map'][i -1, 1] -1, :],(1,1)), np.tile(f2['O'][res['map'][j-1, 1] -1, :],(1,1)), np.tile(f2['R'][res['map'][j-1, 1] -1, :],(1,1))) # nargout=3
            o_a = np.minimum(o_a, 1)
            o_b = np.minimum(o_b, 1)

            if (np.intersect1d(ra, rb).size < 120):
                o_a[(i -1), (j -1)] = 0
                o_b[(i -1), (j -1)] = 0

            o_a[(j -1), (i -1)] = o_a[(i -1), (j -1)]
            o_b[(j -1), (i -1)] = o_b[(i -1), (j -1)]

    vv = 1
    if np.logical_and((mc_res.size >= 2), res['area'] > - 1):
        plt.hold('on')
        #         figure(1)
        plt.subplot(2, 2, 4)
        plt.plot(f1['X'][:, 0], f1['X'][:, 1], 'b+', f2['X'][:, 0], f2['X'][:, 1], 'ro')
##        if GC == 1:
            #          plot(f1['X'](ic1,1),f1['X'](ic1,2),'g+',f2['X'](ic2,1),f2['X'](ic2,2),'go')
        plt.title('final')
        plt.hold('off')
        plt.draw()
        plt.cla()
        time.sleep(2)
        v = np.max(abs(o_a - o_b),0)
        vv = np.median(v)
        sim = np.dot(np.dot((mc_res.size ** 2), math.sqrt(np.max(o_res))), np.mean(n_weight)) / np.maximum((np.dot(ng_samp1, ng_samp2)), 1)
        if edge_core == 1:
            sim = np.dot(sim, 0.5)
    else:
        sim = 0
    print 'sc_cost = ' + str(sc_cost) + '\n'
    print 'sim = ' + str(sim) + '\n'
    return sim, angle, sc_cost
Exemple #40
0
    def testRegister(self):
        """ Test write & read for the all registers """

        def test(dataA, dataB, dataD, selA, selB, selD, en, we, clk):
            registers = {}
            # Write some data
            for i in range(8):
                en.next = True
                we.next = True
                data = randrange(2**16)

                selD.next = int(i)
                dataD.next = data
                registers[i] = hex(data)
                yield delay(10)

            # aaaaand read it back
            for i, data in registers.iteritems():
                we.next = False
                selA.next = i
                selB.next = 7 - i
                yield delay(10)

                self.assertEqual(selA, i)
                self.assertEqual(hex(dataA), data)
                self.assertEqual(selB, 7 - i)
                self.assertEqual(hex(dataB), registers[7 - i])

            # Check we=false -> no change
            i = int(randrange(8))
            data = randrange(2**16)
            selD.next = i
            dataD.next = data
            yield delay(10)

            selA.next= i
            yield delay(10)

            self.assertNotEqual(dataA, data)

            raise StopSimulation

        def ClkDrv(clk):
            while True:
                clk.next = not clk
                yield delay(5)

        dataA = Signal( intbv(0) )
        dataB = Signal( intbv(0) )
        dataD = Signal( intbv(0) )
        selA = Signal( intbv(0) )
        selB = Signal( intbv(0) )
        selD = Signal( intbv(0) )
        en = Signal(bool())
        we = Signal(bool())
        clk = Signal(bool())

        dut = register(dataA, dataB, dataD, selA, selB, selD, en, we, clk)
        check = test(dataA, dataB, dataD, selA, selB, selD, en, we, clk)
        clkdrv = ClkDrv(clk)

        sim = Simulation(dut, check, clkdrv)
        sim.run()
Exemple #41
0
def command_register(options, source):

    print register.register(source)
Exemple #42
0
from register import register
import time
for i in range(2000):
	time.sleep(1)
	try:
		register()
	except:
		pass
Exemple #43
0
    def run(self):
        from register import register
        register()

        install.run(self)
Exemple #44
0
def call_register((fn0,fni,dims)):
    from register import register
    return register(fn0,fni,dims)