diff --git a/components/simulator/creator_uielto_target_flash.js b/components/simulator/creator_uielto_target_flash.js index d78c92a2..8c2a0179 100644 --- a/components/simulator/creator_uielto_target_flash.js +++ b/components/simulator/creator_uielto_target_flash.js @@ -93,8 +93,6 @@ flashing = false, running = false, - - display = "", } }, @@ -306,10 +304,7 @@ this_env = this; gateway_remote_flash(this.flash_url + "/flash", farg).then( function(data) { - this_env.display += data; this_env.flashing = false; - var monitor = document.getElementById('textarea_display'); - monitor.scrollTop = monitor.scrollHeight; show_notification(data, 'danger') ; } ) ; @@ -331,10 +326,7 @@ this_env = this; gateway_remote_monitor(this.flash_url + "/monitor", farg).then( function(data) { - this_env.display += data; this_env.running = false; - var monitor = document.getElementById('textarea_display'); - monitor.scrollTop = monitor.scrollHeight; //show_notification(data, 'danger') ; } ) ; @@ -342,25 +334,6 @@ creator_ga('simulator', 'simulator.monitor', 'simulator.monitor'); }, - do_stop_flash( ) - { - this.save(); - - this.flashing = false; - - this_env = this; - gateway_remote_stop_flash(this.flash_url + "/stop").then( function(data) { - this_env.display += data; - this_env.flashing = false; - var monitor = document.getElementById('textarea_display'); - monitor.scrollTop = monitor.scrollHeight; - show_notification(data, 'danger') ; - } ) ; - - //Google Analytics - creator_ga('simulator', 'simulator.stop_flash', 'simulator.stop_flash'); - }, - // //General // @@ -372,12 +345,7 @@ app._data.target_board = this._props.target_board; app._data.target_port = this._props.target_port; app._data.flash_url = this._props.flash_url; - }, - - clean( ) - { - this.display = ""; - }, + } }, template: ' ' + ' ' + ' ' + - '
' + ' ' + ' ' + ' ' + @@ -451,6 +418,7 @@ ' ' + ' ' + ' ' + + '
' + ' ' + ' ' + ' ' + @@ -492,7 +460,7 @@ ' ' + '
' + ' ' + - ' ' + + ' ' + ' ' + ' ' + ' ' + @@ -811,47 +779,8 @@ ' ' + ' ' + ' ' + - /*' ' + - ' ' + - ' Stop' + - ' ' + - ' ' +*/ - ' ' + - ' ' + - /*' ' + - ' ' + - ' ' + - ' ' + - ' To stop the program execution press ctrl + ] in the terminal' + - ' ' + ' ' + ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' Clean' + - ' ' + - ' ' + - ' ' + - ' ' +*/ ' ' + ' ' + ' ' + @@ -1037,7 +966,7 @@ catch (err) { if (err.toString() == "TypeError: Failed to fetch") { - return "Please, execute 'python3 gateway.py' and connect your board first\n"; + return "Gateway not available at the moment. Please, execute 'python3 gateway.py' and connect your board first\n"; } return err.toString() + "\n"; @@ -1065,35 +994,7 @@ catch (err) { if (err.toString() == "TypeError: Failed to fetch") { - return "Please, execute 'python3 gateway.py' and connect your board first\n"; - } - - return err.toString() + "\n"; - } - } - - async function gateway_remote_stop_flash ( flash_url ) - { - var fetch_args = { - method: 'POST', - headers: { - 'Content-type': 'application/json', - 'Accept': 'application/json' - }, - body: JSON.stringify({}) - } ; - - try - { - var res = await fetch(flash_url, fetch_args) ; - var jres = await res.json(); - - return jres.status; - } - catch (err) - { - if (err.toString() == "TypeError: Failed to fetch") { - return "Please, execute 'python3 gateway.py' and connect your board first\n"; + return "Gateway not available at the moment. Please, execute 'python3 gateway.py' and connect your board first\n"; } return err.toString() + "\n"; diff --git a/hw_lab/deployment.json b/hw_lab/deployment.json index f8dc8e9e..b2395cea 100644 --- a/hw_lab/deployment.json +++ b/hw_lab/deployment.json @@ -3,18 +3,6 @@ { "target_board": "esp32c3", "target_port": "/dev/ttyUSB0", - "target_url": "http://localhost:8080" - }, - "target_2": - { - "target_board": "esp32c3", - "target_port": "/dev/ttyUSB0", - "target_url": "http://localhost:8080" - }, - "target_3": - { - "target_board": "esp32c3", - "target_port": "/dev/ttyUSB0", - "target_url": "http://localhost:8080" + "target_url": "http://10.119.4.59:8080" } } \ No newline at end of file diff --git a/hw_lab/hw_lab.py b/hw_lab/hw_lab.py index a4bef509..3a0643dc 100644 --- a/hw_lab/hw_lab.py +++ b/hw_lab/hw_lab.py @@ -126,16 +126,17 @@ def worker(item): deployment[item]['status'] = 'busy' # Sent to the target post - #url = deployment[item]['target_url'] - #msg = {'target_port': ret['target_port'], 'target_board': ret['target_board'], 'assembly': ret['asm_code']} - #ret["status"] = requests.post(url, json = mgs) + url = deployment[item]['target_url'] + "/job" + msg = {'target_port': deployment[item]['target_port'], 'target_board': ret['target_board'], 'assembly': ret['asm_code']} + res = requests.post(url, json = msg) + jres = res.json() - ################### - time.sleep(3) - ret["status"] = 'Completed' - ################### + file = open("results/" + ret['request_id'] + ".txt", "w") + file.write(jres['status']) + file.close() + ret["status"] = 'Completed' deployment[item]['status'] = 'free' enqueue_request (queue_outgoing, ret) @@ -176,7 +177,14 @@ def worker(item): deployment_file.close() -# (3) Queue management +# (3)Create result directory +try: + os.mkdir('results') +except Exception as e: + pass + + +# (4) Queue management queue_incoming['lock'] = threading.Lock() queue_outgoing['lock'] = threading.Lock() @@ -186,19 +194,19 @@ def worker(item): t.start() -# (4) Setup flask and cors: +# (5) Setup flask and cors: app = Flask(__name__) cors = CORS(app) app.config['CORS_HEADERS'] = 'Content-Type' -# (4a) GET / -> send hw_lab.html +# (5a) GET / -> send hw_lab.html @app.route("/", methods=["GET"]) @cross_origin() def get_status(): ret = { 'incoming': queue_incoming, 'outgoing': queue_outgoing } return json.dumps(ret) -# (4b) GET /targets -> send available targets +# (5b) GET /targets -> send available targets @app.route("/target_boards", methods=["GET"]) @cross_origin() def get_target_boards(): @@ -211,7 +219,7 @@ def get_target_boards(): return json.dumps(target_boards) -# (4c) POST /enqueue -> enqueue +# (5c) POST /enqueue -> enqueue @app.route("/enqueue", methods=["POST"]) @cross_origin() def post_enqueue(): @@ -232,7 +240,7 @@ def post_enqueue(): return jsonify(req_data) -# (4d) POST /delete -> delete +# (5d) POST /delete -> delete @app.route("/delete", methods=["POST"]) @cross_origin() def post_delete(): @@ -250,7 +258,7 @@ def post_delete(): return jsonify(req_data) -# (4e) POST /position -> position +# (5e) POST /position -> position @app.route("/position", methods=["POST"]) @cross_origin() def post_position(): @@ -268,7 +276,7 @@ def post_position(): return jsonify(req_data) -# (4f) POST /status -> status +# (5f) POST /status -> status @app.route("/status", methods=["POST"]) @cross_origin() def post_status(): @@ -291,12 +299,13 @@ def post_status(): return jsonify(req_data) -# (4g) GET /result -> send execution result +# (5g) GET /result -> send execution result @app.route("/result", methods=["GET"]) @cross_origin() def get_result(): try: - return send_file('deployment.json', as_attachment=True) #TODO + req_id = request.args.get('req_id') + return send_file("results/" + req_id + ".txt", as_attachment=True) except Exception as e: return str(e) diff --git a/js/min.creator_web.js b/js/min.creator_web.js index 88d6d9ed..7ed24591 100644 --- a/js/min.creator_web.js +++ b/js/min.creator_web.js @@ -1 +1 @@ -function bi_intToBigInt(int_value,int_base){return BigInt(parseInt(int_value)>>>0,int_base)}function bi_floatToBigInt(float_value){var BigInt_value=null;var bin=float2bin(float_value);var hex=bin2hex(bin);BigInt_value=BigInt("0x"+hex);return BigInt_value}function bi_BigIntTofloat(big_int_value){var hex=big_int_value.toString(16);if(hex.length>8){hex=hex.substring(hex.length-8,hex.length)}return hex2float("0x"+hex)}function bi_doubleToBigInt(double_value){var BigInt_value=null;var bin=double2bin(double_value);var hex=bin2hex(bin);BigInt_value=BigInt("0x"+hex);return BigInt_value}function bi_BigIntTodouble(big_int_value){var hex=big_int_value.toString(16).padStart(16,"0");return hex2double("0x"+hex)}function register_value_deserialize(architecture){for(var i=0;i"}catch(e){o=o+e+"
"}}}return o}function checkTypeIEEE(s,e,m){let rd=0;if(!m&&!e)rd=s?1<<3:1<<4;else if(!e)rd=s?1<<2:1<<5;else if(!(e^255))if(m)rd=s?1<<8:1<<9;else rd=s?1<<0:1<<7;else rd=s?1<<1:1<<6;return rd}function hex2char8(hexvalue){var num_char=hexvalue.toString().length/2;var exponent=0;var pos=0;var valuec=[];for(var i=0;i8){value[1]=value[1].substring(0,8)}var value_bit="";for(var i=0;i=3;i-=4){part=s.substr(i+1-4,4);accum=0;for(k=0;k<4;k+=1){if(part[k]!=="0"&&part[k]!=="1"){return{valid:false}}accum=accum*2+parseInt(part[k],10)}if(accum>=10){ret=String.fromCharCode(accum-10+"A".charCodeAt(0))+ret}else{ret=String(accum)+ret}}if(i>=0){accum=0;for(k=0;k<=i;k+=1){if(s[k]!=="0"&&s[k]!=="1"){return{valid:false}}accum=accum*2+parseInt(s[k],10)}ret=String(accum)+ret}return ret}function hex2double(hexvalue){var value=hexvalue.split("x");var value_bit="";for(var i=0;i{}]/g,"_");re=new RegExp("^[0-9]+$");if(value2.search(re)!=-1&&prefix!="undefined"){value2=prefix+value2}return value2}var track_stack_names=[];var track_stack_limits=[];function track_stack_create(){var ret={ok:true,msg:""};track_stack_names=[];track_stack_limits=[];track_stack_enter("main");return ret}function track_stack_enter(function_name){var ret={ok:true,msg:""};track_stack_names.push(function_name);var new_elto={function_name:function_name,begin_caller:track_stack_getTop().val.begin_callee,end_caller:track_stack_getTop().val.end_callee,begin_callee:architecture.memory_layout[4].value,end_callee:architecture.memory_layout[4].value};track_stack_limits.push(new_elto);if(typeof window!=="undefined"){app._data.callee_subrutine=track_stack_names[track_stack_names.length-1];app._data.caller_subrutine=track_stack_names[track_stack_names.length-2];app._data.begin_caller=new_elto.begin_caller;app._data.end_caller=new_elto.end_caller;app._data.begin_callee=new_elto.begin_callee;app._data.end_callee=new_elto.end_callee}return ret}function track_stack_leave(){var ret={ok:true,msg:""};if(0===track_stack_limits.length){ret.msg="track_stack_Leave: empty track_stack_limits !!.\n";return ret}track_stack_limits.pop();if(track_stack_names.length>0){track_stack_names.pop()}var elto_top=track_stack_getTop();if(typeof window!=="undefined"&&elto_top.val!=null){app._data.callee_subrutine=track_stack_names[track_stack_names.length-1];app._data.caller_subrutine=track_stack_names[track_stack_names.length-2];app._data.begin_caller=elto_top.val.begin_caller;app._data.end_caller=elto_top.val.end_caller;app._data.begin_callee=elto_top.val.begin_callee;app._data.end_callee=elto_top.val.end_callee}return ret}function track_stack_getTop(){var ret={ok:true,val:{begin_caller:architecture.memory_layout[4].value,end_caller:architecture.memory_layout[4].value,begin_callee:architecture.memory_layout[4].value,end_callee:architecture.memory_layout[4].value},msg:""};if(0===track_stack_limits.length){ret.ok=false;ret.msg="track_stack_getTop: empty track_stack_limits !!.\n";return ret}ret.val=track_stack_limits[track_stack_limits.length-1];if(typeof ret.val.begin_caller==="undefined"){ret.val.begin_caller=architecture.memory_layout[4].value}return ret}function track_stack_setTop(field,indexComponent,indexElement,value){var ret={ok:true,msg:""};if(0===track_stack_limits.length){ret.ok=false;ret.msg="track_stack_getTop: empty track_stack_limits !!.\n";return ret}var elto=track_stack_limits[track_stack_limits.length-1];if(typeof elto.length!=="undefined"){elto[field][indexComponent][indexElement]=value;return ret}elto[field]=value;return ret}function track_stack_setsp(value){if(typeof window!=="undefined"){app._data.end_callee=value}if(0===track_stack_limits.length){return}var elto=track_stack_limits[track_stack_limits.length-1];elto.end_callee=value}function track_stack_reset(){var ret={ok:true,msg:""};track_stack_names=[];track_stack_limits=[];track_stack_enter("main");if(typeof window!=="undefined"){app._data.track_stack_names=track_stack_names;app._data.callee_subrutine=track_stack_names[track_stack_names.length-1];app._data.caller_subrutine="";app._data.begin_caller=architecture.memory_layout[4].value;app._data.end_caller=architecture.memory_layout[4].value;app._data.begin_callee=architecture.memory_layout[4].value;app._data.end_callee=architecture.memory_layout[4].value}return ret}var stack_call_names=[];var stack_state_transition=[{"wm==":1,"wm!=":1,rm:2,wr:40,rr:0,end:3},{"wm==":1,"wm!=":7,rm:6,wr:5,rr:1,end:40},{"wm==":1,"wm!=":1,rm:2,wr:45,rr:2,end:3},{"wm==":-1,"wm!=":-1,rm:-1,wr:-1,rr:-1,end:-1},{"wm==":-1,"wm!=":-1,rm:-1,wr:-1,rr:-1,end:-1},{"wm==":44,"wm!=":5,rm:6,wr:5,rr:5,end:43},{"wm==":44,"wm!=":6,rm:6,wr:0,rr:6,end:43},{"wm==":7,"wm!=":7,rm:6,wr:5,rr:7,end:42}];var stack_call_register=[];function creator_callstack_create(){var ret={ok:true,msg:""};stack_call_names=[];stack_call_register=[];creator_callstack_enter("main");return ret}function creator_callstack_enter(function_name){var ret={ok:true,msg:""};stack_call_names.push(function_name);var arr_sm=[];var arr_write=[];var arr_read=[];var arr_value=[];var arr_size_write=[];var arr_size_read=[];for(var i=0;i0){stack_call_names.pop()}return ret}function creator_callstack_getTop(){var ret={ok:true,val:null,msg:""};if(0===stack_call_register.length){ret.ok=false;ret.msg="creator_callstack_getTop: empty stack_call_register !!.\n";return ret}ret.val=stack_call_register[stack_call_register.length-1];return ret}function creator_callstack_setTop(field,indexComponent,indexElement,value){var ret={ok:true,msg:""};if(0===stack_call_register.length){ret.ok=false;ret.msg="creator_callstack_getTop: empty stack_call_register !!.\n";return ret}var elto=stack_call_register[stack_call_register.length-1];if(typeof elto.length!=="undefined"){elto[field][indexComponent][indexElement]=value;return ret}elto[field]=value;return ret}function creator_callstack_setState(indexComponent,indexElement,newState){var elto=creator_callstack_getTop();if(elto.ok===false){console_log("creator_callstack_setState: "+elto.msg);return""}elto.val.register_sm[indexComponent][indexElement]=newState}function creator_callstack_getState(indexComponent,indexElement){var elto=creator_callstack_getTop();if(elto.ok===false){console_log("creator_callstack_getState: "+elto.msg);return""}return elto.val.register_sm[indexComponent][indexElement]}function creator_callstack_newWrite(indexComponent,indexElement,address,length){creator_callstack_do_transition("wm",indexComponent,indexElement,address);var elto=creator_callstack_getTop();if(elto.ok==false){console_log("creator_callstack_newWrite: "+elto.msg);return""}elto.val.register_address_write[indexComponent][indexElement].push(address);elto.val.register_size_write[indexComponent][indexElement].push(length)}function creator_callstack_newRead(indexComponent,indexElement,address,length){var elto=creator_callstack_getTop();if(elto.ok==false){console_log("creator_callstack_newRead: "+elto.msg);return""}elto.val.register_address_read[indexComponent][indexElement].push(address);elto.val.register_size_read[indexComponent][indexElement].push(length);creator_callstack_do_transition("rm",indexComponent,indexElement,address)}function creator_callstack_writeRegister(indexComponent,indexElement){creator_callstack_do_transition("wr",indexComponent,indexElement,address)}function creator_callstack_reset(){var ret={ok:true,msg:""};stack_call_names=[];stack_call_register=[];creator_callstack_enter("main");return ret}function creator_callstack_do_transition(doAction,indexComponent,indexElement,address){var state=creator_callstack_getState(indexComponent,indexElement);var action=doAction;if(doAction=="wm"){var elto=creator_callstack_getTop();if(elto.ok==false){console_log("creator_callstack_do_transition: "+elto.msg);return""}var equal=elto.val.register_address_write[indexComponent][indexElement].includes(address);action=equal?"wm==":"wm!="}if(typeof stack_state_transition[state]==="undefined"||typeof stack_state_transition[state][action]==="undefined"){if(state<40||state<0){console_log("creator_callstack_do_transition: undefined action")}return}var new_state=stack_state_transition[state][action];creator_callstack_setState(indexComponent,indexElement,new_state);if(action!="end"){console_log("creator_callstack_do_transition ["+architecture.components[indexComponent].elements[indexElement].name+"]: transition from "+"state '"+state+"'' to state '"+new_state+"' and action '"+action+"' is empty (warning).")}}function capi_raise(msg){if(typeof app!=="undefined"){app.exception(msg)}else{console.log(msg)}}function capi_arithmetic_overflow(op1,op2,res_u){op1_u=capi_uint2int(op1);op2_u=capi_uint2int(op2);res_u=capi_uint2int(res_u);return op1_u>0&&op2_u>0&&res_u<0||op1_u<0&&op2_u<0&&res_u>0}function capi_bad_align(addr,type){size=creator_memory_type2size(type);return addr%size!==0}function capi_mem_write(addr,value,type,reg_name){var size=1;if(capi_bad_align(addr,type)){capi_raise("The memory must be align");creator_executor_exit(true)}var addr_16=parseInt(addr,16);if(addr_16>=parseInt(architecture.memory_layout[0].value)&&addr_16<=parseInt(architecture.memory_layout[1].value)){capi_raise("Segmentation fault. You tried to write in the text segment");creator_executor_exit(true)}try{writeMemory(value,addr,type)}catch(e){capi_raise("Invalid memory access to address '0x"+addr.toString(16)+"'");creator_executor_exit(true)}var ret=crex_findReg(reg_name);if(ret.match===0){return}var i=ret.indexComp;var j=ret.indexElem;creator_callstack_newWrite(i,j,addr,type)}function capi_mem_read(addr,type,reg_name){var size=1;var val=0;if(capi_bad_align(addr,type)){capi_raise("The memory must be align");creator_executor_exit(true)}var addr_16=parseInt(addr,16);if(addr_16>=parseInt(architecture.memory_layout[0].value)&&addr_16<=parseInt(architecture.memory_layout[1].value)){capi_raise("Segmentation fault. You tried to read in the text segment");creator_executor_exit(true)}try{val=readMemory(addr,type)}catch(e){capi_raise("Invalid memory access to address '0x"+addr.toString(16)+"'");creator_executor_exit(true)}var ret=creator_memory_value_by_type(val,type);var find_ret=crex_findReg(reg_name);if(find_ret.match===0){return ret}var i=find_ret.indexComp;var j=find_ret.indexElem;creator_callstack_newRead(i,j,addr,type);return ret}function capi_exit(){creator_ga("execute","execute.syscall","execute.syscall.exit");return creator_executor_exit(false)}function capi_print_int(value1){creator_ga("execute","execute.syscall","execute.syscall.print_int");var ret1=crex_findReg(value1);if(ret1.match===0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}var value=readRegister(ret1.indexComp,ret1.indexElem);var val_int=parseInt(value.toString())>>0;var value=readRegister(ret1.indexComp,ret1.indexElem);var val_int=parseInt(value.toString())>>0;display_print(full_print(val_int,null,false))}function capi_print_float(value1){creator_ga("execute","execute.syscall","execute.syscall.print_float");var ret1=crex_findReg(value1);if(ret1.match==0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}var value=readRegister(ret1.indexComp,ret1.indexElem,"SFP-Reg");var bin=float2bin(value);display_print(full_print(value,bin,true))}function capi_print_double(value1){creator_ga("execute","execute.syscall","execute.syscall.print_double");var ret1=crex_findReg(value1);if(ret1.match==0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}var value=readRegister(ret1.indexComp,ret1.indexElem,"DFP-Reg");var bin=double2bin(value);display_print(full_print(value,bin,true))}function capi_print_char(value1){creator_ga("execute","execute.syscall","execute.syscall.print_char");var ret1=crex_findReg(value1);if(ret1.match==0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}var aux=readRegister(ret1.indexComp,ret1.indexElem);var aux2=aux.toString(16);var length=aux2.length;var value=aux2.substring(length-2,length);value=String.fromCharCode(parseInt(value,16));display_print(value)}function capi_print_string(value1){creator_ga("execute","execute.syscall","execute.syscall.print_string");var ret1=crex_findReg(value1);if(ret1.match==0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}var addr=readRegister(ret1.indexComp,ret1.indexElem);var msg=readMemory(parseInt(addr),"string");display_print(msg)}function capi_read_int(value1){creator_ga("execute","execute.syscall","execute.syscall.read_int");var ret1=crex_findReg(value1);if(ret1.match==0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}if(typeof document!="undefined"){document.getElementById("enter_keyboard").scrollIntoView()}run_program=3;return keyboard_read(kbd_read_int,ret1)}function capi_read_float(value1){creator_ga("execute","execute.syscall","execute.syscall.read_float");var ret1=crex_findReg(value1);if(ret1.match==0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}if(typeof document!="undefined"){document.getElementById("enter_keyboard").scrollIntoView()}run_program=3;return keyboard_read(kbd_read_float,ret1)}function capi_read_double(value1){creator_ga("execute","execute.syscall","execute.syscall.read_double");var ret1=crex_findReg(value1);if(ret1.match==0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}if(typeof document!="undefined"){document.getElementById("enter_keyboard").scrollIntoView()}run_program=3;return keyboard_read(kbd_read_double,ret1)}function capi_read_char(value1){creator_ga("execute","execute.syscall","execute.syscall.read_char");var ret1=crex_findReg(value1);if(ret1.match==0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}if(typeof document!="undefined"){document.getElementById("enter_keyboard").scrollIntoView()}run_program=3;return keyboard_read(kbd_read_char,ret1)}function capi_read_string(value1,value2){creator_ga("execute","execute.syscall","execute.syscall.read_string");var ret1=crex_findReg(value1);if(ret1.match===0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}var ret2=crex_findReg(value2);if(ret2.match===0){throw packExecute(true,"capi_syscall: register "+value2+" not found","danger",null)}if(typeof document!="undefined"){document.getElementById("enter_keyboard").scrollIntoView()}ret1.indexComp2=ret2.indexComp;ret1.indexElem2=ret2.indexElem;run_program=3;return keyboard_read(kbd_read_string,ret1)}function capi_sbrk(value1,value2){creator_ga("execute","execute.syscall","execute.syscall.sbrk");var ret1=crex_findReg(value1);if(ret1.match===0){throw packExecute(true,"capi_syscall: register "+value1+" not found","danger",null)}var ret2=crex_findReg(value2);if(ret2.match===0){throw packExecute(true,"capi_syscall: register "+value2+" not found","danger",null)}var new_size=parseInt(readRegister(ret1.indexComp,ret1.indexElem));if(new_size<0){throw packExecute(true,"capi_syscall: negative size","danger",null)}var new_addr=creator_memory_alloc(new_size);writeRegister(new_addr,ret2.indexComp,ret2.indexElem)}function capi_get_clk_cycles(){creator_ga("execute","execute.syscall","execute.syscall.get_clk_cycles");return total_clk_cycles}function capi_callconv_begin(addr){var function_name="";if(architecture.arch_conf[6].value===0){return}if(typeof architecture.components[0]!=="undefined"){if(typeof tag_instructions[addr]==="undefined")function_name="0x"+parseInt(addr).toString(16);else function_name=tag_instructions[addr]}creator_callstack_enter(function_name)}function capi_callconv_end(){if(architecture.arch_conf[6].value===0){return}var ret=creator_callstack_leave();if(ret.ok){return}creator_ga("execute","execute.exception","execute.exception.protection_jrra"+ret.msg);crex_show_notification(ret.msg,"danger")}function capi_drawstack_begin(addr){var function_name="";if(typeof architecture.components[0]!=="undefined"){if(typeof tag_instructions[addr]=="undefined")function_name="0x"+parseInt(addr).toString(16);else function_name=tag_instructions[addr]}track_stack_enter(function_name)}function capi_drawstack_end(){var ret=track_stack_leave();if(ret.ok){return}crex_show_notification(ret.msg,"warning")}function capi_split_double(reg,index){var value=bin2hex(double2bin(reg));console_log(value);if(index===0){return value.substring(0,8)}if(index===1){return value.substring(8,16)}}function capi_uint2float32(value){return uint_to_float32(value)}function capi_float322uint(value){return float32_to_uint(value)}function capi_int2uint(value){return value>>>0}function capi_uint2int(value){return value>>0}function capi_uint2float64(value0,value1){return uint_to_float64(value0,value1)}function capi_float642uint(value){return float64_to_uint(value)}function capi_check_ieee(s,e,m){return checkTypeIEEE(s,e,m)}function capi_float2bin(f){return float2bin(f)}function crex_findReg(value1){var ret={};ret.match=0;ret.indexComp=null;ret.indexElem=null;if(value1==""){return ret}for(var i=0;iib)return-1;if(ib>ia)return 1;return 0}))}function main_memory_datatype_get_addresses(){return Object.keys(main_memory_datatypes).sort((function(a,b){ia=parseInt(a);ib=parseInt(b);if(ia>ib)return-1;if(ib>ia)return 1;return 0}))}function main_memory_packs_forav(addr,value){return{addr:addr,bin:value,def_bin:"00",tag:null,data_type:null,reset:true,break:false}}function main_memory_datatypes_packs_foravt(addr,value,type,size){var default_value="00";if(typeof main_memory_datatypes[addr]!=="undefined"){default_value=main_memory_datatypes[addr].default_value}return{address:addr,value:value,default:default_value,type:type,size:size}}function main_memory_reset(){var i=0;var addrs=main_memory_get_addresses();for(i=0;i({...x,addr:addr+i})));main_memory.splice(addr,size,...value)}function main_memory_update_associated_datatype(addr,value,datatype){var value=main_memory_read(addr);value.main_memory_datatypes=datatype;main_memory[addr]=value}function main_memory_read_value(addr){return main_memory_read(addr).bin}function main_memory_write_value(addr,value){var value_obj=main_memory_read(addr);value_obj.bin=value;main_memory_write(addr,value_obj)}function main_memory_write_tag(addr,tag){var value_obj=main_memory_read(addr);value_obj.tag=tag;main_memory_write(addr,value_obj)}function main_memory_read_default_value(addr){return main_memory_read(addr).def_bin}function main_memory_read_nbytes(addr,n){var value="";for(var i=0;i>>24;break;case"h":val=val&65535;if(val&32768)val=4294901760|val;break;case"hu":val=val<<16>>>16;break;default:break}return val}function creator_memory_alignelto(new_addr,new_size){var ret={new_addr:new_addr,new_size:new_size};for(var i=0;iword_size_bytes-1){creator_memory_updaterow(addrs[i]);last_addr=curr_addr}}}function creator_memory_clearall(){if(typeof app=="undefined"||typeof app._data.main_memory=="undefined"){return}app._data.main_memory={}}function creator_memory_update_row_view(selected_view,segment_name,row_info){if(typeof app._data.main_memory[row_info.addr]=="undefined"){return}var hex_packed=app._data.main_memory[row_info.addr].hex_packed;var new_value=app._data.main_memory[row_info.addr].value;switch(selected_view){case"sig_int":new_value=parseInt(hex_packed,16)>>0;break;case"unsig_int":new_value=parseInt(hex_packed,16)>>>0;break;case"float":new_value=hex2float("0x"+hex_packed);break;case"char":new_value=hex2char8(hex_packed);break}app._data.main_memory[row_info.addr].value=new_value}function creator_memory_update_space_view(selected_view,segment_name,row_info){for(var i=0;i=parseInt(architecture.memory_layout[0].value)&&addr<=parseInt(architecture.memory_layout[1].value)}if(segment_name=="data_memory"){elto_inside_segment=addr>=parseInt(architecture.memory_layout[2].value)&&addr<=parseInt(architecture.memory_layout[3].value)}if(segment_name=="stack_memory"){elto_inside_segment=addr>=parseInt(architecture.memory_layout[3].value)}return elto_inside_segment}function creator_memory_is_segment_empty(segment_name){var addrs=main_memory_get_addresses();var insiders=addrs.filter((function(elto){return creator_memory_is_address_inside_segment(segment_name,elto)}));return insiders.length===0}function creator_memory_data_compiler(data_address,value,size,dataLabel,DefValue,type){var ret={msg:"",data_address:0};if(data_address%align>0){var to_be_filled=align-data_address%align;creator_memory_zerofill(data_address,to_be_filled);data_address=data_address+to_be_filled}if(data_address%size!==0&&data_address%word_size_bytes!==0){ret.msg="m21";ret.data_address=data_address;return ret}if(dataLabel!=null){data_tag.push({tag:dataLabel,addr:data_address})}ret.msg="";ret.data_address=main_memory_storedata(data_address,value,size,dataLabel,DefValue,DefValue,type);return ret}function creator_insert_instruction(auxAddr,value,def_value,hide,hex,fill_hex,label){var size=Math.ceil(hex.toString().length/2);return main_memory_storedata(auxAddr,hex,size,label,def_value,def_value,"instruction")}function creator_memory_storestring(string,string_length,data_address,label,type,align){if(label!=null){data_tag.push({tag:label,addr:data_address})}return main_memory_storedata(data_address,string,string_length,label,string,string,type)}var architecture_available=[];var load_architectures_available=[];var load_architectures=[];var back_card=[];var architecture_hash=[];var architecture={arch_conf:[],memory_layout:[],components:[],instructions:[],directives:[]};var architecture_json="";var textarea_assembly_editor;var codemirrorHistory=null;var code_assembly="";var tokenIndex=0;var nEnters=0;var pc=4;var address;var data_address;var stack_address;var backup_stack_address;var backup_data_address;var pending_instructions=[];var pending_tags=[];var extern=[];var compileError={m0:function(ret){return""+ret.token+""},m1:function(ret){return"Repeated tag: "+ret.token+""},m2:function(ret){return"Instruction '"+ret.token+"' not found"},m3:function(ret){return"Incorrect instruction syntax for '"+ret.token+"'"},m4:function(ret){return"Register '"+ret.token+"' not found"},m5:function(ret){return"Immediate number '"+ret.token+"' is too big"},m6:function(ret){return"Immediate number '"+ret.token+"' is not valid"},m7:function(ret){return"Tag '"+ret.token+"' is not valid"},m8:function(ret){return"Address '"+ret.token+"' is too big"},m9:function(ret){return"Address '"+ret.token+"' is not valid"},m10:function(ret){return".space value out of range ("+ret.token+" is greater than 50MiB)"},m11:function(ret){return"The space directive value should be positive and greater than zero"},m12:function(ret){return"This field is too small to encode in binary '"+ret.token+""},m13:function(ret){return"Incorrect pseudoinstruction definition "+ret.token+""},m14:function(ret){return"Invalid directive: "+ret.token+""},m15:function(ret){return"Invalid value '"+ret.token+"' as number."},m16:function(ret){return'The string of characters must start with "'+ret.token+""},m17:function(ret){return'The string of characters must end with "'+ret.token+""},m18:function(ret){return"Number '"+ret.token+"' is too big"},m19:function(ret){return"Number '"+ret.token+"' is empty"},m21:function(ret){return"The data must be aligned"+ret.token+""},m22:function(ret){return"The number should be positive '"+ret.token+"'"},m23:function(ret){return"Empty directive"+ret.token+""},m24:function(ret){return"After the comma you should go a blank --\x3e "+ret.token+""},m26:function(ret){return"Syntax error near line: "+ret.token+""},m27:function(ret){return"Please check instruction syntax, inmediate ranges, register name, etc."}};let promise;var notifications=[];var example_set_available=[];var example_available=[];var instructions=[];var instructions_tag=[];var tag_instructions={};var instructions_binary=[];var data=[];var data_tag=[];var code_binary="";var update_binary="";var load_binary=false;function load_arch_select(cfg){var ret={errorcode:"",token:"",type:"",update:"",status:"ok"};var auxArchitecture=cfg;architecture=register_value_deserialize(auxArchitecture);architecture_hash=[];for(var i=0;i=assembly.length){return null}while(":\t\n \r#".includes(assembly.charAt(index))&&index=assembly.length){return null}if(assembly.charAt(index)=="'"){index++;while(assembly.charAt(index)!="'"&&indexfieldsLength){nEnters=pending_instructions[i].line;return packCompileError("m8",signatureRawParts[j],"error","danger")}instructionParts[j]=addr;var newInstruction="";for(var w=0;wfieldsLength){nEnters=pending_instructions[i].line;return packCompileError("m8",instructionParts[j],"error","danger")}instructionParts[j]="0x"+addr.toString(16);var newInstruction="";for(var w=0;w1&&stopbit.length){var fieldsLength=0;for(var s=0;s2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}else{var re=new RegExp("[0-9-]{"+token.length+"}","g");if(token.search(re)==-1){return packCompileError("m15",token,"error","danger")}auxToken=parseInt(token)>>>0;auxTokenString=auxToken.toString(16).substring(auxToken.toString(16).length-2*architecture.directives[j].size,auxToken.toString(16).length).padStart(2*architecture.directives[j].size,"0");if(auxTokenString.length>2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}console_log(auxTokenString);var r=creator_memory_data_compiler(data_address,auxTokenString,architecture.directives[j].size,label,parseInt(auxTokenString,16)>>0,"byte");if(r.msg!=""){return packCompileError(r.msg,"","error","danger")}data_address=r.data_address;label=null;console_log("byte Terminado");next_token();token=get_token();console_log("token: "+token);for(var z=0;z2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}else{var re=new RegExp("[0-9-]{"+token.length+"}","g");if(token.search(re)==-1){return packCompileError("m15",token,"error","danger")}auxToken=parseInt(token)>>>0;auxTokenString=auxToken.toString(16).substring(auxToken.toString(16).length-2*architecture.directives[j].size,auxToken.toString(16).length).padStart(2*architecture.directives[j].size,"0");if(auxTokenString.length>2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}console_log(auxTokenString);var r=creator_memory_data_compiler(data_address,auxTokenString,architecture.directives[j].size,label,parseInt(auxTokenString,16)>>0,"half");if(r.msg!=""){return packCompileError(r.msg,"","error","danger")}data_address=r.data_address;label=null;console_log("half Terminado");next_token();token=get_token();console_log("token: "+token);for(var z=0;z2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}else{var re=new RegExp("[0-9-]{"+token.length+"}","g");if(token.search(re)==-1){return packCompileError("m15",token,"error","danger")}auxToken=parseInt(token)>>>0;auxTokenString=auxToken.toString(16).substring(auxToken.toString(16).length-2*architecture.directives[j].size,auxToken.toString(16).length).padStart(2*architecture.directives[j].size,"0");if(auxTokenString.length>2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}console_log(auxTokenString);var r=creator_memory_data_compiler(data_address,auxTokenString,architecture.directives[j].size,label,parseInt(auxTokenString,16)>>0,"word");if(r.msg!=""){return packCompileError(r.msg,"","error","danger")}data_address=r.data_address;label=null;console_log("word Terminado");next_token();token=get_token();console_log("token: "+token);for(var z=0;z2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}else{var re=new RegExp("[0-9-]{"+token.length+"}","g");if(token.search(re)==-1){return packCompileError("m15",token,"error","danger")}auxToken=parseInt(token)>>>0;auxTokenString=auxToken.toString(16).substring(auxToken.toString(16).length-2*architecture.directives[j].size,auxToken.toString(16).length).padStart(2*architecture.directives[j].size,"0");if(auxTokenString.length>2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}var r=creator_memory_data_compiler(data_address,auxTokenString,architecture.directives[j].size,label,parseInt(auxTokenString,16)>>0,"double_word");if(r.msg!=""){return packCompileError(r.msg,"","error","danger")}data_address=r.data_address;label=null;console_log("double word Terminado");next_token();token=get_token();console_log("token: "+token);for(var z=0;z2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length);token=hex2float(token)}else{var re=new RegExp("[+e0-9.-]{"+token.length+"}","g");if(token.search(re)==-1){return packCompileError("m15",token,"error","danger")}auxToken=parseFloat(token,10);auxTokenString=bin2hex(float2bin(auxToken)).padStart(2*architecture.directives[j].size,"0");if(auxTokenString.length>2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}console_log(auxTokenString);var r=creator_memory_data_compiler(data_address,auxTokenString,architecture.directives[j].size,label,token,"float");if(r.msg!=""){return packCompileError(r.msg,"","error","danger")}data_address=r.data_address;label=null;console_log("float Terminado");next_token();token=get_token();console_log("token: "+token);for(var z=0;z2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length);token=hex2double(token)}else{var re=new RegExp("[+e0-9.-]{"+token.length+"}","g");if(token.search(re)==-1){return packCompileError("m15",token,"error","danger")}auxToken=parseFloat(token,10);console_log(auxTokenString);auxTokenString=bin2hex(double2bin(auxToken)).padStart(2*architecture.directives[j].size,"0");if(auxTokenString.length>2*architecture.directives[j].size){return packCompileError("m18",token,"error","danger")}auxTokenString=auxTokenString.substring(auxTokenString.length-2*architecture.directives[j].size,auxTokenString.length)}console_log(auxTokenString);var r=creator_memory_data_compiler(data_address,auxTokenString,architecture.directives[j].size,label,token,"double");if(r.msg!=""){return packCompileError(r.msg,"","error","danger")}data_address=r.data_address;label=null;console_log("double Terminado");next_token();token=get_token();console_log("token: "+token);for(var z=0;z50*1024*1024){return packCompileError("m10",token,"error","danger")}var size=parseInt(token)*architecture.directives[j].size;data_address=creator_memory_storestring(size,size,data_address,label,"space",align);next_token();token=get_token();console_log("token: "+token);align=1;console_log("space Terminado");break;case"align":case"balign":console_log("[b]align");let pow_mode=token==".align";next_token();token=get_token();console_log("token: "+token);if(token==null){return packCompileError("m23","","error","danger")}var re=new RegExp("[0-9-]{"+token.length+"}","g");if(token.search(re)==-1){return packCompileError("m15",token,"error","danger")}if(parseInt(token)<0){return packCompileError("m22",token,"error","danger")}align=pow_mode?Math.pow(2,parseInt(token)):token;console_log(align);next_token();token=get_token();console_log("token: "+token);console_log("align Terminado");break;default:console_log("Default");existsData=false;break}}else if(j==architecture.directives.length-1&&token!=architecture.directives[j].name&&token!=null&&token.search(/\:$/)==-1){creator_memory_prereset();return ret}}}creator_memory_prereset();return ret}function code_segment_compiler(){var ret={errorcode:"",token:"",type:"",update:"",status:"ok"};var existsInstruction=true;next_token();var instInit=tokenIndex;while(existsInstruction){token=get_token();for(var i=0;ifieldsLength){return packCompileError("m12",token,"error","danger")}console_log(reg);console_log(reg.toString(2).padStart(fieldsLength,"0"));console_log(binary);console_log(binary.length);console_log(architecture.instructions[i].fields[a].startbit+1);console_log(binary.length-(architecture.instructions[i].fields[a].startbit+1));binary=binary.substring(0,binary.length-(architecture.instructions[i].fields[a].startbit+1))+reg.toString(2).padStart(fieldsLength,"0")+binary.substring(binary.length-architecture.instructions[i].fields[a].stopbit,binary.length);console_log(binary);re=RegExp("Field[0-9]+");instruction=instruction.replace(re,token)}else if(z==architecture_hash.length-1&&w==architecture.components[z].elements.length-1&&validReg===false){return packCompileError("m4",token,"error","danger")}regNum++}}}}break;case"SFP-Reg":token=instructionParts[j];console_log("token: "+token);var validReg=false;var regNum=0;for(var a=0;afieldsLength){return packCompileError("m12",token,"error","danger")}binary=binary.substring(0,binary.length-(architecture.instructions[i].fields[a].startbit+1))+reg.toString(2).padStart(fieldsLength,"0")+binary.substring(binary.length-architecture.instructions[i].fields[a].stopbit,binary.length);re=RegExp("Field[0-9]+");console_log(instruction);instruction=instruction.replace(re,token);console_log(instruction)}else if(z==architecture_hash.length-1&&w==architecture.components[z].elements.length-1&&validReg===false){return packCompileError("m4",token,"error","danger")}if(architecture.components[z].type=="fp_registers"&&architecture.components[z].double_precision===false){regNum++}}}else{for(var w=0;wfieldsLength){return packCompileError("m12",token,"error","danger")}binary=binary.substring(0,binary.length-(architecture.instructions[i].fields[a].startbit+1))+reg.toString(2).padStart(fieldsLength,"0")+binary.substring(binary.length-architecture.instructions[i].fields[a].stopbit,binary.length);re=RegExp("Field[0-9]+");console_log(instruction);instruction=instruction.replace(re,token);console_log(instruction)}else if(z==architecture_hash.length-1&&w==architecture.components[z].elements.length-1&&validReg===false){return packCompileError("m4",token,"error","danger")}if(architecture.components[z].type=="fp_registers"&&architecture.components[z].double_precision===false){regNum++}}}}}}break;case"DFP-Reg":token=instructionParts[j];console_log("token: "+token);var validReg=false;var regNum=0;for(var a=0;afieldsLength){return packCompileError("m12",token,"error","danger")}binary=binary.substring(0,binary.length-(architecture.instructions[i].fields[a].startbit+1))+reg.toString(2).padStart(fieldsLength,"0")+binary.substring(binary.length-architecture.instructions[i].fields[a].stopbit,binary.length);re=RegExp("Field[0-9]+");instruction=instruction.replace(re,token)}else if(z==architecture_hash.length-1&&w==architecture.components[z].elements.length-1&&validReg===false){return packCompileError("m4",token,"error","danger")}if(architecture.components[z].type=="fp_registers"&&architecture.components[z].double_precision===true){regNum++}}}else{for(var w=0;wfieldsLength){return packCompileError("m12",token,"error","danger")}binary=binary.substring(0,binary.length-(architecture.instructions[i].fields[a].startbit+1))+reg.toString(2).padStart(fieldsLength,"0")+binary.substring(binary.length-architecture.instructions[i].fields[a].stopbit,binary.length);re=RegExp("Field[0-9]+");instruction=instruction.replace(re,token)}else if(z==architecture_hash.length-1&&w==architecture.components[z].elements.length-1&&validReg===false){return packCompileError("m4",token,"error","danger")}if(architecture.components[z].type=="fp_registers"&&architecture.components[z].double_precision===true){regNum++}}}}}}break;case"Ctrl-Reg":token=instructionParts[j];console_log("token: "+token);var validReg=false;var regNum=0;for(var a=0;afieldsLength){return packCompileError("m12",token,"error","danger")}binary=binary.substring(0,binary.length-(architecture.instructions[i].fields[a].startbit+1))+reg.toString(2).padStart(fieldsLength,"0")+binary.substring(binary.length-architecture.instructions[i].fields[a].stopbit,binary.length);re=RegExp("Field[0-9]+");instruction=instruction.replace(re,token)}else if(z==architecture_hash.length-1&&w==architecture.components[z].elements.length-1&&validReg===false){return packCompileError("m4",token,"error","danger")}if(architecture.components[z].type=="ctr_registers"){regNum++}}}}}break;case"inm-signed":token=instructionParts[j];var token_user="";console_log("token: "+token);for(var a=0;afieldsLength){resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseInt(token,16))===true){return packCompileError("m6",token,"error","danger")}inm=parseInt(token,16).toString(2)}else if(token.match(/^(\d)+\.(\d)+/)){if(float2bin(parseFloat(token)).length>fieldsLength){resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseFloat(token))===true){return packCompileError("m6",token,"error","danger")}inm=float2bin(parseFloat(token,16))}else if(token.match(/^\'(.*?)\'$/)){var re=/^\'(.*?)\'$/;console_log(re);var match=re.exec(token);console_log(match);var asciiCode=match[1].charCodeAt(0);console_log(asciiCode);re=RegExp("Field[0-9]+");instruction=instruction.replace(re,asciiCode);inm=(asciiCode>>>0).toString(2)}else if(isNaN(parseInt(token))){validTagPC=false;startBit=architecture.instructions[i].fields[a].startbit;stopBit=architecture.instructions[i].fields[a].stopbit}else{var comNumPos=Math.pow(2,fieldsLength-1);var comNumNeg=comNumPos*-1;comNumPos=comNumPos-1;console_log(comNumPos);console_log(comNumNeg);if(parseInt(token,10)>comNumPos||parseInt(token,10)>>0).toString(2);inm=inm.substring(inm.length-fieldsLength,inm.length)}if(validTagPC===true){console_log(inm.length);if(inm.length>architecture.instructions[i].fields[a].startbit-architecture.instructions[i].fields[a].stopbit+1){return packCompileError("m12",token,"error","danger")}binary=generateBinary(architecture.instructions[i].separated,architecture.instructions[i].fields[a].startbit,architecture.instructions[i].fields[a].stopbit,binary,inm,fieldsLength,a)}re=RegExp("Field[0-9]+");instruction=instruction.replace(re,token)}}break;case"inm-unsigned":token=instructionParts[j];var token_user="";console_log("token: "+token);for(var a=0;ab-architecture.instructions[i].fields[a].stopbit[iii]+1)).reduce(((old,newV)=>old+newV))}fieldsLength=getFieldLength(architecture.instructions[i].separated,architecture.instructions[i].fields[a].startbit,architecture.instructions[i].fields[a].stopbit,a);var inm;if(token.match(/^0x/)){var value=token.split("x");if(value[1].length*4>fieldsLength){resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseInt(token,16))===true){return packCompileError("m6",token,"error","danger")}inm=parseInt(token,16).toString(2)}else if(token.match(/^(\d)+\.(\d)+/)){if(float2bin(parseFloat(token)).length>fieldsLength){resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseFloat(token))===true){return packCompileError("m6",token,"error","danger")}inm=float2bin(parseFloat(token,16))}else if(token.match(/^\'(.*?)\'$/)){var re=/^\'(.*?)\'$/;console_log(re);var match=re.exec(token);console_log(match);var asciiCode=match[1].charCodeAt(0);console_log(asciiCode);re=RegExp("Field[0-9]+");instruction=instruction.replace(re,asciiCode);inm=(asciiCode>>>0).toString(2)}else if(isNaN(parseInt(token))){validTagPC=false;startBit=architecture.instructions[i].fields[a].startbit;stopBit=architecture.instructions[i].fields[a].stopbit}else{var comNumPos=Math.pow(2,fieldsLength);console_log(comNumPos);if(parseInt(token,10)>comNumPos){console_log(oriInstruction);console_log(label);console_log(line);resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseInt(token))===true&&resultPseudo==-3){return packCompileError("m6",token,"error","danger")}inm=(parseInt(token,10)>>>0).toString(2);inm=inm.substring(inm.length-fieldsLength,inm.length)}if(validTagPC===true){console_log(inm.length);if(inm.length>architecture.instructions[i].fields[a].startbit-architecture.instructions[i].fields[a].stopbit+1){return packCompileError("m12",token,"error","danger")}binary=generateBinary(architecture.instructions[i].separated,architecture.instructions[i].fields[a].startbit,architecture.instructions[i].fields[a].stopbit,binary,inm,fieldsLength,a)}re=RegExp("Field[0-9]+");instruction=instruction.replace(re,token)}}break;case"address":token=instructionParts[j];console_log("token: "+token);for(var a=0;afieldsLength){return packCompileError("m8",token,"error","danger")}if(isNaN(parseInt(token,16))===true){return packCompileError("m9",token,"error","danger")}addr=parseInt(token,16).toString(2);binary=generateBinary(architecture.instructions[i].separated,architecture.instructions[i].fields[a].startbit,architecture.instructions[i].fields[a].stopbit,binary,inm,fieldsLength,a);re=RegExp("Field[0-9]+");instruction=instruction.replace(re,token)}else{var validTag=false;startBit=architecture.instructions[i].fields[a].startbit;stopBit=architecture.instructions[i].fields[a].stopbit}}}break;case"offset_bytes":token=instructionParts[j];var token_user="";console_log("token: "+token);for(var a=0;afieldsLength){resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseInt(token,16))===true){return packCompileError("m6",token,"error","danger")}inm=parseInt(token,16).toString(2)}else if(token.match(/^(\d)+\.(\d)+/)){if(float2bin(parseFloat(token)).length>fieldsLength){resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseFloat(token))===true){return packCompileError("m6",token,"error","danger")}inm=float2bin(parseFloat(token,16))}else if(isNaN(parseInt(token))){validTagPC=false;startBit=architecture.instructions[i].fields[a].startbit;stopBit=architecture.instructions[i].fields[a].stopbit}else{var comNumPos=Math.pow(2,fieldsLength-1);var comNumNeg=comNumPos*-1;comNumPos=comNumPos-1;console_log(comNumPos);console_log(comNumNeg);if(parseInt(token,10)>comNumPos||parseInt(token,10)>>0).toString(2);inm=inm.substring(inm.length-fieldsLength,inm.length)}if(validTagPC===true){if(inm.length>architecture.instructions[i].fields[a].startbit-architecture.instructions[i].fields[a].stopbit+1){return packCompileError("m12",token,"error","danger")}binary=generateBinary(architecture.instructions[i].separated,architecture.instructions[i].fields[a].startbit,architecture.instructions[i].fields[a].stopbit,binary,inm,fieldsLength,a)}re=RegExp("Field[0-9]+");console_log(instruction);instruction=instruction.replace(re,token);console_log(instruction)}}break;case"offset_words":token=instructionParts[j];var token_user="";console_log("token: "+token);for(var a=0;afieldsLength){resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseInt(token,16))===true){return packCompileError("m6",token,"error","danger")}inm=parseInt(token,16).toString(2)}else if(token.match(/^(\d)+\.(\d)+/)){if(float2bin(parseFloat(token)).length>fieldsLength){resultPseudo=pseudoinstruction_compiler(oriInstruction,label,line);console_log(resultPseudo);if(resultPseudo.status!="ok"){return resultPseudo}}if(isNaN(parseFloat(token))===true){return packCompileError("m6",token,"error","danger")}inm=float2bin(parseFloat(token,16))}else if(isNaN(parseInt(token))){validTagPC=false;startBit=architecture.instructions[i].fields[a].startbit;stopBit=architecture.instructions[i].fields[a].stopbit}else{var comNumPos=Math.pow(2,fieldsLength-1);var comNumNeg=comNumPos*-1;comNumPos=comNumPos-1;console_log(comNumPos);console_log(comNumNeg);if(parseInt(token,10)>comNumPos||parseInt(token,10)>>0).toString(2);inm=inm.substring(inm.length-fieldsLength,inm.length)}if(validTagPC===true){if(inm.length>architecture.instructions[i].fields[a].startbit-architecture.instructions[i].fields[a].stopbit+1){return packCompileError("m12",token,"error","danger")}binary=generateBinary(architecture.instructions[i].separated,architecture.instructions[i].fields[a].startbit,architecture.instructions[i].fields[a].stopbit,binary,inm,fieldsLength,a)}re=RegExp("Field[0-9]+");console_log(instruction);instruction=instruction.replace(re,token);console_log(instruction)}}break;default:token=instructionParts[j];console_log("token: "+token);for(var a=0;a{t=!ind?0:t;t+(cv-architecture.instructions[i].fields[a].stopbit[ind]+1)}));console_log(architecture.instructions[i].co.join("").padStart(fieldsLength,"0"))}else{fieldsLength=architecture.instructions[i].fields[a].startbit-architecture.instructions[i].fields[a].stopbit+1;console_log(architecture.instructions[i].co.padStart(fieldsLength,"0"));binary=binary.substring(0,binary.length-(architecture.instructions[i].fields[a].startbit+1))+architecture.instructions[i].co.padStart(fieldsLength,"0")+binary.substring(binary.length-architecture.instructions[i].fields[a].stopbit,binary.length)}console_log(binary);re=RegExp("Field[0-9]+");console_log(instruction);instruction=instruction.replace(re,token);console_log(instruction)}if(architecture.instructions[i].fields[a].type=="cop"){fieldsLength=architecture.instructions[i].fields[a].startbit-architecture.instructions[i].fields[a].stopbit+1;binary=binary.substring(0,binary.length-(architecture.instructions[i].fields[a].startbit+1))+architecture.instructions[i].fields[a].valueField.padStart(fieldsLength,"0")+binary.substring(binary.length-architecture.instructions[i].fields[a].stopbit,binary.length)}}break}}if(validTagPC===false&&resultPseudo==-3){console_log("pendiente");pc=pc+architecture.instructions[i].nwords*4;var padding="";padding=padding.padStart(architecture.instructions[i].nwords*32-binary.length,"0");binary=binary+padding;var hex=bin2hex(binary);var auxAddr=address;console_log(binary);console_log(bin2hex(binary));pending_instructions.push({address:address,instruction:instruction,signature:signatureParts,signatureRaw:signatureRawParts,Label:label,binary:binary,startBit:startBit,stopBit:stopBit,visible:true,line:nEnters});if(pending===false){instructions.push({Break:null,Address:"0x"+address.toString(16),Label:label,loaded:instruction,user:userInstruction,_rowVariant:"",visible:true,hide:false});instructions_binary.push({Break:null,Address:"0x"+address.toString(16),Label:label,loaded:binary,user:null,_rowVariant:"",visible:false});address=address+4*architecture.instructions[i].nwords}else{for(var pos=0;pospendingAddress){instructions.splice(pos,0,{Break:null,Address:"0x"+pendingAddress.toString(16),Label:label,loaded:instruction,user:userInstruction,_rowVariant:"",visible:true,hide:false});instructions_binary.splice(pos,0,{Break:null,Address:"0x"+pendingAddress.toString(16),Label:label,loaded:binary,user:null,_rowVariant:"",visible:false});auxAddr=pendingAddress;break}}}console_log(address.toString(16));console_log(instructions);stopFor=true;break}else{if(resultPseudo==-3){console_log("no pendiente");pc=pc+architecture.instructions[i].nwords*4;var padding="";padding=padding.padStart(architecture.instructions[i].nwords*32-binary.length,"0");binary=binary+padding;var hex=bin2hex(binary);var auxAddr=address;console_log(binary);console_log(bin2hex(binary));if(pending===false){instructions.push({Break:null,Address:"0x"+address.toString(16),Label:label,loaded:instruction,user:userInstruction,_rowVariant:"",visible:true,hide:false});instructions_binary.push({Break:null,Address:"0x"+address.toString(16),Label:label,loaded:binary,user:null,_rowVariant:"",visible:false});address=address+4*architecture.instructions[i].nwords}else{for(var pos=0;pospendingAddress){instructions.splice(pos,0,{Break:null,Address:"0x"+pendingAddress.toString(16),Label:label,loaded:instruction,user:userInstruction,_rowVariant:"",visible:true,hide:false});instructions_binary.splice(pos,0,{Break:null,Address:"0x"+pendingAddress.toString(16),Label:label,loaded:binary,user:null,_rowVariant:"",visible:false});auxAddr=pendingAddress;break}}}stopFor=true;console_log(address.toString(16));console_log(instructions)}}}}return ret}function pseudoinstruction_compiler(instruction,label,line){var ret={errorcode:"",token:"",type:"",update:"",status:"ok"};var re=/\' \'/;instruction=instruction.replace(re,"'\0'");var re=/\'\\n\'/;instruction=instruction.replace(re,"10");console_log(instruction);var re=/\'\\t\'/;instruction=instruction.replace(re,"9");console_log(instruction);var instructionParts=instruction.split(" ");var found=false;var re=/\'\0\'/;instruction=instruction.replace(re,"' '");console_log(instruction);for(var i=0;i;\s]/;while(definition.search(re)!=-1){var match=re.exec(definition);console_log(match);var code;if(instructionParts[match[1]].match(/^\'(.*?)\'$/)){var re=/^\'(.*?)\'$/;console_log(re);var match2=re.exec(instructionParts[match[1]]);console_log(match2);var asciiCode=match2[1].charCodeAt(0);console_log(asciiCode);console_log("value = field('"+asciiCode+"', '("+match[2]+")', '"+match[3]+"')");code="value = field('"+asciiCode+"', '("+match[2]+")', '"+match[3]+"')"}else{console_log("value = field('"+instructionParts[match[1]]+"', '("+match[2]+")', '"+match[3]+"')");code="value = field('"+instructionParts[match[1]]+"', '("+match[2]+")', '"+match[3]+"')"}var value;try{eval(code)}catch(e){if(e instanceof SyntaxError){return packCompileError("m5",token,"error","danger")}}if(value==-1){return packCompileError("m5",token,"error","danger")}definition=definition.replace("Field."+match[1]+".("+match[2]+")."+match[3],value);re=/Field.(\d).\((.*?)\).(.*?)[;\s]/}re=/Field.(\d).SIZE[=<>;\s]/g;if(definition.search(re)!=-1){var match=re.exec(definition);console_log(match);var code;if(instructionParts[match[1]].match(/^\'(.*?)\'$/)){var re=/^\'(.*?)\'$/;console_log(re);var match2=re.exec(instructionParts[match[1]]);console_log(match2);var asciiCode=match2[1].charCodeAt(0);console_log(asciiCode);console_log("value = field('"+asciiCode+"', 'SIZE', null)");code="value = field('"+asciiCode+"', 'SIZE', null)"}else{console_log("value = field('"+instructionParts[match[1]]+"', 'SIZE', null)");code="value = field('"+instructionParts[match[1]]+"', 'SIZE', null)"}var value;try{eval(code)}catch(e){if(e instanceof SyntaxError){return packCompileError("m5",token,"error","danger")}}if(value==-1){return packCompileError("m5",token,"error","danger")}console_log(value);console_log("Field."+match[1]+".SIZE");definition=definition.replace("Field."+match[1]+".SIZE",value)}console_log(definition);re=/reg\.pc/;console_log(re);while(definition.search(re)!=-1){definition=definition.replace(re,"pc");console_log(definition)}re=/no_ret_op\{([^}]*)\};/;console_log(re);while(definition.search(re)!=-1){var match2=re.exec(definition);console_log(match2[1]);eval(match2[1]);definition=definition.replace(re,"");console_log(definition)}console_log(definition);re=/op\{([^}]*)\}/;console_log(re);while(definition.search(re)!=-1){var match2=re.exec(definition);var result;console_log(match2[1]);eval("result="+match2[1]);definition=definition.replace(re,result);console_log(definition)}console_log(definition);var stop_while=0;while(definition.match(/\'(.*?)\'/)&&stop_while===0){var re=/\'(.*?)\'/;if(typeof match!=="undefined"){var match2=re.exec(instructionParts[match[1]]);console_log(match2);var asciiCode=match2[1].charCodeAt(0);console_log(asciiCode);definition=definition.replace(re,asciiCode)}else{stop_while=1}}console_log(definition);console_log(instruction);var re=new RegExp("'","g");instruction=instruction.replace(re,'"');console_log(instruction);var re=/{([^}]*)}/g;var code=re.exec(definition);if(code!=null){while(code!=null){var instructions=code[1].split(";");console_log(instructions);for(var j=0;j>>0).toString(2);binNum=binNum.padStart(32,"0");binNum=binNum.substring(31-startBit,32-endBit);var hexNum="0x"+bin2hex(binNum);return hexNum}else if(type=="float"){var binNum=float2bin(parseFloat(field));console_log(binNum);binNum=binNum.padStart(32,"0");binNum=binNum.substring(31-startBit,32-endBit);var hexNum="0x"+bin2hex(binNum);return hexNum}else if(type=="double"){var binNum=double2bin(parseFloat(field));console_log(binNum);binNum=binNum.padStart(64,"0");binNum=binNum.substring(63-startBit,64-endBit);var hexNum="0x"+bin2hex(binNum);return hexNum}}return-1}function getFieldLength(separated,startbit,stopbit,a){if(startbit==stopbit)console_log("Warning: startbit equal to stopBit, please check the achitecture definitions");let fieldsLength;if(!separated||!separated[a])fieldsLength=startbit-stopbit+1;else fieldsLength=startbit.map(((b,i)=>b-stopbit[i]+1)).reduce(((old,newV)=>old+newV));return fieldsLength}function generateBinary(separated,startbit,stopbit,binary,inm,fieldsLenght,a){if(!separated||!separated[a]){binary=binary.substring(0,binary.length-(startbit+1))+inm.padStart(fieldsLength,"0")+binary.substring(binary.length-stopbit,binary.length)}else{let myInm=inm;for(let i=startbit.length-1;i>=0;i--){let sb=startbit[i],stb=stopbit[i],diff=sb-stb+1;if(myInm.length<=diff){binary=binary.substring(0,binary.length-(sb+1))+myInm.padStart(diff,"0")+binary.substring(binary.length-stb,binary.length);break}else{let tmpinm=inm.substring(myInm.length-diff,myInm.length);binary=binary.substring(0,binary.length-(sb+1))+tmpinm.padStart(diff,"0")+binary.substring(binary.length-stb,binary.length);myInm=myInm.substring(0,myInm.length-diff)}}}return binary}function binaryStringToInt(b){return parseInt(b,2)}var execution_index=0;var execution_mode=0;var run_program=0;var execution_init=1;var instructions_packed=100;function packExecute(error,err_msg,err_type,draw){var ret={};ret.error=error;ret.msg=err_msg;ret.type=err_type;ret.draw=draw;return ret}function execute_instruction(){var draw={space:[],info:[],success:[],warning:[],danger:[],flash:[]};var error=0;var index;do{console_log(execution_index);console_log(readRegister(0,0));if(instructions.length===0){return packExecute(true,"No instructions in memory","danger",null)}if(execution_index<-1){return packExecute(true,"The program has finished","warning",null)}if(execution_index==-1){return packExecute(true,"The program has finished with errors","danger",null)}else if(run_program===3){return packExecute(false,"","info",null)}if(execution_init===1){for(var i=0;i=0;z--){if(architecture.components[j].elements[z].name.includes(instructionExecParts[i])){var_readings_definitions[signatureRawParts[i]]="var "+signatureRawParts[i]+" = readRegister ("+j+" ,"+z+', "'+signatureParts[i]+'");\n';var_readings_definitions_prev[signatureRawParts[i]]="var "+signatureRawParts[i]+"_prev = readRegister ("+j+" ,"+z+', "'+signatureParts[i]+'");\n';var_readings_definitions_name[signatureRawParts[i]]="var "+signatureRawParts[i]+"_name = '"+instructionExecParts[i]+"';\n";re=new RegExp("(?:\\W|^)((("+signatureRawParts[i]+") *=)[^=])","g");if(auxDef.search(re)!=-1){var_writings_definitions[signatureRawParts[i]]="writeRegister("+signatureRawParts[i]+", "+j+", "+z+', "'+signatureParts[i]+'");\n'}else{var_writings_definitions[signatureRawParts[i]]="if("+signatureRawParts[i]+" != "+signatureRawParts[i]+"_prev)"+" { writeRegister("+signatureRawParts[i]+" ,"+j+" ,"+z+', "'+signatureParts[i]+'"); }\n'}}}}}else{var_readings_definitions[signatureRawParts[i]]="var "+signatureRawParts[i]+" = "+instructionExecParts[i]+";\n"}}for(var elto in var_readings_definitions){readings_description=readings_description+var_readings_definitions[elto]}for(var elto in var_readings_definitions_prev){readings_description=readings_description+var_readings_definitions_prev[elto]}for(var elto in var_readings_definitions_name){readings_description=readings_description+var_readings_definitions_name[elto]}for(var elto in var_writings_definitions){writings_description=writings_description+var_writings_definitions[elto]}for(var i=0;i=0;j--){var clean_name=clean_string(architecture.components[i].elements[j].name[0],"reg_");var clean_aliases=architecture.components[i].elements[j].name.map((x=>clean_string(x,"reg_"))).join("|");re=new RegExp("(?:\\W|^)((("+clean_aliases+") *=)[^=])","g");if(auxDef.search(re)!=-1){re=new RegExp("("+clean_aliases+")");var reg_name=re.exec(auxDef)[0];clean_name=clean_string(reg_name,"reg_");writings_description=writings_description+"\nwriteRegister("+clean_name+", "+i+", "+j+', "'+signatureParts[i]+'");'}re=new RegExp("([^a-zA-Z0-9])(?:"+clean_aliases+")");if(auxDef.search(re)!=-1){re=new RegExp("("+clean_aliases+")");var reg_name=re.exec(auxDef)[0];clean_name=clean_string(reg_name,"reg_");readings_description=readings_description+"var "+clean_name+" = readRegister("+i+" ,"+j+', "'+signatureParts[i]+'");\n';readings_description=readings_description+"var "+clean_name+"_name = '"+clean_name+"';\n"}}}auxDef="\n/* Read all instruction fields */\n"+readings_description+"\n/* Original instruction definition */\n"+auxDef+"\n\n/* Modify values */\n"+writings_description;console_log(" ................................. "+"instructions["+execution_index+"]:\n"+auxDef+"\n"+" ................................. ");eval("instructions["+execution_index+"].preload = function(elto) { "+" try {\n"+auxDef.replace(/this./g,"elto.")+"\n"+" }\n"+" catch(e){\n"+" throw e;\n"+" }\n"+"}; ")}try{var result=instructions[execution_index].preload(this);if(typeof result!="undefined"&&result.error){return result}}catch(e){var msg="";if(e instanceof SyntaxError)msg="The definition of the instruction contains errors, please review it"+e.stack;else msg=e.msg;console_log("Error: "+e.stack);error=1;draw.danger.push(execution_index);execution_index=-1;return packExecute(true,msg,"danger",draw)}stats_update(type);clk_cycles_update(type);if(execution_index==-1){error=1;return packExecute(false,"","info",null)}if(error!==1&&execution_index=instructions.length&&run_program===3){for(var i=0;i=instructions.length&&run_program!=3){for(var i=0;i=parseInt(parseInt(architecture.memory_layout[2].value))){draw.danger.push(execution_index);throw packExecute(true,"Stack pointer cannot be placed in the data segment","danger",null)}else if(stackLimit<=parseInt(architecture.memory_layout[1].value)&&stackLimit>=parseInt(architecture.memory_layout[0].value)){draw.danger.push(execution_index);throw packExecute(true,"Stack pointer cannot be placed in the text segment","danger",null)}else{var diff=parseInt(architecture.memory_layout[4].value)-stackLimit;if(diff>0){creator_memory_zerofill(stackLimit,diff)}track_stack_setsp(stackLimit);architecture.memory_layout[4].value="0x"+stackLimit.toString(16).padStart(8,"0").toUpperCase()}}var totalStats=0;var stats_value=[0,0,0,0,0,0,0,0,0,0,0,0,0];var stats=[{type:"Arithmetic floating point",number_instructions:0,percentage:0},{type:"Arithmetic integer",number_instructions:0,percentage:0},{type:"Comparison",number_instructions:0,percentage:0},{type:"Conditional bifurcation",number_instructions:0,percentage:0},{type:"Control",number_instructions:0,percentage:0},{type:"Function call",number_instructions:0,percentage:0},{type:"I/O",number_instructions:0,percentage:0},{type:"Logic",number_instructions:0,percentage:0,abbreviation:"Log"},{type:"Memory access",number_instructions:0,percentage:0},{type:"Other",number_instructions:0,percentage:0},{type:"Syscall",number_instructions:0,percentage:0},{type:"Transfer between registers",number_instructions:0,percentage:0},{type:"Unconditional bifurcation",number_instructions:0,percentage:0}];function stats_update(type){for(var i=0;i ");var value=fn_post_read(keystroke,fn_post_params);keyboard=keyboard+" "+value;return packExecute(false,"The data has been uploaded","danger",null)}app._data.enter=false;if(3===run_program){setTimeout(keyboard_read,1e3,fn_post_read,fn_post_params);return}fn_post_read(app._data.keyboard,fn_post_params);app._data.keyboard="";app._data.enter=null;show_notification("The data has been uploaded","info");if(execution_index>=instructions.length){for(var i=0;i"+'
'+""+'
'+'
'+' '+"
"+""+"
"+' '+" Loading..."+" "+"
"+"
"+""+" "};Vue.component("spinner-loading",uielto_loading);var uielto_browser={props:{id:{type:String,required:true}},data:function(){return{}},methods:{},template:''+' You are using an unsupported browser, please use one of the following:'+"
"+" "+""+' '+" Google Chrome 70+"+' '+' '+" "+" "+" "+" "+' '+" Mozilla Firefox 60+"+' '+' '+" "+" "+" "+" "+' '+" Apple Safari 12+"+' '+' '+" "+" "+" "+""+" "+"
"};Vue.component("supported-browser",uielto_browser);var uielto_navbar={props:{version:{type:String,required:true},architecture_name:{type:String,required:true}},data:function(){return{}},methods:{load_num_version(){$.getJSON("package.json",(function(cfg){creator_information=cfg;app._data.version=cfg.version}))}},template:' '+' '+""+' '+' '+' '+'

Creator {{version}}

'+"
"+""+' '+" {{architecture_name}}"+" "+"
"+"
"+""+' '+' '+' '+" didaCtic and geneRic assEmbly progrAmming simulaTOR"+" "+" "+" "+"
"+" "+' '+' '+' '+' '+' "+' '+" About us"+" "+" "+" "+" "+" "+" "+"
"};Vue.component("navbar-creator",uielto_navbar);var uielto_toolbar={props:{id:{type:String,required:true},components:{type:String,required:true},browser:{type:String,required:true},arch_available:{type:Array,required:true}},computed:{components_array:function(){return this._props.components.split("|")}},methods:{},template:''+' '+' '+" '+" "+" "+'
'+"
"+"
"+"
"};Vue.component("uielto-toolbar",uielto_toolbar);var this_compiling=null;var uielto_toolbar_btngroup={props:{group:{type:Array,required:true},browser:{type:String,required:true},arch_available:{type:Array,required:true}},data:function(){return{compiling:false,reset_disable:false,instruction_disable:false,run_disable:false,stop_disable:true}},methods:{change_UI_mode(e){if(app._data.creator_mode!=e){if(e=="architecture"){$(".loading").show();setTimeout((function(){app._data.creator_mode=e;app.$forceUpdate();$(".loading").hide()}),50);return}app._data.creator_mode=e;if(e=="assembly"){setTimeout((function(){codemirrorStart();if(codemirrorHistory!=null){textarea_assembly_editor.setHistory(codemirrorHistory);textarea_assembly_editor.undo()}textarea_assembly_editor.setValue(code_assembly);if(update_binary!=""){$("#divAssembly").attr("class","col-lg-10 col-sm-12");$("#divTags").attr("class","col-lg-2 col-sm-12");$("#divTags").show()}}),50)}if(textarea_assembly_editor!=null&&e!="assembly"){app._data.assembly_code=textarea_assembly_editor.getValue();code_assembly=textarea_assembly_editor.getValue();codemirrorHistory=textarea_assembly_editor.getHistory();textarea_assembly_editor.toTextArea()}app.$bvToast.hide()}},load_arch_select(arch){uielto_preload_architecture.methods.load_arch_select(arch);app.$bvToast.hide()},new_assembly(){textarea_assembly_editor.setValue("")},assembly_compiler(code){this_compiling=this;this_compiling.compiling=true;promise=new Promise(((resolve,reject)=>{setTimeout((function(){if(typeof code!=="undefined"){code_assembly=code}else{code_assembly=textarea_assembly_editor.getValue()}var ret=assembly_compiler();app._data.totalStats=0;app._data.instructions=instructions;tokenIndex=0;uielto_toolbar_btngroup.methods.reset(true);if(typeof Storage!=="undefined"){var aux_object=jQuery.extend(true,{},architecture);var aux_architecture=register_value_serialize(aux_object);var aux_arch=JSON.stringify(aux_architecture,null,2);var date=new Date;var auxDate=date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()+" - "+date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear();localStorage.setItem("backup_arch_name",app._data.architecture_name);localStorage.setItem("backup_arch",aux_arch);localStorage.setItem("backup_asm",code_assembly);localStorage.setItem("backup_date",auxDate)}this_compiling.compiling=false;switch(ret.type){case"error":uielto_toolbar_btngroup.methods.compile_error(ret.msg,ret.token,ret.line);break;case"warning":show_notification(ret.token,ret.bgcolor);break;default:show_notification("Compilation completed successfully","success");break}resolve("0")}),25)}));app.$bvToast.hide()},compile_error(msg,token,line){var code_assembly_segment=code_assembly.split("\n");uielto_toolbar_btngroup.methods.change_UI_mode("assembly");setTimeout((function(){app.$root.$emit("bv::show::modal","modalAssemblyError");app.modalAssemblyError.line1="";app.modalAssemblyError.code1="";if(line>0){app.modalAssemblyError.line1=line;app.modalAssemblyError.code1=code_assembly_segment[line-1]}app.modalAssemblyError.line2=line+1;app.modalAssemblyError.code2=code_assembly_segment[line];app.modalAssemblyError.line3="";app.modalAssemblyError.code3="";if(line=0&&execution_index+40&&execution_index+4>=instructions.length){$(".instructions_table").animate({scrollTop:$(".instructions_table").height()},300)}}if(app._data.data_mode=="stats"){ApexCharts.exec("stat_plot","updateSeries",stats_value)}if(app._data.data_mode=="clk_cycles"){ApexCharts.exec("clk_plot","updateSeries",clk_cycles_value)}},reset(reset_graphic){creator_ga("execute","execute.reset","execute.reset");var draw={space:[],info:[],success:[],warning:[],danger:[],flash:[]};app._data.keyboard="";app._data.display="";app._data.enter=null;reset(reset_graphic);for(var i=0;i=0;i++){if(run_program==0||run_program==3||instructions[execution_index].Break===true&&run_program!=2){local_this.execution_UI_update(ret);local_this.reset_disable=false;local_this.instruction_disable=false;local_this.run_disable=false;local_this.stop_disable=true;app._data.main_memory_busy=false;if(instructions[execution_index].Break===true){run_program=2}return}else{if(run_program==2){run_program=1}ret=execute_instruction();if(typeof ret==="undefined"){console.log("Something weird happened :-S");run_program=0;local_this.execution_UI_update(ret);local_this.reset_disable=false;local_this.instruction_disable=false;local_this.run_disable=false;local_this.stop_disable=true;app._data.main_memory_busy=false;return}if(ret.msg!=null){show_notification(ret.msg,ret.type);local_this.execution_UI_update(ret);local_this.reset_disable=false;local_this.instruction_disable=false;local_this.run_disable=false;local_this.stop_disable=true;app._data.main_memory_busy=false}}}if(execution_index>=0){setTimeout(uielto_toolbar_btngroup.methods.execute_program_packed,15,ret,local_this)}else{local_this.execution_UI_update(ret);local_this.reset_disable=false;local_this.instruction_disable=false;local_this.run_disable=false;local_this.stop_disable=true;app._data.main_memory_busy=false}},flash_program(){},stop_execution(){run_program=0;this.reset_disable=false;this.instruction_disable=false;this.run_disable=false;this.stop_disable=true;app._data.main_memory_busy=false}},template:" "+" "+" "+' '+button_architecture()+button_assembly()+button_simulator()+button_save_architecture()+dropdown_assembly_file()+button_compile()+dropdown_library()+button_reset()+button_instruction()+button_run()+button_flash()+button_stop()+button_examples()+button_calculator()+button_configuration()+button_information()+" "+" "+" "+" "};Vue.component("toolbar-btngroup",uielto_toolbar_btngroup);function button_architecture(){return'"+' {{item.name}}'+""}function button_assembly(){return'"+' '+" Assembly"+""}function button_simulator(){return'"+' '+" Simulator"+""}function button_save_architecture(){return' "+' '+" Save"+""}function dropdown_assembly_file(){return"'+' '+' '+" New"+" "+" "+' '+" Load"+" "+" "+' '+" Save"+" "+" "+' '+" Examples"+" "+" "+' '+" Get code as URI"+" "+""}function button_compile(){return''+' '+" Compile/Linked"+' '+""}function dropdown_library(){return''+" "+' '+" Create"+" "+" "+' '+" Load Library"+" "+' '+' '+" Remove"+" "+""}function button_reset(){return''+' '+" Reset"+""}function button_instruction(){return''+' '+" Inst."+""+''+''+''}function button_run(){return''+' '+" Run"+""}function button_flash(){return''+' '+" Flash"+""}function button_stop(){return''+' '+" Stop"+""}function button_examples(){return'"+' '+" Examples"+""}function button_calculator(){return'"+' '+" Calculator"+""}function button_configuration(){return'"+' '+" Configuration"+""}function button_information(){return''+' '+" Info"+""+" "+"\x3c!-- Information popover --\x3e"+''}var uielto_configuration={props:{id:{type:String,required:true},default_architecture:{type:String,required:true},stack_total_list:{type:Number,required:true},autoscroll:{type:Boolean,required:true},notification_time:{type:Number,required:true},instruction_help_size:{type:Number,required:true},dark:{type:Boolean,required:true},c_debug:{type:Boolean,required:true}},data:function(){return{architectures:architectures=[{text:"None",value:"none"},{text:"RISC-V (RV32IMFD)",value:"RISC-V (RV32IMFD)"},{text:"MIPS-32",value:"MIPS-32"}]}},methods:{get_configuration(){if(localStorage.getItem("conf_default_architecture")!=null){app._data.default_architecture=localStorage.getItem("conf_default_architecture")}if(localStorage.getItem("conf_stack_total_list")!=null){app._data.stack_total_list=parseInt(localStorage.getItem("conf_stack_total_list"))}if(localStorage.getItem("conf_autoscroll")!=null){app._data.autoscroll=localStorage.getItem("conf_autoscroll")==="true"}if(localStorage.getItem("conf_notification_time")!=null){app._data.notification_time=parseInt(localStorage.getItem("conf_notification_time"))}if(localStorage.getItem("conf_instruction_help_size")!=null){app._data.instruction_help_size=parseInt(localStorage.getItem("conf_instruction_help_size"))}},change_default_architecture(){this._props.default_architecture=this.default_architecture;app._data.default_architecture=this._props.default_architecture;localStorage.setItem("conf_default_architecture",this._props.default_architecture);creator_ga("configuration","configuration.default_architecture","configuration.default_architecture."+this._props.default_architecture)},get_dark_mode(){if(localStorage.getItem("conf_dark_mode")!=null){document.getElementsByTagName("body")[0].style=localStorage.getItem("conf_dark_mode");if(localStorage.getItem("conf_dark_mode")==""){app._data.dark=false}else{app._data.dark=true}}else{var default_style=window.matchMedia("(prefers-color-scheme: dark)").matches;if(default_style===true){document.getElementsByTagName("body")[0].style="filter: invert(88%) hue-rotate(160deg) !important; background-color: #111 !important;";app._data.dark=true}else{document.getElementsByTagName("body")[0].style="";app._data.dark=false}}},change_stack_max_list(value){var prev_stack_total_list=this._props.stack_total_list;if(value){this._props.stack_total_list=this._props.stack_total_list+value;if(this._props.stack_total_list<1){this._props.stack_total_list=20}if(this._props.stack_total_list>500){this._props.stack_total_list=500}}else{this._props.stack_total_list=parseInt(this._props.stack_total_list)}app._data.stack_total_list=this._props.stack_total_list;localStorage.setItem("conf_stack_total_list",this._props.stack_total_list);creator_ga("configuration","configuration.stack_total_list","configuration.stack_total_list.speed_"+(prev_stack_total_list>this._props.stack_total_list).toString())},change_autoscroll(){this._props.autoscroll=!this._props.autoscroll;localStorage.setItem("conf_autoscroll",this._props.autoscroll);app._data.autoscroll=this._props.autoscroll;creator_ga("configuration","configuration.autoscroll","configuration.autoscroll."+this._props.autoscroll)},change_notification_time(value){var prev_notification_time=this._props.notification_time;if(value){this._props.notification_time=this._props.notification_time+value;if(this._props.notification_time<1e3){this._props.notification_time=1e3}if(this._props.notification_time>3500){this._props.notification_time=3500}}else{this._props.notification_time=parseInt(this._props.notification_time)}app._data.notification_time=this._props.notification_time;localStorage.setItem("conf_notification_time",this._props.notification_time);creator_ga("configuration","configuration.notification_time","configuration.notification_time.time_"+(prev_notification_time>this._props.notification_time).toString())},change_instruction_help_size(value){var prev_instruction_help_size=this._props.instruction_help_size;if(value){this._props.instruction_help_size=this._props.instruction_help_size+value;if(this._props.instruction_help_size<15){this._props.instruction_help_size=15}if(this._props.instruction_help_size>65){this._props.instruction_help_size=65}}else{this._props.instruction_help_size=parseInt(this._props.instruction_help_size)}app._data.instruction_help_size=this._props.instruction_help_size;localStorage.setItem("conf_instruction_help_size",this._props.instruction_help_size);creator_ga("configuration","configuration.instruction_help_size","configuration.instruction_help_size.size_"+(prev_instruction_help_size>this._props.instruction_help_size).toString())},change_dark_mode(){this._props.dark=!this._props.dark;if(this._props.dark){document.getElementsByTagName("body")[0].style="filter: invert(88%) hue-rotate(160deg) !important; background-color: #111 !important;";localStorage.setItem("conf_dark_mode","filter: invert(88%) hue-rotate(160deg) !important; background-color: #111 !important;")}else{document.getElementsByTagName("body")[0].style="";localStorage.setItem("conf_dark_mode","")}app._data.dark=this._props.dark;creator_ga("configuration","configuration.dark_mode","configuration.dark_mode."+this._props.dark)},change_debug_mode(){this._props.c_debug=!this._props.c_debug;app._data.c_debug=this._props.c_debug;creator_ga("configuration","configuration.debug_mode","configuration.debug_mode."+this._props.c_debug)}},template:' "+" "+" "+' '+' '+' '+" "+" "+" "+' '+' '+" "+" "+' -'+" "+' '+" "+" "+' +'+" "+" "+" "+" "+' '+' '+" "+" "+' -'+" "+' '+" "+" "+' +'+" "+" "+" "+" "+' '+' '+" "+" "+' -'+" "+' '+" "+" "+' +'+" "+" "+" "+" "+' '+' '+' '+" "+" "+" "+" "+' '+' '+' '+" "+" "+" "+' '+' '+' '+" "+" "+" "+" "};Vue.component("form-configuration",uielto_configuration);var uielto_info={props:{target:{type:String,required:true},show_instruction_help:{type:Boolean,required:true}},methods:{closePopover(){this.$root.$emit("bv::hide::popover")}},template:' '+" "+" "+' "+' '+" Help"+" "+" "+' "+' '+" Instruction Help"+" "+" "+' "+' '+" Show Notifications"+" "+" "};Vue.component("popover-info",uielto_info);var uielto_about={props:{id:{type:String,required:true}},template:' "+" "+" "+" "+" "+" "+""+" "+""+" "+""+" "+" "+" "+' Contact us: creator.arcos.inf.uc3m.es@gmail.com'+" "+" "+" "+' '+' '+' '+" "+' '+" "+" "+' '+" "+' '+" "+" "+" "+" "+" "+" "+" "};Vue.component("uielto-about",uielto_about);var uielto_author={props:{author_img:{type:String,required:true},author_alt:{type:String,required:true},author_full_name:{type:String,required:true},author_href_linked:{type:String,required:false},author_href_rgate:{type:String,required:false},author_href_github:{type:String,required:false}},template:' '+" "+" "+'
{{ author_full_name }}
'+"
"+' '+' '+" linkedin"+" "+"
"+' '+' '+" r-gate"+" "+"
"+' '+' '+" github"+" "+"
"+" "+"
"};Vue.component("card-author",uielto_author);var uielto_notifications={props:{id:{type:String,required:true},notifications:{type:Array,required:true}},template:' "+" "+' '+" There's no notification at the moment"+" "+" "+' '+' '+' '+' '+" {{item.mess}}"+" "+' {{item.time}} - {{item.date}}'+" "+" "+" "};Vue.component("uielto-notifications",uielto_notifications);var uielto_instruction_help={props:{id:{type:String,required:true},architecture_name:{type:String,required:true},architecture:{type:Object,required:true},architecture_guide:{type:String,required:true},instruction_help_size:{type:Object,required:true}},data:function(){return{instHelpFilter:null,insHelpFields:["name"]}},methods:{get_width(){return this._props.instruction_help_size+"vw"}},template:''+" "+' "+" "+"
"+' {{architecture_name}} Guide'+"
"+" "+' '+" "+' "+" "+" "+" "+"'+" "+' '+' "+" "+" "+" "+' '+" '+' '+" {{item.description}}"+" "+" "+" "+" "+' '+" '+' '+" {{item.description}}"+" "+" "+" "+" "+' '+' "+' '+" Delete"+" "+" "+" "+""};Vue.component("preload-architecture",uielto_preload_architecture);var uielto_new_architecture={props:{},data:function(){return{}},methods:{new_arch(){show_loading();$.getJSON("architecture/new_arch.json"+"?v="+(new Date).getTime(),(function(cfg){uielto_new_architecture.methods.load_arch_select_aux(cfg);hide_loading();show_notification("New Architecture has been loaded correctly","success");creator_ga("architecture","architecture.loading","architectures.loading.new_architecture")})).fail((function(){hide_loading();show_notification("New Architecture is not currently available","info")}))},load_arch_select_aux(cfg){var aux_architecture=cfg;architecture=register_value_deserialize(aux_architecture);architecture_json="new_arch";uielto_preload_architecture.data.architecture_name=architecture.arch_conf[0].value;app._data.architecture=architecture;app._data.architecture_name=architecture.arch_conf[0].value;app._data.architecture_guide="";architecture_hash=[];for(i=0;i'+" '+' '+' '+" "+" "+""+' '+' '+' '+" Allows you to define an architecture from scratch."+" "+" "+" "+" "+""};Vue.component("new-architecture",uielto_new_architecture);var uielto_load_architecture={props:{},data:function(){return{name_arch:"",description_arch:"",load_arch:"",show_modal:false}},methods:{read_arch(e){show_loading();e.preventDefault();if(!this.name_arch||!this.load_arch){hide_loading();show_notification("Please complete all fields","danger");return}this.show_modal=false;var file;var reader;var files=document.getElementById("arch_file").files;for(var i=0;i"+" "+' '+' '+" "+" "+" "+' '+' '+' '+" Allows to load the definition of an already created architecture."+" "+" "+" "+" "+" "+' '+" "+' '+" "+"
"+' '+" "+"
"+' '+" "+"
"+"
"+" "+""};Vue.component("load-architecture",uielto_load_architecture);var uielto_delete_architecture={props:{id:{type:String,required:true},index:{type:Number,required:true}},data:function(){return{}},methods:{remove_cache_arch(index){var id=architecture_available[index].name;for(var i=0;i'+' '+" Are you sure you want to delete the architecture?"+" "+"
"};Vue.component("delete-architecture",uielto_delete_architecture);var uielto_backup={props:{id:{type:String,required:true}},data:function(){return{show_modal:false,backup_date:localStorage.getItem("backup_date"),backup_arch_name:localStorage.getItem("backup_arch_name")}},methods:{backup_modal(env){if(typeof Storage!=="undefined"){if(localStorage.getItem("backup_arch")!=null&&localStorage.getItem("backup_asm")!=null&&localStorage.getItem("backup_date")!=null){env.$root.$emit("bv::show::modal","copy")}}},load_copy(){var aux_architecture=JSON.parse(localStorage.getItem("backup_arch"));architecture=register_value_deserialize(aux_architecture);app._data.architecture_name=localStorage.getItem("backup_arch_name");Object.assign(app._data.architecture,architecture);architecture_hash=[];for(var i=0;i'+' '+" A {{backup_arch_name}} backup is available."+" "+"
"+' '+" Date: {{backup_date}}"+" "+" "+' '+' '+" "+' '+" Discard"+" "+" "+" "+" "+' '+" Load"+" "+" "+" "+" "+""};Vue.component("uielto-backup",uielto_backup);var uielto_save_architecture={props:{id:{type:String,required:true}},data:function(){return{name_arch_save:""}},methods:{arch_save(){var aux_object=jQuery.extend(true,{},architecture);var aux_architecture=register_value_serialize(aux_object);aux_architecture.components.forEach(((c,i)=>{c.elements.forEach(((e,j)=>{if(e.default_value)e.value=e.default_value;else e.value=0}))}));var text_2_write=JSON.stringify(aux_architecture,null,2);var textFileAsBlob=new Blob([text_2_write],{type:"text/json"});var file_name;if(this.name_arch_save==""){file_name="architecture.json"}else{file_name=this.name_arch_save+".json"}var download_link=document.createElement("a");download_link.download=file_name;download_link.innerHTML="My Hidden Link";window.URL=window.URL||window.webkitURL;download_link.href=window.URL.createObjectURL(textFileAsBlob);download_link.onclick=destroyClickedElement;download_link.style.display="none";document.body.appendChild(download_link);download_link.click();var name_arch=file_name.replace(".json","");load_architectures_available.push({name:name_arch,img:"./images/personalized_logo.png",alt:name_arch+" logo",id:"select_conf"+name_arch,description:architecture.arch_conf[2].value,available:1});load_architectures.push({id:name_arch,architecture:text_2_write});if(typeof Storage!=="undefined"){var auxArch=JSON.stringify(load_architectures,null,2);localStorage.setItem("load_architectures",auxArch);auxArch=JSON.stringify(load_architectures_available,null,2);localStorage.setItem("load_architectures_available",auxArch)}show_notification("Save architecture","success")},clean_form(){this.name_arch_save=""}},template:''+' Enter the name of the architecture to save:'+"
"+' '+" "+"
"};Vue.component("save-architecture",uielto_save_architecture);var uielto_arch_conf={props:{arch_conf:{type:Array,required:true}},data:function(){return{arch_fields:["field","value","actions"]}},methods:{edit_arch_field_modal(field,index,button){app._data.modal_edit_arch_field.title="Edit "+field;app._data.modal_edit_arch_field.field=field;app._data.modal_edit_arch_field.value=this._props.arch_conf[index].value;app._data.modal_edit_arch_field.index=index;this.$root.$emit("bv::show::modal","edit_arch_field",button)},reset_arch_field_modal(field,index,button){app._data.modal_reset_arch_field.title="Reset "+field;app._data.modal_reset_arch_field.index=index;this.$root.$emit("bv::show::modal","reset_arch_field",button)}},template:'
'+""+'
'+' Architecture general information:'+"
"+"
"+""+'
'+""+" \x3c!-- Architecture configuration table --\x3e"+'
'+' '+""+" \x3c!-- For each instruction --\x3e"+""+' "+""+' "+""+' "+" "+"
"+""+'
'+""+"
"};Vue.component("arch-conf",uielto_arch_conf);var uielto_arch_conf_edit={props:{id:{type:String,required:true},title:{type:String,required:true},arch_field:{type:String,required:true},arch_field_value:{type:String,required:true},arch_field_index:{type:Number,required:true}},data:function(){return{actionTypes:[{value:"big_endian",text:"Big Endian"},{value:"little_endian",text:"Little Endian"}],show_modal:false}},methods:{verify_edit_arch_field(evt,index){evt.preventDefault();if(!this._props.arch_field_value){show_notification("Please complete the fields","danger")}else{this.edit_arch_field(index)}},edit_arch_field(index){this.show_modal=false;architecture.arch_conf[index].value=this._props.arch_field_value;if(index===0){app._data.architecture_name=architecture.arch_conf[index].value}show_notification("Architecture field correctly modified","success")},valid(value){if(parseInt(value)!==0){if(!value){return false}else{return true}}else{return true}}},template:' '+" "+""+" "+" {{arch_field}}:"+' '+" "+""+" "+" "+" {{arch_field}}:"+' '+" "+" "+""+" "+" "+" {{arch_field}}:"+' '+" "+" "+""+" "+" {{arch_field}}:"+' '+" "+" "+""+" "+" {{arch_field}}:"+" '+" "+" "+""+" "+""};Vue.component("arch-conf-edit",uielto_arch_conf_edit);var uielto_arch_conf_reset={props:{id:{type:String,required:true},title:{type:String,required:true},arch_field_index:{type:Number,required:true},arch_field_value:{type:String,required:true},architecture_name:{type:String,required:true}},data:function(){return{}},methods:{reset_arch_field(index){show_loading();for(var i=0;i'+' Are you sure you want to reset the item?'+""};Vue.component("arch-conf-reset",uielto_arch_conf_reset);var uielto_memory_layout={props:{memory_layout:{type:Array,required:true}},data:function(){return{}},methods:{edit_memory_layout_modal(button){app.$refs.memory_layout_edit.memory_layout=structuredClone(this._props.memory_layout);this.$root.$emit("bv::show::modal","memory_layout_edit",button)}},template:'
'+""+'
'+' Memory layout:'+'
'+'
'+' '+' '+" Change Memory Layout"+" "+"
"+'
'+' "+' '+" Reset Memory Layout"+" "+"
"+"
"+"
"+"
"+""+'
'+""+" \x3c!-- Memory layout sketch --\x3e"+'
'+' '+" "+' '+"
"+" .text"+"
"+"
"+"
"+' '+' '+" {{memory_layout[0].value}}"+" "+"
"+"
"+' '+" {{memory_layout[1].value}}"+" "+"
"+"
"+""+" "+' '+"
"+" .data"+"
"+"
"+"
"+' '+' '+" {{memory_layout[2].value}}"+" "+"
"+"
"+' '+" {{memory_layout[3].value}}"+" "+"
"+"
"+""+" "+' '+"
"+" ..."+"
"+"
"+"
"+' '+" "+" "+"
"+""+" "+' '+"
"+" stack"+"
"+"
"+"
"+' '+' '+" {{memory_layout[4].value}}"+" "+"
"+"
"+' '+" {{memory_layout[5].value}}"+" "+"
"+"
"+"
"+"
"+""+'
'+""+"
"};Vue.component("memory-layout",uielto_memory_layout);var uielto_memory_layout_form={props:{id:{type:String,required:true}},data:function(){return{memory_layout:["","","","","",""],show_modal:false}},methods:{verify_edit_memory_layout(evt){evt.preventDefault();for(var i=0;i=parseInt(this.memory_layout[j].value)){show_notification("The segment can not be overlap","danger");return}}}this.edit_memory_layout()},edit_memory_layout(){this.show_modal=false;architecture.memory_layout=structuredClone(this.memory_layout);backup_stack_address=architecture.memory_layout[4].value;backup_data_address=architecture.memory_layout[3].value;show_notification("Memory layout correctly modified","success")},valid(value){if(parseInt(value)!==0){if(!value){return false}else{return true}}else{return true}}},template:' '+" "+' '+' '+" "+" "+""+' '+' '+" "+" "+""+' '+' '+" "+" "+""+' '+' '+" "+" "+""+' '+' '+" "+" "+""+' '+' '+" "+" "+" "+""};Vue.component("memory-layout-edit",uielto_memory_layout_form);var uielto_memory_layout_reset={props:{id:{type:String,required:true},architecture_name:{type:String,required:true}},data:function(){return{}},methods:{reset_memory_layout(){show_loading();for(var i=0;i'+' Are you sure you want to reset the mememory layout set?'+""};Vue.component("memory-layout-reset",uielto_memory_layout_reset);var uielto_register_file={props:{register_file:{type:Array,required:true}},data:function(){return{}},methods:{edit_register_file_modal(name,index,button){app._data.modal_edit_register_file.title="Edit "+name;app._data.modal_edit_register_file.name=name;app._data.modal_edit_register_file.index=index;this.$root.$emit("bv::show::modal","edit_register_file",button)},delete_register_file_modal(index,button){app._data.modal_delete_register_file.title="Delete "+name;app._data.modal_delete_register_file.index=index;this.$root.$emit("bv::show::modal","delete_register_file",button)},new_register_modal(name,index,button){app._data.modal_new_register.register_file_index=index;app._data.modal_new_register.type=architecture.components[index].type;app._data.modal_new_register.double_precision=architecture.components[index].double_precision;app._data.modal_new_register.double_precision_type=architecture.components[index].double_precision_type;app._data.modal_new_register.simple_reg=[];for(var i=0;i"+"
"+' Register file of the architecture:'+""+'
'+'
'+' "+' '+" New Register File"+" "+"
"+""+'
'+' "+' '+" Reset Register Rile"+" "+"
"+""+"
"+""+""+" \x3c!-- Register File table --\x3e"+'
'+"
"+'
'+""+" \x3c!-- For each register file --\x3e"+' '+' '+' '+" {{item.name}}"+" "+" "+' '+" "+""+""+' '+" "+""+""+' '+' '+" New Register"+" "+""+' '+' '+" Edit Register File"+" "+""+' '+' '+" Delete Register File"+" "+" "+" "+" "+"
"+"
"+""};Vue.component("register-file-arch",uielto_register_file);var uielto_register_file_new={props:{id:{type:String,required:true}},data:function(){return{register_file_types:[{text:"Integer",value:"int_registers"},{text:"Floating point",value:"fp_registers"},{text:"Control",value:"ctrl_registers"}],double_precision_type:[{text:"Linked",value:"linked"},{text:"Extended",value:"extended"}],register_file:{name:"",type:"",precision:"",double_precision_type:""},show_modal:false}},methods:{verify_new_register_file(evt){evt.preventDefault();if(!this.register_file.name||!this.register_file.type){show_notification("Please complete all fields","danger")}else{if(this.register_file.precision.length>0){if(!this.register_file.double_precision_type){show_notification("Please complete all fields","danger");return}}for(var i=0;i0){precision=true}if(precision===false){this.register_file.double_precision_type=""}var new_register_file={name:this.register_file.name,type:this.register_file.type,double_precision:precision,double_precision_type:this.register_file.double_precision_type,elements:[]};architecture.components.push(new_register_file);var new_register_file_hash={name:this.register_file.name,index:architecture_hash.length};architecture_hash.push(new_register_file_hash);show_notification("Register file correctly created","success")},clean_form(){this.register_file.name="";this.register_file.type="";this.register_file.precision="";this.register_file.double_precision_type=""},valid(value){if(parseInt(value)!==0){if(!value){return false}else{return true}}else{return true}}},template:''+" "+' '+' '+" "+" "+""+' '+' '+" "+" "+""+" "+' '+' '+" Double Precision"+" "+" "+" "+""+' '+' '+" "+" "+""+" "+""};Vue.component("register-file-new",uielto_register_file_new);var uielto_register_file_reset={props:{id:{type:String,required:true},architecture_name:{type:String,required:true}},data:function(){return{}},methods:{reset_register_file(){show_loading();for(var i=0;i'+' Are you sure you want to reset the architecture?'+""};Vue.component("register-file-reset",uielto_register_file_reset);var uielto_register_file_edit={props:{id:{type:String,required:true},title:{type:String,required:true},name:{type:String,required:true},index:{type:Number,required:true}},data:function(){return{show_modal:false}},methods:{verify_edit_register_file(evt){evt.preventDefault();if(!this._props.name){show_notification("Please complete all fields","danger")}else{for(var i=0;i'+" "+' '+' '+" "+" "+" "+""};Vue.component("register-file-edit",uielto_register_file_edit);var uielto_register_file_delete={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true}},data:function(){return{}},methods:{delete_register_file(){architecture.components.splice(this._props.index,1);architecture_hash.splice(this._props.index,1);for(var j=0;j'+' Are you sure you want to delete the register file?'+""};Vue.component("register-file-delete",uielto_register_file_delete);var uielto_registers={props:{registers:{type:Array,required:true},register_file_index:{type:Number,required:true}},data:function(){return{registers_fields:["name","ID","nbits","default_value","properties","actions"]}},methods:{edit_register_modal(name,index,button){app._data.modal_edit_register.title="Edit "+name;app._data.modal_edit_register.register_file_index=this._props.register_file_index;app._data.modal_edit_register.register_index=index;if(architecture.components[this._props.register_file_index].double_precision_type=="linked"){app._data.modal_edit_register.simple_reg=[];for(var i=0;i"+""+" \x3c!-- For each register --\x3e"+""+' "+""+' "+""+' "+""+' "+""};Vue.component("registers",uielto_registers);var uielto_registers_new={props:{id:{type:String,required:true},register_file_index:{type:Number,required:true},type:{type:String,required:true},double_precision:{type:String,required:true},double_precision_type:{type:String,required:true},reg_id:{type:Number,required:true},simple_reg:{type:Array,required:true}},data:function(){return{register:{name:"",id:this._props.reg_id,type:"",default_value:"",properties:[],precision:""},show_modal:false}},methods:{new_register_verify(evt){evt.preventDefault();if(this.register.name.length===0||!this.register.name){show_notification("Please complete all fields","danger")}else{if(!this.register.default_value&&this._props.double_precision===false){show_notification("Please complete all fields","danger")}else if(isNaN(this.register.default_value)){show_notification("The default value must be a number","danger")}else{for(var i=0;i'+" "+' '+" "+" "+""+' '+' "+" "+" "+""+' "+' '+" "+" "+""+' '+' '+' Read'+' Write'+' Ignore Write'+' Saved'+"
"+"
"+' Program Counter'+' Global Pointer'+' Stack Pointer'+' Frame Pointer'+"
"+"
"+' Event Signal'+' Event Cause'+' Status Register'+' Exception Program Counter'+"
"+"
"+""+' '+'
'+'
'+" '+" "+"
"+'
'+" '+" "+"
"+"
"+"
"+"
"+""};Vue.component("registers-new",uielto_registers_new);var uielto_registers_edit={props:{id:{type:String,required:true},title:{type:String,required:true},register_file_index:{type:Number,required:true},register_index:{type:Number,required:true},type:{type:String,required:true},double_precision:{type:String,required:true},double_precision_type:{type:String,required:true},reg_id:{type:Number,required:true},simple_reg:{type:Array,required:true},register:{type:Object,required:true}},data:function(){return{show_modal:false}},methods:{edit_register_verify(evt){evt.preventDefault();if(this._props.register.name.length===0||!this._props.register.name||typeof this._props.register.default_value!=="undefined"&&!this._props.register.default_value.toString()){show_notification("Please complete all fields","danger")}else if(typeof this._props.register.default_value!=="undefined"&&isNaN(this._props.register.default_value.toString())){show_notification("The default value must be a number","danger")}else{for(var i=0;i'+" "+' '+" "+" "+""+' '+' "+" "+" "+""+' "+' '+" "+" "+""+' '+' '+' Read'+' Write'+' Ignore Write'+' Saved'+"
"+"
"+' Program Counter'+' Global Pointer'+' Stack Pointer'+' Frame Pointer'+"
"+"
"+' Event Signal'+' Event Cause'+' Status Register'+' Exception Program Counter'+"
"+" "+"
"+""+' '+'
'+'
'+" '+" "+"
"+'
'+" '+" "+"
"+"
"+"
"+"
"+""};Vue.component("registers-edit",uielto_registers_edit);var uielto_register_delete={props:{id:{type:String,required:true},title:{type:String,required:true},register_file_index:{type:Number,required:true},register_index:{type:Number,required:true}},data:function(){return{}},methods:{delete_register(){architecture.components[this._props.register_file_index].elements.splice(this._props.register_index,1);show_notification("Register correctly deleted","success")}},template:''+' Are you sure you want to delete the item?'+""};Vue.component("registers-delete",uielto_register_delete);var uielto_instructions={props:{instructions:{type:Array,required:true}},data:function(){return{instructions_fields:["name","co","cop","nwords","signatureRaw","properties","clk_cycles","fields","definition","actions"]}},methods:{view_instructions_modal(name,index,button){app._data.modal_field_instruction.title="Fields of "+name;app._data.modal_field_instruction.index=index;app._data.modal_field_instruction.instruction=structuredClone(architecture.instructions[index]);this.$root.$emit("bv::show::modal","fields_instructions",button)},edit_instructions_modal(name,index,button){app._data.modal_edit_instruction.title="Edit "+name;app._data.modal_edit_instruction.index=index;app._data.modal_edit_instruction.instruction=structuredClone(architecture.instructions[index]);app._data.modal_edit_instruction.number_fields=app._data.modal_edit_instruction.instruction.fields.length;this.$root.$emit("bv::show::modal","edit_instructions",button)},delete_instructions_modal(name,index,button){app._data.modal_delete_instruction.title="Delete "+name;app._data.modal_delete_instruction.index=index;this.$root.$emit("bv::show::modal","delete_instructions",button)}},template:"
"+"
"+' Instruction set:'+"
"+' "+' '+" New instruction"+" "+""+' "+' '+" Reset Instructions"+" "+""+" \x3c!-- Instruction set table --\x3e"+'
'+' '+""+" \x3c!-- Change the title of each column --\x3e"+' "+""+' "+""+" \x3c!-- For each instruction --\x3e"+""+' "+""+' "+""+' "+""+' "+""+' "+" "+"
"+"
"};Vue.component("instructions",uielto_instructions);var uielto_instructions_fields={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true},instruction:{type:Object,required:true}},data:function(){return{fragmet_data:["inm-signed","inm-unsigned","address","offset_bytes","offset_words"]}},methods:{},template:'"+" "+'
'+'
'+'
'+" "+"
"+'
'+' Name:'+"
"+'
'+' Type'+"
"+'
'+' Break'+"
"+'
'+' Start Bit'+"
"+'
'+' End Bit'+"
"+'
'+' Value'+"
"+"
"+""+"
"+'
'+'
'+'
'+' Field {{field_index}}'+"
"+'
'+" "+' '+" "+' '+" "+" "+"
"+""+'
'+" "+' '+" "+" "+"
"+'
"+" "+"
"+""+" \x3c!-- start bit description --\x3e"+'
'+" "+' '+" "+" '+" "+"
"+""+" \x3c!-- stop bit description --\x3e"+'
'+" "+' '+" "+' '+" "+" "+" "+"
"+""+'
'+" "+' '+" "+" "+"
"+'
'+" "+' '+" "+" "+"
"+"
"+"
"+"
"+"
"+"
"+"
"};Vue.component("instructions-fields",uielto_instructions_fields);var uielto_instructions_new={props:{id:{type:String,required:true}},data:function(){return{instructions_types:instructions_types=[{text:"Arithmetic floating point",value:"Arithmetic floating point"},{text:"Arithmetic integer",value:"Arithmetic integer"},{text:"Comparison",value:"Comparison"},{text:"Conditional bifurcation",value:"Conditional bifurcation"},{text:"Control",value:"Control"},{text:"Function call",value:"Function call"},{text:"I/O",value:"I/O"},{text:"Logic",value:"Logic"},{text:"Memory access",value:"Memory access"},{text:"Other",value:"Other"},{text:"Syscall",value:"Syscall"},{text:"Transfer between registers",value:"Transfer between registers"},{text:"Unconditional bifurcation",value:"Unconditional bifurcation"}],fragmet_data:["inm-signed","inm-unsigned","address","offset_bytes","offset_words"],number_fields:"1",instruction:{name:"",type:"",co:"",cop:"",nwords:1,help:"",properties:[],clk_cycles:1,separated:[],fields:[{name:"",type:"",startbit:"",stopbit:"",valueField:""}],signature:"",signatureRaw:"",signature_definition:"",definition:""},instruction_page:1,instruction_page_link:["#Principal","#Fields","#Syntax","#Definition","#Help"],show_modal:false}},methods:{new_instructions_verify(evt){evt.preventDefault();var empty=0;if(typeof this.instruction.co!=="object"){for(var i=0;iisNaN(val)))){show_notification("The field co must be numbers","danger");return}else if(isNaN(this.instruction.cop)){show_notification("The field cop must be numbers","danger");return}else if(typeof this.instruction.co!="object"&&this.instruction.co.length!=this.instruction.fields[0].startbit-this.instruction.fields[0].stopbit+1){show_notification("The length of co should be "+(this.instruction.fields[0].startbit-this.instruction.fields[0].stopbit+1)+" binary numbers","danger");return}else if(typeof this.instruction.co==="object"&&this.instruction.co.some(((val,ind)=>val.length!==app.instruction.fields[0].startbit[ind]-app.instruction.fields[0].stopbit[ind]+1))){show_notification("The length of co don't match with the desription","danger");return}else{var ex_cop=false;for(var i=1;ithis.instruction.co instanceof Array?this.formInstrucion.co.join(""):this.instruction.co)()+this.instruction.cop;for(var i=0;ithis.instruction.nwords*32){this.number_fields=this.instruction.nwords*32}if(this.number_fields<1){this.number_fields=1}if(this.number_fields>this.instruction.fields.length){var diff=this.number_fields-this.instruction.fields.length;for(var i=0;i'+" "+""+" \x3c!-- Page 1 --\x3e"+'
'+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+' Enter Subrutine'+' Exit Subrutine'+" "+" "+'
'+' '+" "+"
"+"
"+""+" \x3c!-- Page 2 --\x3e"+'
'+'
'+'
'+" "+"
"+'
'+' Name:'+"
"+'
'+' Type'+"
"+'
'+' Break'+"
"+'
'+' Start Bit'+"
"+'
'+' End Bit'+"
"+'
'+""+"
"+"
"+""+""+'
'+'
'+'
'+'
'+' Field {{i-1}}'+"
"+'
'+" "+' '+" "+' '+" "+" "+"
"+'
'+" "+' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+" "+' "+" "+" "+"
"+'
'+" '+"
"+'
'+" "+' '+" "+" '+" "+" "+"
"+'
'+" "+' '+" "+" '+" "+" "+"
"+'
'+" "+" '+" "+" "+" '+' '+" "+"
"+'
'+" "+' '+" "+" "+"
"+'
"+' '+" + "+" "+' '+" - "+" "+"
"+"
"+"
"+"
"+"
"+""+""+" \x3c!-- Page 3 --\x3e"+'
'+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 4 --\x3e"+'
'+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 5 --\x3e"+'
'+' '+' '+" "+" "+"
"+"
"+"
"+' '+" "+""};Vue.component("instructions-new",uielto_instructions_new);var uielto_instructions_reset={props:{id:{type:String,required:true},architecture_name:{type:String,required:true}},data:function(){return{}},methods:{reset_instructions(){show_loading();for(var i=0;i'+' Are you sure you want to reset the instructions?'+""};Vue.component("instructions-reset",uielto_instructions_reset);var uielto_instructions_edit={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true},instruction:{type:Object,required:true},number_fields:{type:Number,required:true}},data:function(){return{instructions_types:instructions_types=[{text:"Arithmetic floating point",value:"Arithmetic floating point"},{text:"Arithmetic integer",value:"Arithmetic integer"},{text:"Comparison",value:"Comparison"},{text:"Conditional bifurcation",value:"Conditional bifurcation"},{text:"Control",value:"Control"},{text:"Function call",value:"Function call"},{text:"I/O",value:"I/O"},{text:"Logic",value:"Logic"},{text:"Memory access",value:"Memory access"},{text:"Other",value:"Other"},{text:"Syscall",value:"Syscall"},{text:"Transfer between registers",value:"Transfer between registers"},{text:"Unconditional bifurcation",value:"Unconditional bifurcation"}],fragmet_data:["inm-signed","inm-unsigned","address","offset_bytes","offset_words"],instruction_page:1,instruction_page_link:["#Principal","#Fields","#Syntax","#Definition","#Help"],show_modal:false}},methods:{edit_instructions_verify(evt){evt.preventDefault();var empty=0;if(typeof this._props.instruction.co!=="object"){for(var i=0;iisNaN(val)))){show_notification("The field co must be numbers","danger");return}else if(isNaN(this._props.instruction.cop)){show_notification("The field cop must be numbers","danger");return}else if(typeof this._props.instruction.co!="object"&&this._props.instruction.co.length!=this._props.instruction.fields[0].startbit-this._props.instruction.fields[0].stopbit+1){show_notification("The length of co should be "+(this._props.instruction.fields[0].startbit-this._props.instruction.fields[0].stopbit+1)+" binary numbers","danger");return}else if(typeof this._props.instruction.co==="object"&&this._props.instruction.co.some(((val,ind)=>val.length!==app.instruction.fields[0].startbit[ind]-app.instruction.fields[0].stopbit[ind]+1))){show_notification("The length of co don't match with the desription","danger");return}else{var ex_cop=false;for(var i=1;ithis._props.instruction.co instanceof Array?this.formInstrucion.co.join(""):this._props.instruction.co)()+this._props.instruction.cop;for(var i=0;ithis._props.instruction.nwords*32){this._props.number_fields=this._props.instruction.nwords*32}if(this._props.number_fields<1){this._props.number_fields=1}if(this._props.number_fields>this._props.instruction.fields.length){var diff=this._props.number_fields-this._props.instruction.fields.length;for(var i=0;i'+" "+""+" \x3c!-- Page 1 --\x3e"+'
'+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+' Enter Subrutine'+' Exit Subrutine'+" "+" "+'
'+' '+"
"+""+"
"+""+" \x3c!-- Page 2 --\x3e"+'
'+'
'+'
'+" "+"
"+'
'+' Name:'+"
"+'
'+' Type'+"
"+'
'+' Break'+"
"+'
'+' Start Bit'+"
"+'
'+' End Bit'+"
"+'
'+""+"
"+"
"+""+""+'
'+'
'+'
'+'
'+' Field {{i-1}}'+"
"+'
'+" "+' '+" "+' '+" "+" "+"
"+'
'+" "+' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+" "+' "+" "+" "+"
"+'
'+" '+"
"+'
'+" "+' '+" "+" '+" "+" "+"
"+'
'+" "+' '+" "+" '+" "+" "+"
"+'
'+" "+" '+" "+" "+" '+' '+" "+"
"+'
'+" "+' '+" "+" "+"
"+'
"+' '+" + "+" "+' '+" - "+" "+"
"+"
"+"
"+"
"+"
"+""+" \x3c!-- Page 3 --\x3e"+'
'+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 4 --\x3e"+'
'+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 5 --\x3e"+'
'+' '+' '+" "+" "+"
"+"
"+"
"+' '+" "+""};Vue.component("instructions-edit",uielto_instructions_edit);var uielto_instructions_delete={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true}},data:function(){return{}},methods:{delete_instructions(){architecture.instructions.splice(this._props.index,1);show_notification("Instruction correctly deleted","success")}},template:''+' Are you sure you want to delete the item?'+""};Vue.component("instructions-delete",uielto_instructions_delete);var uielto_pseudoinstructions={props:{pseudoinstructions:{type:Array,required:true}},data:function(){return{pseudoinstructions_fields:["name","nwords","signatureRaw","fields","definition","actions"]}},methods:{view_pseudoinstruction_modal(name,index,button){app._data.modal_field_pseudoinstruction.title="Fields of "+name;app._data.modal_field_pseudoinstruction.index=index;app._data.modal_field_pseudoinstruction.pseudoinstruction=structuredClone(architecture.pseudoinstructions[index]);this.$root.$emit("bv::show::modal","fields_pseudoinstructions",button)},edit_pseudoinstruction_modal(name,index,button){app._data.modal_edit_pseudoinstruction.title="Edit "+name;app._data.modal_edit_pseudoinstruction.index=index;app._data.modal_edit_pseudoinstruction.pseudoinstruction=structuredClone(architecture.pseudoinstructions[index]);app._data.modal_edit_pseudoinstruction.number_fields=app._data.modal_edit_pseudoinstruction.pseudoinstruction.fields.length;this.$root.$emit("bv::show::modal","edit_pseudoinstructions",button)},delete_pseudoinstruction_modal(name,index,button){app._data.modal_delete_pseudoinstruction.title="Delete "+name;app._data.modal_delete_pseudoinstruction.index=index;this.$root.$emit("bv::show::modal","delete_pseudoinstructions",button)}},template:"
"+"
"+' Pseudoinstructions set:'+"
"+' "+' '+" New Pseudoinstructions"+" "+""+' "+' '+" Reset Pseudoinstructions"+" "+""+" \x3c!-- Pseudoinstruction set table --\x3e"+'
'+" '+""+" \x3c!-- Change the title of each column --\x3e"+' "+""+" \x3c!-- For each pseudoinstruction --\x3e"+""+' "+""+' "+""+' "+""+' "+" "+"
"+"
"};Vue.component("pseudoinstructions",uielto_pseudoinstructions);var uielto_pseudoinstructions_fields={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true},pseudoinstruction:{type:Object,required:true}},data:function(){return{}},methods:{},template:'"+" "+'
'+'
'+'
'+""+"
"+'
'+' Name:'+"
"+'
'+' Type'+"
"+"
"+""+"
"+'
'+'
'+'
'+' Field {{field_index}}'+"
"+'
'+" "+' '+" "+" "+"
"+'
'+" "+' '+" "+" "+"
"+"
"+"
"+"
"+"
"+"
"+"
"};Vue.component("pseudoinstructions-fields",uielto_pseudoinstructions_fields);var uielto_pseudoinstructions_new={props:{id:{type:String,required:true}},data:function(){return{number_fields:"0",pseudoinstruction:{name:"",help:"",properties:[],nwords:1,signature_definition:"",signature:"",signatureRaw:"",fields:[{name:"",type:""}],definition:""},pseudoinstruction_page:1,pseudoinstruction_page_link:["#Principal","#Fields","#Syntax","#Definition","#Help"],show_modal:false}},methods:{new_pseudoinstruction_verify(evt){evt.preventDefault();var empty=0;for(var i=0;ithis.pseudoinstruction.nwords*32){this.number_fields=this.pseudoinstruction.nwords*32}if(this.number_fields<0){this.number_fields=0}if(this.number_fields>this.pseudoinstruction.fields.length){var diff=this.number_fields-this.pseudoinstruction.fields.length;for(var i=0;i'+" "+""+" \x3c!-- Page 1 --\x3e"+'
'+' '+' '+" "+" "+""+' '+' '+" "+" "+""+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 2 --\x3e"+'
'+'
'+'
'+""+"
"+'
'+' Name:'+"
"+'
'+' Type'+"
"+"
"+""+'
'+'
'+'
'+'
'+' Field {{i-1}}'+"
"+'
'+" "+' '+" "+" "+"
"+'
'+" "+' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+" "+" "+"
"+"
"+"
"+"
"+"
"+""+" \x3c!-- Page 3 --\x3e"+'
'+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 4 --\x3e"+'
'+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 5 --\x3e"+'
'+' '+' '+" "+" "+"
"+""+"
"+"
"+' '+" "+""};Vue.component("pseudoinstructions-new",uielto_pseudoinstructions_new);var uielto_pseudoinstructions_reset={props:{id:{type:String,required:true},architecture_name:{type:String,required:true}},data:function(){return{}},methods:{reset_pseudoinstruction(){show_loading();for(var i=0;i'+' Are you sure you want to reset the pseudoinstructions?'+""};Vue.component("pseudoinstructions-reset",uielto_pseudoinstructions_reset);var uielto_pseudoinstructions_edit={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true},pseudoinstruction:{type:Object,required:true},number_fields:{type:Number,required:true}},data:function(){return{number_fields:"0",pseudoinstruction_page:1,pseudoinstruction_page_link:["#Principal","#Fields","#Syntax","#Definition","#Help"],show_modal:false}},methods:{edit_pseudoinstruction_verify(evt){evt.preventDefault();var empty=0;for(var i=0;ithis._props.pseudoinstruction.nwords*32){this._props.number_fields=this._props.pseudoinstruction.nwords*32}if(this._props.number_fields<0){this._props.number_fields=0}if(this._props.number_fields>this._props.pseudoinstruction.fields.length){var diff=this._props.number_fields-this._props.pseudoinstruction.fields.length;for(var i=0;i'+" "+""+" \x3c!-- Page 1 --\x3e"+'
'+' '+' '+" "+" "+""+' '+' '+" "+" "+""+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 2 --\x3e"+'
'+'
'+'
'+" "+"
"+'
'+' Name:'+"
"+'
'+' Type'+"
"+"
"+""+'
'+'
'+'
'+'
'+' Field {{i-1}}'+"
"+'
'+" "+' '+" "+" "+"
"+'
'+" "+' '+' '+' '+' '+' '+' '+' '+' '+' '+' '+" "+" "+"
"+"
"+"
"+"
"+"
"+" \x3c!-- Page 3 --\x3e"+'
'+' '+' '+" "+" "+' '+' '+" "+" "+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 4 --\x3e"+'
'+' '+' '+" "+" "+"
"+""+" \x3c!-- Page 5 --\x3e"+'
'+' '+' '+" "+" "+"
"+""+"
"+"
"+' '+" "+""};Vue.component("pseudoinstructions-edit",uielto_pseudoinstructions_edit);var uielto_pseudoinstructions_delete={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true}},data:function(){return{}},methods:{delete_pseudoinstruction(index){architecture.pseudoinstructions.splice(this._props.index,1);show_notification("Instruction correctly deleted","success")}},template:''+' Are you sure you want to delete the item?'+""};Vue.component("pseudoinstructions-delete",uielto_pseudoinstructions_delete);var uielto_directives={props:{directives:{type:Array,required:true}},data:function(){return{directivesFields:["name","action","size","actions"]}},methods:{edit_directive_modal(name,index,button){app._data.modal_edit_directive.title="Edit "+name;app._data.modal_edit_directive.index=index;app._data.modal_edit_directive.directive=Object.assign({},architecture.directives[index]);this.$root.$emit("bv::show::modal","edit_directive",button)},delete_directive_modal(name,index,button){app._data.modal_delete_directive.title="Delete "+name;app._data.modal_delete_directive.index=index;this.$root.$emit("bv::show::modal","delete_directive",button)}},template:"
"+"
"+' Directives set:'+""+'
'+'
'+' "+' '+" New Directive"+" "+"
"+""+'
'+' "+' '+" Reset Directives"+" "+"
"+"
"+""+'
'+" '+' "+" "+"
"+"
"};Vue.component("directives",uielto_directives);var uielto_directives_new={props:{id:{type:String,required:true}},data:function(){return{actionTypes:[{text:"Data Segment",value:"data_segment"},{text:"Code Segment",value:"code_segment"},{text:"Global Symbol",value:"global_symbol"},{text:"Byte",value:"byte"},{text:"Half Word",value:"half_word"},{text:"Word",value:"word"},{text:"Double Word",value:"double_word"},{text:"Float",value:"float"},{text:"Double",value:"double"},{text:"Space",value:"space"},{text:"ASCII not finished in null",value:"ascii_not_null_end"},{text:"ASCII finished in null",value:"ascii_null_end"},{text:"Align",value:"align"},{text:"Balign",value:"balign"}],directive:{name:"",action:"",size:null},show_modal:false}},methods:{verify_new_directive(evt){evt.preventDefault();if(!this.directive.name||!this.directive.action){show_notification("Please complete all fields","danger")}else{if(isNaN(parseInt(this.directive.size))&&(this.directive.action=="byte"||this.directive.action=="half_word"||this.directive.action=="word"||this.directive.action=="double_word"||this.directive.action=="float"||this.directive.action=="double"||this.directive.action=="space")){show_notification("Please complete all fields","danger")}else{for(var i=0;i'+" "+' '+' '+" "+" "+""+' '+' '+" "+" "+""+' "+' '+" "+" "+" "+""};Vue.component("directives-new",uielto_directives_new);var uielto_directives_reset={props:{id:{type:String,required:true},architecture_name:{type:String,required:true}},data:function(){return{}},methods:{reset_directives(){show_loading();for(var i=0;i'+' Are you sure you want to reset the directives set?'+""};Vue.component("directives-reset",uielto_directives_reset);var uielto_directives_edit={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true},directive:{type:Object,required:true}},data:function(){return{actionTypes:[{text:"Data Segment",value:"data_segment"},{text:"Code Segment",value:"code_segment"},{text:"Global Symbol",value:"global_symbol"},{text:"Byte",value:"byte"},{text:"Half Word",value:"half_word"},{text:"Word",value:"word"},{text:"Double Word",value:"double_word"},{text:"Float",value:"float"},{text:"Double",value:"double"},{text:"Space",value:"space"},{text:"ASCII not finished in null",value:"ascii_not_null_end"},{text:"ASCII finished in null",value:"ascii_null_end"},{text:"Align",value:"align"},{text:"Balign",value:"balign"}],show_modal:false}},methods:{verify_edit_directive(evt){evt.preventDefault();if(!this._props.directive.name||!this._props.directive.action){show_notification("Please complete all fields","danger")}else{if(isNaN(parseInt(this._props.directive.size))&&(this._props.directive.action=="byte"||this._props.directive.action=="half_word"||this._props.directive.action=="word"||this._props.directive.action=="double_word"||this._props.directive.action=="float"||this._props.directive.action=="double"||this._props.directive.action=="space")){show_notification("Please complete all fields","danger")}else{for(var i=0;i '+" "+' '+' '+" "+" "+' '+' '+" "+" "+' "+' '+" "+" "+" "+""};Vue.component("directives-edit",uielto_directives_edit);var uielto_directives_delete={props:{id:{type:String,required:true},title:{type:String,required:true},index:{type:Number,required:true}},data:function(){return{}},methods:{delete_directive(){architecture.directives.splice(this._props.index,1);show_notification("Directive correctly deleted","success")}},template:''+' Are you sure you want to delete the item?'+""};Vue.component("directives-delete",uielto_directives_delete);var uielto_load_assembly={props:{id:{type:String,required:true}},data:function(){return{load_assembly:""}},methods:{assembly_update(){if(code_assembly!=""){textarea_assembly_editor.setValue(code_assembly);show_notification(" The selected program has been loaded correctly","success")}else{show_notification("Please select one program","danger")}},read_assembly(e){show_loading();var file;var reader;var files=document.getElementById("assembly_file").files;for(var i=0;i'+" "+"

Please select the assembly file to be loaded

"+' '+" "+" "};Vue.component("load-assembly",uielto_load_assembly);var uielto_save_assembly={props:{id:{type:String,required:true}},data:function(){return{save_assembly:""}},methods:{assembly_save(){var textToWrite=textarea_assembly_editor.getValue();var textFileAsBlob=new Blob([textToWrite],{type:"text/plain"});var fileNameToSaveAs;if(this.save_assembly==""){fileNameToSaveAs="assembly.s"}else{fileNameToSaveAs=this.save_assembly+".s"}var downloadLink=document.createElement("a");downloadLink.download=fileNameToSaveAs;downloadLink.innerHTML="My Hidden Link";window.URL=window.URL||window.webkitURL;downloadLink.href=window.URL.createObjectURL(textFileAsBlob);downloadLink.onclick=destroyClickedElement;downloadLink.style.display="none";document.body.appendChild(downloadLink);downloadLink.click();this.save_assembly="";creator_ga("assembly","assembly.save","assembly.save")},debounce:_.debounce((function(param,e){console_log(param);console_log(e);e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var re=new RegExp("'","g");e=e.replace(re,'"');re=new RegExp("[\f]","g");e=e.replace(re,"\\f");re=new RegExp("[\n]","g");e=e.replace(re,"\\n");re=new RegExp("[\r]","g");e=e.replace(re,"\\r");re=new RegExp("[\t]","g");e=e.replace(re,"\\t");re=new RegExp("[\v]","g");e=e.replace(re,"\\v");if(e==""){this[param]=null;return}console_log("this."+param+"= '"+e+"'");eval("this."+param+"= '"+e+"'");app.$forceUpdate()}),getDebounceTime())},template:' '+" "+"

Please write the file name:

"+" '+" "+"
"};Vue.component("save-assembly",uielto_save_assembly);function getDebounceTime(){if(screen.width>768){return 500}else{return 1e3}}var uielto_examples={props:{id:{type:String,required:true},ref:{type:String,required:true},example_set_available:{type:Array,required:true},example_available:{type:Array,required:true},compile:{type:String,required:true},modal:{type:String,required:true}},data:function(){return{example_set:0,example_set_name:""}},methods:{get_example_set(){return this.example_set},load_example(url,compile){this.$root.$emit("bv::hide::modal",this._props.modal,"#closeExample");$.get(url,(function(data){code_assembly=data;if(compile=="false"){textarea_assembly_editor.setValue(code_assembly)}else{uielto_toolbar_btngroup.methods.assembly_compiler(code_assembly)}show_notification(" The selected example has been loaded correctly","success");creator_ga("send","event","example","example.loading","example.loading."+url)}))},change_example_set(value){this.example_set=value}},template:' "+" "+' '+" "+" "+" "+' '+' '+" {{item.text}}"+" "+" "+" "+' '+" There's no examples at the moment"+" "+" "+" "+" '+" {{item.name}}:"+' '+" "+" "+" "};Vue.component("examples",uielto_examples);var uielto_uri={props:{id:{type:String,required:true}},data:function(){return{uri:""}},methods:{make_uri(){this.uri=window.location.href.split("?")[0].split("#")[0]+"?architecture="+encodeURIComponent(app._data.architecture_name)+"&asm="+encodeURIComponent(textarea_assembly_editor.getValue())},copy_uri(){navigator.clipboard.writeText(this.uri)}},template:'"+" "+'
'+' '+"
"+' '+' Copy'+" "+"
"+"
"};Vue.component("make-uri",uielto_uri);var uielto_load_library={props:{id:{type:String,required:true}},data:function(){return{name_binary_load:""}},methods:{library_update(){if(code_binary.length!==0){update_binary=JSON.parse(code_binary);load_binary=true;$("#divAssembly").attr("class","col-lg-10 col-sm-12");$("#divTags").attr("class","col-lg-2 col-sm-12");$("#divTags").show();show_notification("The selected library has been loaded correctly","success")}else{show_notification("Please select one library","danger")}},library_load(e){var file;var reader;var files=document.getElementById("binary_file").files;for(var i=0;i'+" "+"

Please select the binary file to be loaded

"+' '+" "+" "};Vue.component("load-library",uielto_load_library);var uielto_save_library={props:{id:{type:String,required:true}},data:function(){return{name_binary_save:""}},methods:{library_save(){if(assembly_compiler()==-1){return}promise.then((message=>{if(message=="-1"){return}if(creator_memory_is_segment_empty(memory_hash[0])===false){show_notification("You can not enter data in a library","danger");return}for(var i=0;i