diff --git a/examples/microcode/mc-ep_mips.txt b/examples/microcode/mc-ep_mips.txt index 6acd117d9..033cf0003 100644 --- a/examples/microcode/mc-ep_mips.txt +++ b/examples/microcode/mc-ep_mips.txt @@ -145,7 +145,7 @@ and reg1 reg2 reg3 { } andi reg1 reg2 val { - co=111111, + co=001100, nwords=1, reg1=reg(25,21), reg2=reg(20,16), @@ -187,7 +187,7 @@ or reg1 reg2 reg3 { } ori reg1 reg2 val { - co=111111, + co=001101, nwords=1, reg1=reg(25,21), reg2=reg(20,16), @@ -246,7 +246,7 @@ xor reg1 reg2 reg3 { } xori reg1 reg2 val { - co=111111, + co=001110, nwords=1, reg1=reg(25,21), reg2=reg(20,16), @@ -309,7 +309,7 @@ slt reg1 reg2 reg3 { } slti reg1 reg2 val { - co=111111, + co=001010, nwords=1, reg1=reg(25,21), reg2=reg(20,16), @@ -378,7 +378,7 @@ addu reg1 reg2 reg3 { } addi reg1 reg2 val { - co=111111, + co=001000, nwords=1, reg1=reg(25,21), reg2=reg(20,16), @@ -402,7 +402,7 @@ addi reg1 reg2 val { } addiu reg1 reg2 val { - co=111111, + co=001001, nwords=1, reg1=reg(25,21), reg2=reg(20,16), @@ -882,7 +882,7 @@ lb reg1 (reg2) { } lb reg1 val(reg2) { - co=111111, + co=100000, nwords=1, reg1 = reg(25,21), val = inm(15,0), @@ -913,7 +913,7 @@ lb reg1 val(reg2) { } lbu reg1 (reg2) { - co=111111, + co=100100, nwords=1, reg1 = reg(25,21), reg2 = reg(20,16), @@ -965,7 +965,7 @@ sb reg1 (reg2) { } sb reg1 val(reg2) { - co=111111, + co=101000, nwords=1, reg1 = reg(25,21), val = inm(15,0), @@ -1018,7 +1018,7 @@ lw reg1 (reg2) { } lw reg1 val(reg2) { - co=111111, + co=100011, nwords=1, reg1 = reg(25,21), val = inm(15,0), @@ -1116,7 +1116,7 @@ out reg val { # beq reg1 reg2 offset { - co=111111, + co=000100, nwords=1, reg1=reg(25,21), reg2=reg(20,16), @@ -1145,7 +1145,7 @@ beq reg1 reg2 offset { } bne reg1 reg2 offset { - co=111111, + co=000101, nwords=1, reg1=reg(25,21), reg2=reg(20,16), @@ -1295,7 +1295,7 @@ ble reg reg offset { # j addr { - co=111111, + co=000010, nwords=1, addr=address(15,0)abs, help='pc = addr', @@ -1311,7 +1311,7 @@ j addr { } jal addr { - co=111111, + co=000011, nwords=1, addr=address(15,0)abs, help='$ra = pc; pc = addr', diff --git a/sim_sw/sim_lang_asm.js b/sim_sw/sim_lang_asm.js index 79738fdc4..676c0d648 100644 --- a/sim_sw/sim_lang_asm.js +++ b/sim_sw/sim_lang_asm.js @@ -1380,12 +1380,23 @@ function read_text ( context, datosCU, ret ) // ref has the associated information in firmware for this instruction var ref = firmware[instruction][candidate] ; + var new_ref = ref ; while (false === ref.isPseudoinstruction) { - var ref = datosCU.cocop_hash[firmware[instruction][candidate].co] ; - if (ref.withcop) - ref = ref[firmware[instruction][candidate].cop] ; - else ref = ref.i ; + var new_ref = datosCU.cocop_hash[firmware[instruction][candidate].co] ; + if (new_ref.withcop) + new_ref = new_ref[firmware[instruction][candidate].cop] ; + else new_ref = new_ref.i ; + + // =0&&sim.systems.length>=newActive){sim.active=sim.systems[newActive];sim.index=newActive}compile_behaviors();firedep_to_fireorder(jit_fire_dep);compute_references();compile_verbals()}function simhw_getIdByName(short_name){for(var m=0;m>>0).toString(16)}function check_behavior(){if(0==simhw_sim_signals().length){ws_alert("ALERT: empty signals!!!")}if(0==simhw_sim_states().length){ws_alert("ALERT: empty states!!!")}for(var key in simhw_sim_signals()){for(var key2 in simhw_sim_signal(key).behavior){var behaviors=simhw_sim_signal(key).behavior[key2].split(";");for(var i=0;i "+behavior_k[0]+" ("+behavior_i+")");return}if(behavior_k.length!=simhw_syntax_behavior(behavior_k[0]).nparameters){ws_alert("ALERT: Behavior has an incorrect number of elements --\x3e "+behavior_i+"/"+simhw_syntax_behavior(behavior_k[0]).nparameters);return}for(var j=1;j '"+behavior_i);return}else if("S"==t&&typeof simhw_sim_signal(s[0])=="undefined"){ws_alert("ALERT: Behavior has an undefined reference to a signal -> '"+behavior_i);return}else if("X"==t&&typeof simhw_sim_state(s[0])=="undefined"&&typeof simhw_sim_signal(s[0])=="undefined"){ws_alert("ALERT: Behavior has an undefined reference to a object state OR signal -> '"+behavior_i);return}}}}}}var jit_behaviors=false;var jit_verbals=false;var jit_fire_dep=null;var jit_fire_order=null;var jit_dep_network=null;var jit_fire_ndep=null;function firedep_to_fireorder(jit_fire_dep){var allfireto=false;jit_fire_order=[];jit_fire_ndep=[];for(var sig in simhw_sim_signals()){if(typeof jit_fire_dep[sig]=="undefined"){jit_fire_order.push(sig);continue}ndep=0;allfireto=false;for(var sigorg in jit_fire_dep[sig]){ndep++;if(jit_fire_dep[sig][sigorg]==simhw_sim_signal(sigorg).behavior.length){allfireto=true}}jit_fire_ndep[sig]=ndep;if(allfireto==false)jit_fire_order.push(sig)}}function compile_behaviors(){var jit_bes="";jit_fire_dep={};var sig_obj=null;var expr_obj=null;for(var sig in simhw_sim_signals()){jit_bes+="simhw_sim_signal('"+sig+"').behavior_fn = new Array();\n";for(var val in simhw_sim_signal(sig).behavior){var input_behavior=simhw_sim_signal(sig).behavior[val];var jit_be="";var s_exprs=input_behavior.split(";");for(var i=0;i>>0;if(value!=0){vec.CPU["R"+i]={type:"register",default_value:0,id:"R"+i,op:"=",value:"0x"+value.toString(16)}}}for(i=0;i>>0;if(value!=0){vec.CPU[internal_reg[i]]={type:"register",default_value:0,id:internal_reg[i],op:"=",value:"0x"+value.toString(16)}}}return vec},read_state:function(vec,check){if(typeof vec.CPU=="undefined"){vec.CPU={}}var key=check["id"].toUpperCase().trim();var val=parseInt(check["value"]).toString(16);if("REGISTER"==check["type"].toUpperCase().trim()){vec.CPU[key]={type:"register",default_value:0,id:key,op:check["condition"],value:"0x"+val};return true}return false},get_state:function(reg){var r_reg=reg.toUpperCase().trim();if(typeof sim.ep.states["REG_"+r_reg]!="undefined"){var value=get_value(sim.ep.states["REG_"+r_reg])>>>0;return"0x"+value.toString(16)}r_reg=r_reg.replace("R","");var index=parseInt(r_reg);if(typeof sim.ep.states.BR[index]!="undefined"){var value=get_value(sim.ep.states.BR[index])>>>0;return"0x"+value.toString(16)}return null},get_value:function(elto){if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index))return get_value(simhw_sim_state(elto))>>>0;return get_value(simhw_sim_states().BR[index])>>>0},set_value:function(elto,value){var pc_name=simhw_sim_ctrlStates_get().pc.state;if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index)){set_value(simhw_sim_state(elto),value);if(pc_name===elto){show_asmdbg_pc()}return value}return set_value(simhw_sim_states().BR[index],value)}};sim.ep.ctrl_states.pc={name:"PC",state:"REG_PC",is_pointer:true};sim.ep.ctrl_states.sp={name:"SP",state:"BR.29",is_pointer:true};sim.ep.ctrl_states.fp={name:"FP",state:"BR.30",is_pointer:true};sim.ep.ctrl_states.ir={name:"IR",state:"REG_IR",default_eltos:{co:{begin:0,end:5,length:6},cop:{begin:28,end:31,length:4}},is_pointer:false};sim.ep.ctrl_states.mpc={name:"mPC",state:"REG_MICROADDR",is_pointer:false};sim.ep.internal_states.MC={};sim.ep.internal_states.ROM={};sim.ep.internal_states.FIRMWARE={};sim.ep.internal_states.io_hash={};sim.ep.internal_states.fire_stack=[];sim.ep.internal_states.tri_state_names=["T1","T2","T3","T4","T5","T6","T7","T8","T9","T10","T11"];sim.ep.internal_states.fire_visible={databus:false,internalbus:false};sim.ep.internal_states.filter_states=["REG_IR_DECO,col-12","REG_IR,col-auto","REG_PC,col-auto","REG_MAR,col-auto","REG_MBR,col-auto","REG_RT1,col-auto","REG_RT2,col-auto","REG_RT3,col-auto","REG_SR,col-auto","REG_MICROADDR,col-auto"];sim.ep.internal_states.filter_signals=["A0,0","B,0","C,0","SELA,5","SELB,5","SELC,2","SELCOP,0","MR,0","MC,0","C0,0","C1,0","C2,0","C3,0","C4,0","C5,0","C6,0","C7,0","T1,0","T2,0","T3,0","T4,0","T5,0","T6,0","T7,0","T8,0","T9,0","T10,0","T11,0","M1,0","M2,0","M7,0","MA,0","MB,0","SELP,0","LC,0","SE,0","SIZE,0","OFFSET,0","BW,0","R,0","W,0","TA,0","TD,0","IOR,0","IOW,0","TEST_I,0","TEST_U,0"];sim.ep.internal_states.alu_flags={flag_n:0,flag_z:0,flag_v:0,flag_c:0};sim.ep.states.BR=[];sim.ep.states.BR[0]={name:"R0",verbal:"Register 0",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[1]={name:"R1",verbal:"Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[2]={name:"R2",verbal:"Register 2",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[3]={name:"R3",verbal:"Register 3",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[4]={name:"R4",verbal:"Register 4",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[5]={name:"R5",verbal:"Register 5",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[6]={name:"R6",verbal:"Register 6",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[7]={name:"R7",verbal:"Register 7",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[8]={name:"R8",verbal:"Register 8",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[9]={name:"R9",verbal:"Register 9",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[10]={name:"R10",verbal:"Register 10",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[11]={name:"R11",verbal:"Register 11",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[12]={name:"R12",verbal:"Register 12",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[13]={name:"R13",verbal:"Register 13",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[14]={name:"R14",verbal:"Register 14",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[15]={name:"R15",verbal:"Register 15",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[16]={name:"R16",verbal:"Register 16",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[17]={name:"R17",verbal:"Register 17",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[18]={name:"R18",verbal:"Register 18",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[19]={name:"R19",verbal:"Register 19",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[20]={name:"R20",verbal:"Register 20",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[21]={name:"R21",verbal:"Register 21",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[22]={name:"R22",verbal:"Register 22",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[23]={name:"R23",verbal:"Register 23",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[24]={name:"R24",verbal:"Register 24",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[25]={name:"R25",verbal:"Register 25",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[26]={name:"R26",verbal:"Register 26",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[27]={name:"R27",verbal:"Register 27",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[28]={name:"R28",verbal:"Register 28",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[29]={name:"R29",verbal:"Register 29",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[30]={name:"R30",verbal:"Register 30",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[31]={name:"R31",verbal:"Register 31",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_PC"]={name:"PC",verbal:"Program Counter Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MAR"]={name:"MAR",verbal:"Memory Address Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MBR"]={name:"MBR",verbal:"Memory Data Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_IR"]={name:"IR",verbal:"Instruction Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT1"]={name:"RT1",verbal:"Temporal 1 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT2"]={name:"RT2",verbal:"Temporal 2 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT3"]={name:"RT3",verbal:"Temporal 3 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_SR"]={name:"SR",verbal:"State Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_IB"]={name:"I_BUS",verbal:"Internal Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_AB"]={name:"A_BUS",verbal:"Address Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_CB"]={name:"C_BUS",verbal:"Control Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_DB"]={name:"D_BUS",verbal:"Data Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["C2_T2"]={name:"C2_T2",verbal:"Output of PC",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["RA_T9"]={name:"RA_T9",verbal:"Input of T9 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["RB_T10"]={name:"RB_T10",verbal:"Input of T10 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["SELEC_T3"]={name:"SELEC_T3",verbal:"Input of T3 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["SELP_M7"]={name:"SELP_M7",verbal:"Output of MUX SelP",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["ALU_C6"]={name:"ALU_C6",verbal:"Input of Temporal 3 Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["MA_ALU"]={name:"MA_ALU",verbal:"Input ALU via MA",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["MB_ALU"]={name:"MB_ALU",verbal:"Input ALU via MB",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_C"]={name:"FLAG_C",verbal:"Carry Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_V"]={name:"FLAG_V",verbal:"Overflow Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_N"]={name:"FLAG_N",verbal:"Negative Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_Z"]={name:"FLAG_Z",verbal:"Zero Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_I"]={name:"FLAG_I",verbal:"Interruption Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_U"]={name:"FLAG_U",verbal:"User Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MICROADDR"]={name:"µADDR",verbal:"Microaddress Register",visible:true,nbits:"12",value:0,default_value:0,draw_data:["svg_cu:text4667"]};sim.ep.states["REG_MICROINS"]={name:"µINS",verbal:"Microinstruction Register",visible:true,nbits:"77",value:{},default_value:{},draw_data:[]};sim.ep.states["FETCH"]={name:"FETCH",verbal:"Input Fetch",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["ROM_MUXA"]={name:"ROM_MUXA",verbal:"Input ROM",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["SUM_ONE"]={name:"SUM_ONE",verbal:"Input next microinstruction",visible:false,nbits:"12",value:1,default_value:1,draw_data:[]};sim.ep.states["MUXA_MICROADDR"]={name:"MUXA_MICROADDR",verbal:"Input microaddress",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["MUXC_MUXB"]={name:"MUXC_MUXB",verbal:"Output of MUX C",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["INEX"]={name:"INEX",verbal:"Illegal Instruction Exception",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["BS_M1"]={name:"BS_M1",verbal:"from Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BS_TD"]={name:"BS_TD",verbal:"Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["INTV"]={name:"INTV",verbal:"Interruption Vector",visible:false,nbits:"8",value:0,default_value:0,draw_data:[]};sim.ep.states["M2_C2"]={name:"M2_C2",verbal:"Input of Program Counter",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["M1_C1"]={name:"M1_C1",verbal:"Input of Memory Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["M7_C7"]={name:"M7_C7",verbal:"Input of State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["VAL_ZERO"]={name:"VAL_ZERO",verbal:"Wired Zero",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["VAL_ONE"]={name:"VAL_ONE",verbal:"Wired One",visible:false,nbits:"32",value:1,default_value:1,draw_data:[]};sim.ep.states["VAL_FOUR"]={name:"VAL_FOUR",verbal:"Wired Four",visible:false,nbits:"32",value:4,default_value:4,draw_data:[]};sim.ep.states["REG_IR_DECO"]={name:"IR_DECO",verbal:"Instruction Decoded",visible:true,nbits:"0",value:0,default_value:0,draw_data:[]};sim.ep.states["DECO_INS"]={name:"DECO_INS",verbal:"Instruction decoded in binary",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["CLK"]={name:"CLK",verbal:"Clock",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["ACC_TIME"]={name:"ACC_TIME",verbal:"Accumulated CPU time",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals["C"]={name:"C",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["MV MUXC_MUXB VAL_ZERO; FIRE B","MBIT MUXC_MUXB INT 0 1; FIRE B","MBIT MUXC_MUXB IORDY 0 1; FIRE B","MBIT MUXC_MUXB MRDY 0 1; FIRE B","MBIT MUXC_MUXB REG_SR 0 1; FIRE B","MBIT MUXC_MUXB REG_SR 1 1; FIRE B","MBIT MUXC_MUXB REG_SR 28 1; FIRE B","MBIT MUXC_MUXB REG_SR 29 1; FIRE B","MBIT MUXC_MUXB REG_SR 30 1; FIRE B","MBIT MUXC_MUXB REG_SR 31 1; FIRE B","MV MUXC_MUXB INEX; FIRE B"],fire_name:["svg_cu:text3410"],draw_data:[["svg_cu:path3108"],["svg_cu:path3062"],["svg_cu:path3060"],["svg_cu:path3136"],["svg_cu:path3482"],["svg_cu:path3480"],["svg_cu:path3488"],["svg_cu:path3486"],["svg_cu:path3484"],["svg_cu:path3484-9"],["svg_cu:path3108-3","svg_cu:path3260-3-8-6","svg_cu:path3260-3-8","svg_cu:path3260-3"]],draw_name:[["svg_cu:path3496","svg_cu:path3414","svg_cu:path3194-08"]]};sim.ep.signals["B"]={name:"B",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV A1 MUXC_MUXB; FIRE A1","NOT_ES A1 MUXC_MUXB; FIRE A1"],depends_on:["CLK"],fire_name:["svg_cu:text3408"],draw_data:[["svg_cu:path3094-7"],["svg_cu:path3392","svg_cu:path3372","svg_cu:path3390","svg_cu:path3384","svg_cu:path3108-1","svg_cu:path3100-8-7"]],draw_name:[[],["svg_cu:path3194-0","svg_cu:path3138-8","svg_cu:path3498-6"]]};sim.ep.signals["A0"]={name:"A0",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 1; FIRE A0A1","SBIT_SIGNAL A0A1 1 1; FIRE A0A1"],depends_on:["CLK"],fire_name:["svg_cu:text3406"],draw_data:[["svg_cu:path3096"],["svg_cu:path3096"]],draw_name:[[],["svg_cu:path3138-8-1","svg_cu:path3098-2","svg_cu:path3124-2-5"]]};sim.ep.signals["A1"]={name:"A1",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 0; FIRE A0A1","SBIT_SIGNAL A0A1 1 0; FIRE A0A1"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3094"],["svg_cu:path3094"]],draw_name:[[]]};sim.ep.signals["A0A1"]={name:"A0A1",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["PLUS1 MUXA_MICROADDR REG_MICROADDR","CP_FIELD MUXA_MICROADDR REG_MICROINS/MADDR","MV MUXA_MICROADDR ROM_MUXA","MV MUXA_MICROADDR FETCH"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3102","svg_cu:path3100","svg_cu:path3098","svg_cu:path3100-9","svg_cu:path3088"],["svg_cu:path3104","svg_cu:path3134","svg_cu:path3500","svg_cu:path3416"],["svg_cu:path3504","svg_cu:path3100-8","svg_cu:path3234-9"],["svg_cu:path3124"]],draw_name:[[]]};sim.ep.signals["C0"]={name:"C0",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_MAR BUS_IB"],fire_name:["svg_p:text3077"],draw_data:[["svg_p:path3081"]],draw_name:[["svg_p:path3075"]]};sim.ep.signals["C1"]={name:"C1",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_MBR M1_C1"],fire_name:["svg_p:text3079"],draw_data:[["svg_p:path3055"]],draw_name:[["svg_p:path3073"]]};sim.ep.signals["C2"]={name:"C2",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_PC M2_C2; UPDATEDPC"],fire_name:["svg_p:text3179"],draw_data:[["svg_p:path3485"]],draw_name:[["svg_p:path3177"]]};sim.ep.signals["C3"]={name:"C3",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_IR BUS_IB; DECO; FIRE_IFSET C 10"],fire_name:["svg_p:text3439"],draw_data:[["svg_p:path3339"]],draw_name:[["svg_p:path3337"]]};sim.ep.signals["C4"]={name:"C4",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT1 BUS_IB"],fire_name:["svg_p:text3441"],draw_data:[["svg_p:path3263"]],draw_name:[["svg_p:path3255"]]};sim.ep.signals["C5"]={name:"C5",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT2 BUS_IB"],fire_name:["svg_p:text3443"],draw_data:[["svg_p:path3277"]],draw_name:[["svg_p:path3269"]]};sim.ep.signals["C6"]={name:"C6",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT3 ALU_C6"],fire_name:["svg_p:text3445"],draw_data:[["svg_p:path3325","svg_p:path3323"]],draw_name:[["svg_p:path3245"]]};sim.ep.signals["C7"]={name:"C7",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_SR M7_C7; FIRE C"],fire_name:["svg_p:text3655"],draw_data:[["svg_p:path3651-9"]],draw_name:[["svg_p:path3681"]]};sim.ep.signals["TA"]={name:"TA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_AB REG_MAR; MOVE_BITSE A1A0 0 2 BUS_AB 0; FIRE_IFCHANGED A1A0 A1A0"],fire_name:["svg_p:text3091"],draw_data:[["svg_p:path3089","svg_p:path3597","svg_p:path3513","svg_p:path3601","svg_p:path3601-2","svg_p:path3187","svg_p:path3087","svg_p:path2995","svg_p:path3535"]],draw_name:[["svg_p:path3085"]]};sim.ep.signals["TD"]={name:"TD",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_DB BS_TD; MOVE_BITSE A1A0 0 2 BUS_AB 0; FIRE_IFCHANGED A1A0 A1A0"],fire_name:["svg_p:text3103"],draw_data:[["svg_p:path3101","svg_p:path3587","svg_p:path3515","svg_p:path3071","svg_p:path3419","svg_p:path3099","svg_p:path3097","svg_p:path3559-5","svg_p:path3419-1-0","svg_p:path3583","svg_p:path3419-1","svg_p:path3491","svg_p:path3641","svg_p:path3541"]],draw_name:[["svg_p:path3095"]]};sim.ep.signals["T1"]={name:"T1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_MBR; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3105"],draw_data:[["svg_p:path3071","svg_p:path3069","svg_p:path3049","svg_p:path3063-9","svg_p:path3071","svg_p:path3071"]],draw_name:[["svg_p:path3067"]]};sim.ep.signals["T2"]={name:"T2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_PC; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3449"],draw_data:[["svg_p:path3199","svg_p:path3201","svg_p:path3049"]],draw_name:[["svg_p:path3329"]]};sim.ep.signals["T3"]={name:"T3",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB SELEC_T3; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3451"],draw_data:[["svg_p:path3349","svg_p:path3931","svg_p:path3345","svg_p:path3049"]],draw_name:[["svg_p:path3351"]]};sim.ep.signals["T4"]={name:"T4",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT1; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3453"],draw_data:[["svg_p:path3261","svg_p:path3259","svg_p:path3049"]],draw_name:[["svg_p:path3305"]]};sim.ep.signals["T5"]={name:"T5",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT2; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3455"],draw_data:[["svg_p:path3275","svg_p:path3273","svg_p:path3049"]],draw_name:[["svg_p:path3307"]]};sim.ep.signals["T6"]={name:"T6",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB ALU_C6; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3457"],draw_data:[["svg_p:path3589","svg_p:path3317","svg_p:path3163-2","svg_p:path3049"]],draw_name:[["svg_p:path3319"]]};sim.ep.signals["T7"]={name:"T7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT3; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3459"],draw_data:[["svg_p:path3327","svg_p:path3311","svg_p:path3049"]],draw_name:[["svg_p:path3313"]]};sim.ep.signals["T8"]={name:"T8",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_SR; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3657"],draw_data:[["svg_p:path3651","svg_p:path3647","svg_p:path3049"]],draw_name:[["svg_p:path3649"]]};sim.ep.signals["T9"]={name:"T9",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RA_T9; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3147"],draw_data:[["svg_p:path3143","svg_p:path3139","svg_p:path3049","svg_p:path3143-9"]],draw_name:[["svg_p:path3133"]]};sim.ep.signals["T10"]={name:"T10",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RB_T10; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3149"],draw_data:[["svg_p:path3145","svg_p:path3141","svg_p:path3049","svg_p:path3145-5"]],draw_name:[["svg_p:path3137"]]};sim.ep.signals["T11"]={name:"T11",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","CP_FIELD BUS_IB REG_MICROINS/EXCODE; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3147-5","svg_cu:tspan4426"],draw_data:[["svg_p:path3145","svg_p:path3081-3","svg_p:path3139-7","svg_p:path3049","svg_cu:path3081-3","svg_cu:path3139-7","svg_cu:path3502"]],draw_name:[["svg_p:path3133-6","svg_cu:path3133-6"]]};sim.ep.signals["M1"]={name:"M1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M1_C1 BUS_IB","MV M1_C1 BS_M1"],depends_on:["C1"],fire_name:["svg_p:text3469"],draw_data:[["svg_p:path3063","svg_p:path3061","svg_p:path3059"],["svg_p:path3057","svg_p:path3641","svg_p:path3419","svg_p:path3583"]],draw_name:[[],["svg_p:path3447"]]};sim.ep.signals["M2"]={name:"M2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M2_C2 BUS_IB","PLUS4 M2_C2 REG_PC"],depends_on:["C2"],fire_name:["svg_p:text3471"],draw_data:[["svg_p:path3217","svg_p:path3215","svg_p:path3213","svg_p:path3213-9"],["svg_p:path3211","svg_p:path3209","svg_p:path3193","svg_p:path3207","svg_p:path3197","svg_p:path3201"]],draw_name:[[],["svg_p:path3467","svg_p:path3467"]]};sim.ep.signals["M7"]={name:"M7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M7_C7 BUS_IB","MV M7_C7 SELP_M7"],depends_on:["C7"],fire_name:["svg_p:text3673"],draw_data:[["svg_p:path3691","svg_p:path3693","svg_p:path3659"],["svg_p:path3695"]],draw_name:[[],["svg_p:path3667"]]};sim.ep.signals["MA"]={name:"MA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MA_ALU RA_T9; FIRE COP","MV MA_ALU REG_RT1; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3463"],draw_data:[["svg_p:path3249","svg_p:path3161","svg_p:path3165"],["svg_p:path3279"]],draw_name:[[],["svg_p:path3423"]]};sim.ep.signals["MB"]={name:"MB",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MV MB_ALU RB_T10; FIRE COP","MV MB_ALU REG_RT2; FIRE COP","MV MB_ALU VAL_FOUR; FIRE COP","MV MB_ALU VAL_ONE; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3465"],draw_data:[["svg_p:path3281","svg_p:path3171","svg_p:path3169"],["svg_p:path3283"],["svg_p:path3295","svg_p:path3293"],["svg_p:path3297","svg_p:path3299"]],draw_name:[[],["svg_p:path3425","svg_p:path3427"]]};sim.ep.signals["COP"]={name:"COP",visible:true,type:"L",value:0,default_value:0,nbits:"4",forbidden:true,behavior:["NOP_ALU; UPDATE_NZVC","AND ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","OR ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","NOT ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","XOR ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SRL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SRA ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","RR ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","RL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","ADD ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SUB ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","MUL ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","DIV ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","MOD ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","LUI ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3"],depends_on:["SELCOP"],fire_name:["svg_p:text3303"],draw_data:[["svg_p:path3237","svg_p:path3239","svg_p:path3261-8","svg_p:path3321","svg_p:path3901-6","svg_p:path3317-9"]],draw_name:[["svg_p:path3009","svg_p:path3301"]]};sim.ep.signals["SELP"]={name:"SELP",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["NOP","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_U 0; FIRE M7","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_I 1; FIRE M7","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_C 31; UPDATE_FLAG SELP_M7 FLAG_V 30; UPDATE_FLAG SELP_M7 FLAG_N 29; UPDATE_FLAG SELP_M7 FLAG_Z 28; FIRE M7"],fire_name:["svg_p:text3703"],draw_data:[[],["svg_p:path3643"],["svg_p:path3705"],["svg_p:path3675","svg_p:path3331"]],draw_name:[[],["svg_p:path3697"]]};sim.ep.signals["SELA"]={name:"SELA",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RA"],depends_on:["RA"],fire_name:["svg_cu:text3164"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELB"]={name:"SELB",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RB"],depends_on:["RB"],fire_name:["svg_cu:text3168"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELC"]={name:"SELC",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RC"],depends_on:["RC"],fire_name:["svg_cu:text3172"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELCOP"]={name:"SELCOP",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE MC"],depends_on:["COP"],fire_name:["svg_cu:text3312"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["EXCODE"]={name:"EXCODE",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE T11"],fire_name:["svg_cu:text3312-6"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["RA"]={name:"RA",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["GET RA_T9 BR RA; FIRE_IFSET T9 1; FIRE_IFSET MA 0"],depends_on:["SELA"],fire_name:["svg_p:text3107"],draw_data:[[]],draw_name:[["svg_p:path3109"]]};sim.ep.signals["RB"]={name:"RB",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["GET RB_T10 BR RB; FIRE_IFSET T10 1; FIRE_IFSET MB 0"],depends_on:["SELB"],fire_name:["svg_p:text3123"],draw_data:[[]],draw_name:[["svg_p:path3113"]]};sim.ep.signals["RC"]={name:"RC",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["FIRE LC"],depends_on:["SELC"],fire_name:["svg_p:text3125"],draw_data:[[]],draw_name:[["svg_p:path3117"]]};sim.ep.signals["LC"]={name:"LC",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","SET BR RC BUS_IB"],fire_name:["svg_p:text3127"],draw_data:[["svg_p:path3153","svg_p:path3151","svg_p:path3129"]],draw_name:[["svg_p:path3121"]]};sim.ep.signals["SE"]={name:"SE",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3; MOVE_BITS SBWA 4 1 SE; FIRE_IFCHANGED SBWA SE","MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3; MOVE_BITS SBWA 4 1 SE; FIRE_IFCHANGED SBWA SE"],depends_on:["T3"],fire_name:["svg_p:text3593","svg_p:text3431"],draw_data:[[]],draw_name:[["svg_p:path3591","svg_p:path3447-7-7"]]};sim.ep.signals["SIZE"]={name:"SIZE",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3363"],draw_data:[[]],draw_name:[["svg_p:path3355"]]};sim.ep.signals["OFFSET"]={name:"OFFSET",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3707"],draw_data:[[]],draw_name:[["svg_p:path3359"]]};sim.ep.signals["MC"]={name:"MC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT COP REG_IR 0 4; FIRE COP;","CP_FIELD COP REG_MICROINS/SELCOP; FIRE COP;"],depends_on:["SELCOP"],fire_name:["svg_cu:text3322","svg_cu:text3172-1-5"],draw_data:[["svg_cu:path3320","svg_cu:path3142"],["svg_cu:path3318","svg_cu:path3502-6","svg_cu:path3232-6"]],draw_name:[[],["svg_cu:path3306"]]};sim.ep.signals["MR"]={name:"MR",verbal:["Copy from IR[SelA], from IR[SelB], and from IR[SelB] into RA, RB, and RC. ","Copy SelA, SelB, and SelB into RA, RB, and RC. "],visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MR_RA MR; FIRE MR_RA; MV MR_RB MR; FIRE MR_RB; MV MR_RC MR; FIRE MR_RC;","MV MR_RA MR; FIRE MR_RA; MV MR_RB MR; FIRE MR_RB; MV MR_RC MR; FIRE MR_RC;"],depends_on:["SELA","SELB","SELC"],fire_name:["svg_cu:text3222","svg_cu:text3242","svg_cu:text3254","svg_cu:text3172-1"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3260","svg_cu:path3196","svg_cu:path3278","svg_cu:path3232","svg_cu:path3292"],["svg_cu:path3270","svg_cu:path3282","svg_cu:path3300","svg_cu:path3258","svg_cu:path3260","svg_cu:path3258-4","svg_cu:path3278","svg_cu:path3196","svg_cu:path3294","svg_cu:path3292","svg_cu:path3288","svg_cu:path3232","svg_cu:path3280"]],draw_name:[[],["svg_cu:path3220","svg_cu:path3240","svg_cu:path3252"]]};sim.ep.signals["MR_RA"]={name:"MR_RA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RA REG_IR REG_MICROINS/SELA 5; FIRE RA;","CP_FIELD RA REG_MICROINS/SELA; FIRE RA;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["MR_RB"]={name:"MR_RB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RB REG_IR REG_MICROINS/SELB 5; FIRE RB;","CP_FIELD RB REG_MICROINS/SELB; FIRE RB;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["MR_RC"]={name:"MR_RC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RC REG_IR REG_MICROINS/SELC 5; FIRE RC;","CP_FIELD RC REG_MICROINS/SELC; FIRE RC;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["BW"]={name:"BW",verbal:["Select one byte (based on A1A0) from Word. ","Select two bytes (one Half Word based on A1A0) from Word. ","","Select the full Word. "],visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW"],fire_name:["svg_p:text3433"],draw_data:[["svg_p:path3061-2-6","svg_p:path3101-8","svg_p:path3535-8"]],draw_name:[[],[]]};sim.ep.signals["A1A0"]={name:"A1A0",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA"],fire_name:["svg_p:text3603"],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["BWA"]={name:"BWA",visible:false,type:"L",value:0,default_value:0,nbits:"4",behavior:["BSEL BS_TD 0 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 8 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 24 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W"],fire_name:["svg_p:text3533-5"],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["SBWA"]={name:"SBWA",visible:false,type:"L",value:0,default_value:0,nbits:"5",behavior:["BSEL BS_M1 0 8 BUS_DB 0; FIRE M1","BSEL BS_M1 0 8 BUS_DB 8; FIRE M1","BSEL BS_M1 0 8 BUS_DB 16; FIRE M1","BSEL BS_M1 0 8 BUS_DB 24; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","BSEL BS_M1 0 8 BUS_DB 0; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 8; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 16; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 24; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["IOR"]={name:"IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS KBD_IOR 0 1 IOR; MOVE_BITS SCR_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE KBD_IOR; FIRE SCR_IOR; FIRE L3D_IOR"],fire_name:["svg_p:text3715"],draw_data:[[],["svg_p:path3733","svg_p:path3491","svg_p:text3715"]],draw_name:[[],[]]};sim.ep.signals["IOW"]={name:"IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW"],fire_name:["svg_p:text3717"],draw_data:[[],["svg_p:path3735","svg_p:path3491","svg_p:text3717"]],draw_name:[[],[]]};sim.ep.signals["I"]={name:"I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_I VAL_ONE; FIRE_IFSET SELP 2"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["U"]={name:"U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_U VAL_ONE; FIRE_IFSET SELP 2"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["TEST_C"]={name:"TEST_C",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_C VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_C VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3"],draw_data:[["svg_p:text3701-3"]],draw_name:[[]]};sim.ep.signals["TEST_V"]={name:"TEST_V",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_V VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_V VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-1"],draw_data:[["svg_p:text3701-3-1"]],draw_name:[[]]};sim.ep.signals["TEST_N"]={name:"TEST_N",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_N VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_N VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-2"],draw_data:[["svg_p:text3701-3-2"]],draw_name:[[]]};sim.ep.signals["TEST_Z"]={name:"TEST_Z",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_Z VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_Z VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-5"],draw_data:[["svg_p:text3701-3-5"]],draw_name:[[]]};sim.ep.signals["TEST_I"]={name:"TEST_I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_I VAL_ONE; FIRE_IFSET SELP 2"],depends_on:["CLK"],fire_name:["svg_p:text3669"],draw_data:[["svg_p:text3669"]],draw_name:[[]]};sim.ep.signals["TEST_U"]={name:"TEST_U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE_IFSET SELP 1","MV FLAG_U VAL_ONE; FIRE_IFSET SELP 1"],depends_on:["CLK"],fire_name:["svg_p:text3669-1"],draw_data:[["svg_p:text3669-1"]],draw_name:[[]]};sim.ep.signals["TEST_INTV"]={name:"TEST_INTV",visible:true,type:"L",value:0,default_value:0,nbits:"8",forbidden:true,behavior:["MBIT INTV TEST_INTV 0 32"],depends_on:["INT"],fire_name:["svg_p:tspan4225"],draw_data:[["svg_p:path3749"]],draw_name:[[]]};sim.ep.behaviors["NOP"]={nparameters:1,operation:function(s_expr){},verbal:function(s_expr){return""}};sim.ep.behaviors["NOP_ALU"]={nparameters:1,operation:function(s_expr){sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=0;sim.ep.internal_states.alu_flags.flag_c=0;sim.ep.internal_states.alu_flags.flag_v=0},verbal:function(s_expr){return""}};sim.ep.behaviors["MV"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.ep.behaviors["LOAD"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Load from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.ep.behaviors["CP_FIELD"]={nparameters:3,types:["X","X"],operation:function(s_expr){r=s_expr[2].split("/");sim_elto_org=get_reference(r[0]);newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval!="undefined"){sim_elto_dst=get_reference(s_expr[1]);set_value(sim_elto_dst,newval)}},verbal:function(s_expr){var r=s_expr[2].split("/");var sim_elto_org=get_reference(r[0]);var newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval=="undefined")newval="<undefined>";else newval=show_value(newval);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from Field "+r[1]+" of "+show_verbal(r[0])+" to "+show_verbal(s_expr[1])+" value "+newval+". "}return show_verbal(s_expr[1])+" = "+show_verbal(r[0])+"."+r[1]+" ("+newval+"). "}};sim.ep.behaviors["NOT_ES"]={nparameters:3,types:["S","E"],operation:function(s_expr){set_value(sim.ep.signals[s_expr[1]],Math.abs(get_value(sim.ep.states[s_expr[2]])-1))},verbal:function(s_expr){var value=Math.abs(get_value(sim.ep.states[s_expr[2]])-1);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Logical NOT of "+s_expr[2]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Logical NOT "+s_expr[2]+"). "}};sim.ep.behaviors["GET"]={nparameters:4,types:["E","E","S"],operation:function(s_expr){set_value(sim.ep.states[s_expr[1]],get_value(sim.ep.states[s_expr[2]][sim.ep.signals[s_expr[3]].value]))},verbal:function(s_expr){var value=get_value(sim.ep.states[s_expr[2]][sim.ep.signals[s_expr[3]].value]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Register File "+s_expr[3]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Register File "+s_expr[3]+"). "}};sim.ep.behaviors["SET"]={nparameters:4,types:["E","S","E"],operation:function(s_expr){set_value(sim.ep.states[s_expr[1]][sim.ep.signals[s_expr[2]].value],get_value(sim.ep.states[s_expr[3]]))},verbal:function(s_expr){var value=get_value(sim.ep.states[s_expr[3]]);var o_ref=sim.ep.states[s_expr[1]][sim.ep.signals[s_expr[2]].value];var o_verbal=o_ref.name;if(typeof o_ref.verbal!="undefined")o_verbal=o_ref.verbal;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+o_verbal+" the value "+show_value(value)+". "}return o_verbal+" = "+show_value(value)+". "}};sim.ep.behaviors["AND"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])&get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])&get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU AND with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (AND). "}};sim.ep.behaviors["OR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])|get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])|get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU OR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (OR). "}};sim.ep.behaviors["NOT"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=~get_value(sim.ep.states[s_expr[2]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=~get_value(sim.ep.states[s_expr[2]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU NOT with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (NOT). "}};sim.ep.behaviors["XOR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])^get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])^get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU XOR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (XOR). "}};sim.ep.behaviors["SRL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Logical with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRL). "}};sim.ep.behaviors["SRA"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Arithmetic with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRA). "}};sim.ep.behaviors["SL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=result>>>31},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Left with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SL). "}};sim.ep.behaviors["RR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1|(get_value(sim.ep.states[s_expr[2]])&1)<<31;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1|(get_value(sim.ep.states[s_expr[2]])&1)<<31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Right Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (RR). "}};sim.ep.behaviors["RL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1|(get_value(sim.ep.states[s_expr[2]])&2147483648)>>>31;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1|(get_value(sim.ep.states[s_expr[2]])&2147483648)>>>31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Left Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LR). "}};sim.ep.behaviors["ADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a+b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a+b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU ADD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (ADD). "}};sim.ep.behaviors["SUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a-b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a-b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU SUB with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SUB). "}};sim.ep.behaviors["MUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a*b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=0;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a*b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MUL with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MUL). "}};sim.ep.behaviors["DIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){set_value(sim.ep.states[s_expr[1]],0);sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=1;sim.ep.internal_states.alu_flags.flag_v=1;sim.ep.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){return"ALU DIV zero by zero (oops!). "}var result=Math.floor(a/b);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU DIV with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (DIV). "}};sim.ep.behaviors["MOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){set_value(sim.ep.states[s_expr[1]],0);sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=1;sim.ep.internal_states.alu_flags.flag_v=1;sim.ep.internal_states.alu_flags.flag_c=0;return}var result=a%b;set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){return"ALU MOD zero by zero (oops!). "}var result=a%b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MOD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MOD). "}};sim.ep.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<16;set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<16;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Load Upper Immediate with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LUI). "}};sim.ep.behaviors["PLUS1"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+1;set_value(sim.ep.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+show_verbal(s_expr[1])+" "+show_verbal(s_expr[2])+" plus one with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 1"+" ("+show_value(result)+"). "}};sim.ep.behaviors["PLUS4"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+4;set_value(sim.ep.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+4;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+show_verbal(s_expr[1])+" "+show_verbal(s_expr[2])+" plus four with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 4"+" ("+show_value(result)+"). "}};sim.ep.behaviors["MBIT"]={nparameters:5,types:["X","X","I","I"],operation:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);set_value(sim_elto_dst,parseInt(n2,2))},verbal:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3=parseInt(n2,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(n3)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(n3)+", "+size+" bits from bit "+offset+"). "}};sim.ep.behaviors["MBIT_SN"]={nparameters:5,types:["S","E","E","I"],operation:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.ep.states[s_expr[3]]);else if(typeof sim.ep.states[r[0]].value[r[1]]!="undefined")base=sim.ep.states[r[0]].value[r[1]];else if(typeof sim.ep.signals[r[1]].default_value!="undefined")base=sim.ep.signals[r[1]].default_value;else if(typeof sim.ep.states[r[1]].default_value!="undefined")base=sim.ep.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.ep.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.ep.states[s_expr[3]]);else if(typeof sim.ep.states[r[0]].value[r[1]]!="undefined")base=sim.ep.states[r[0]].value[r[1]];else if(typeof sim.ep.signals[r[1]].default_value!="undefined")base=sim.ep.signals[r[1]].default_value;else if(typeof sim.ep.states[r[1]].default_value!="undefined")base=sim.ep.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.ep.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);var from_elto="";if(1==r.length)from_elto=show_verbal(s_expr[3]);else from_elto=show_verbal(s_expr[2])+"["+r[1]+"] ";var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+from_elto+"into "+show_verbal(s_expr[1])+" "+"value "+parseInt(n3,2)+". "}return show_verbal(s_expr[1])+" = "+from_elto+" ("+parseInt(n3,2)+"). "}};sim.ep.behaviors["SBIT_SIGNAL"]={nparameters:4,types:["X","I","I"],operation:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)},verbal:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)}};sim.ep.behaviors["UPDATE_FLAG"]={nparameters:4,types:["X","X","I"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value&~(1<>>0)},verbal:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Update "+show_verbal(s_expr[2])+" to value "+sim_elto_org.value+". "}return show_verbal(s_expr[1])+"."+show_verbal(s_expr[3])+" = "+sim_elto_org.value+". "}};sim.ep.behaviors["MBITS"]={nparameters:8,types:["E","I","E","S","S","I","S"],operation:function(s_expr){var offset=parseInt(sim.ep.signals[s_expr[4]].value);var size=parseInt(sim.ep.signals[s_expr[5]].value);var n1=get_value(sim.ep.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.ep.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}set_value(sim.ep.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var offset=parseInt(sim.ep.signals[s_expr[4]].value);var size=parseInt(sim.ep.signals[s_expr[5]].value);var n1=get_value(sim.ep.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.ep.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}n1=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return" Copy from "+show_verbal(s_expr[3])+" to "+show_verbal(s_expr[1])+" value "+show_value(n1)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[3])+" ("+show_value(n1)+", "+size+" bits from bit "+offset+"). "}};sim.ep.behaviors["BSEL"]={nparameters:6,types:["E","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;set_value(sim.ep.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var posd=parseInt(s_expr[2]);var len=parseInt(s_expr[3]);var poso=parseInt(s_expr[5]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;var n5=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[4])+" to "+show_verbal(s_expr[1])+" value "+show_value(n5)+" (copied "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[4])+" ("+show_value(n5)+", "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}};sim.ep.behaviors["EXT_SIG"]={nparameters:3,types:["E","I"],operation:function(s_expr){var n1=get_value(sim.ep.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}set_value(sim.ep.states[s_expr[1]],parseInt(n4,2))},verbal:function(s_expr){var n1=get_value(sim.ep.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}var n5=parseInt(n4,2);return"Sign Extension with value "+show_value(n5)+". "}};sim.ep.behaviors["MOVE_BITS"]={nparameters:5,types:["S","I","I","S"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=0;var len=parseInt(s_expr[3]);var n1=sim.ep.signals[s_expr[4]].value.toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.ep.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.ep.behaviors["MOVE_BITSE"]={nparameters:6,types:["S","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.ep.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.ep.behaviors["DECO"]={nparameters:1,operation:function(s_expr){sim.ep.states["INEX"].value=0;var oi=decode_instruction(sim.ep.internal_states.FIRMWARE,sim.ep.ctrl_states.ir,get_value(sim.ep.states["REG_IR"]));if(null==oi.oinstruction){ws_alert("ERROR: undefined instruction code in IR ("+"co:"+oi.op_code.toString(2)+", "+"cop:"+oi.cop_code.toString(2)+")");sim.ep.states["ROM_MUXA"].value=0;sim.ep.states["INEX"].value=1;return-1}var rom_addr=oi.op_code<<6;if(typeof oi.oinstruction.cop!="undefined"){rom_addr=rom_addr+oi.cop_code}if(typeof sim.ep.internal_states["ROM"][rom_addr]=="undefined"){ws_alert("ERROR: undefined rom address "+rom_addr+" in firmware");sim.ep.states["ROM_MUXA"].value=0;return-1}sim.ep.states["ROM_MUXA"].value=sim.ep.internal_states["ROM"][rom_addr];var val=get_value(sim.ep.states["DECO_INS"]);set_value(sim.ep.states["DECO_INS"],val+1);var pc=get_value(sim.ep.states["REG_PC"])-4;var decins=get_deco_from_pc(pc);set_value(sim.ep.states["REG_IR_DECO"],decins);show_dbg_ir(get_value(sim.ep.states["REG_IR_DECO"]))},verbal:function(s_expr){return"Decode instruction. "}};sim.ep.behaviors["FIRE"]={nparameters:2,types:["S"],operation:function(s_expr){if(sim.ep.internal_states.fire_stack.indexOf(s_expr[1])!=-1){return}sim.ep.internal_states.fire_stack.push(s_expr[1]);update_draw(sim.ep.signals[s_expr[1]],sim.ep.signals[s_expr[1]].value);if("L"==sim.ep.signals[s_expr[1]].type){update_state(s_expr[1])}sim.ep.internal_states.fire_stack.pop(s_expr[1]);check_buses(s_expr[1])},verbal:function(s_expr){return""}};sim.ep.behaviors["FIRE_IFSET"]={nparameters:3,types:["S","I"],operation:function(s_expr){if(get_value(sim.ep.signals[s_expr[1]])!=parseInt(s_expr[2])){return}sim.ep.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.ep.behaviors["FIRE_IFCHANGED"]={nparameters:3,types:["S","X"],operation:function(s_expr){sim_elto=get_reference(s_expr[2]);if(sim_elto.changed==false){return}sim.ep.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.ep.behaviors["RESET_CHANGED"]={nparameters:2,types:["X"],operation:function(s_expr){sim_elto=get_reference(s_expr[1]);sim_elto.changed=false},verbal:function(s_expr){return""}};sim.ep.behaviors["CLOCK"]={nparameters:1,operation:function(s_expr){var new_maddr=null;var mcelto=null;var t0=performance.now();var val=get_value(sim.ep.states["CLK"]);set_value(sim.ep.states["CLK"],val+1);new_maddr=get_value(sim.ep.states["REG_MICROADDR"]);mcelto=sim.ep.internal_states["MC"][new_maddr];if(typeof mcelto!=="undefined"&&false==mcelto.is_native){for(var i=0;i>>0},set_value:function(elto,value){var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.ep.internal_states.MP,elto,melto);show_main_memory(sim.ep.internal_states.MP,elto,typeof valref==="undefined",true);return value}};sim.ep.internal_states.segments={};sim.ep.internal_states.MP={};sim.ep.internal_states.MP_wc=0;sim.ep.signals.MRDY={name:"MRDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED MRDY C","FIRE_IFCHANGED MRDY C"],fire_name:["svg_p:tspan3916","svg_p:text3909"],draw_data:[[],["svg_p:path3895","svg_p:path3541"]],draw_name:[[],[]]};sim.ep.signals.R={name:"R",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_READ BUS_AB BUS_DB BWA MRDY CLK; FIRE MRDY"],fire_name:["svg_p:text3533-5-2","svg_p:text3713"],draw_data:[[],["svg_p:path3557","svg_p:path3571"]],draw_name:[[],[]]};sim.ep.signals.W={name:"W",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_WRITE BUS_AB BUS_DB BWA MRDY CLK; FIRE MRDY"],fire_name:["svg_p:text3533-5-08","svg_p:text3527","svg_p:text3431-7"],draw_data:[[],["svg_p:path3559","svg_p:path3575","svg_p:path3447-7"]],draw_name:[[],[]]};sim.ep.behaviors.MEM_READ={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);sim.ep.signals[s_expr[4]].value=0;var remain=get_var(sim.ep.internal_states.MP_wc);if(typeof sim.ep.events.mem[clk-1]!="undefined"&&sim.ep.events.mem[clk-1]>0){remain=sim.ep.events.mem[clk-1]-1}sim.ep.events.mem[clk]=remain;if(remain>0){return}address=address&4294967292;var value=main_memory_getvalue(sim.ep.internal_states.MP,address);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}dbvalue=main_memory_fusionvalues(dbvalue,value,bw);sim.ep.states[s_expr[2]].value=dbvalue>>>0;sim.ep.signals[s_expr[4]].value=1;show_main_memory(sim.ep.internal_states.MP,address,full_redraw,false)},verbal:function(s_expr){var verbal="";var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);var bw_type="word";if(0==(bw&12))bw_type="byte";else if(1==(bw&12))bw_type="half";var value=main_memory_getvalue(sim.ep.internal_states.MP,address);if(typeof value==="undefined")value=0;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){verbal="Try to read a "+bw_type+" from memory "+"at address 0x"+address.toString(16)+" with value 0x"+value.toString(16)+". "}verbal="Memory output = 0x"+value.toString(16)+" (Read a "+bw_type+" from 0x"+address.toString(16)+"). ";return verbal}};sim.ep.behaviors.MEM_WRITE={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);sim.ep.signals[s_expr[4]].value=0;var remain=get_var(sim.ep.internal_states.MP_wc);if(typeof sim.ep.events.mem[clk-1]!="undefined"&&sim.ep.events.mem[clk-1]>0){remain=sim.ep.events.mem[clk-1]-1}sim.ep.events.mem[clk]=remain;if(remain>0){return}address=address&4294967292;var value=main_memory_getvalue(sim.ep.internal_states.MP,address);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}value=main_memory_fusionvalues(value,dbvalue,bw);var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.ep.internal_states.MP,address,melto);sim.ep.signals[s_expr[4]].value=1;show_main_memory(sim.ep.internal_states.MP,address,full_redraw,true)},verbal:function(s_expr){var verbal="";var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);var bw_type="word";if(0==(bw&12))bw_type="byte";else if(1==(bw&12))bw_type="half";var value=main_memory_getvalue(sim.ep.internal_states.MP,address);if(typeof value==="undefined")value=0;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){verbal="Try to write a "+bw_type+" to memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". "}verbal="Memory[0x"+address.toString(16)+"] = "+"0x"+value.toString(16)+" (Write a "+bw_type+" to 0x"+address.toString(16)+"). ";return verbal}};sim.ep.behaviors.MEMORY_RESET={nparameters:1,operation:function(s_expr){sim.ep.events.mem={}},verbal:function(s_expr){return"Reset main memory (all values will be zeroes). "}};sim.ep.components.IO={name:"IO",version:"1",abilities:["IO_TIMER"],details_name:["IO_STATS","IO_CONFIG"],details_fire:[["svg_p:text3775"],[]],write_state:function(vec){return vec},read_state:function(o,check){return false},get_state:function(reg){return null},get_value:function(elto){var associated_state=simhw_internalState_get("io_hash",elto);var value=get_value(simhw_sim_state(associated_state))>>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.ep.internal_states.io_int_factory=[];sim.ep.internal_states.io_int_factory[0]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[1]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[2]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[3]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[4]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[5]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[6]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[7]={period:0,probability:.5,accumulated:0,active:false};var IOSR_ID=4352;var IOCR_ID=4356;var IODR_ID=4360;sim.ep.internal_states.io_hash[IOSR_ID]="IOSR";sim.ep.internal_states.io_hash[IOCR_ID]="IOCR";sim.ep.internal_states.io_hash[IODR_ID]="IODR";sim.ep.states.IOSR={name:"IOSR",verbal:"IO State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.IOCR={name:"IOCR",verbal:"IO Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.IODR={name:"IODR",verbal:"IO Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals.INT={name:"INT",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE C","FIRE C"],fire_name:["svg_p:tspan4199"],draw_data:[[],["svg_p:path3809"]],draw_name:[[],[]]};sim.ep.signals.IORDY={name:"IORDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED IORDY C","FIRE_IFCHANGED IORDY C"],fire_name:["svg_p:tspan4089","svg_p:path3793","svg_p:text3911"],draw_data:[[],["svg_p:path3897"]],draw_name:[[],[]]};sim.ep.signals.IO_IOR={name:"IO_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOR BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE SBWA"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.IO_IOW={name:"IO_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOW BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE SBWA"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.IO_IE={name:"IO_IE",visible:true,type:"L",value:1,default_value:1,nbits:"1",behavior:["NOP","IO_CHK_I CLK INT INTV; FIRE C"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals.INTA={name:"INTA",visible:true,type:"L",value:1,default_value:0,nbits:"1",behavior:["NOP","INTA CLK INT INTA BUS_DB INTV; FIRE BW; FIRE C"],fire_name:["svg_p:text3785-0-6-0-5-5-1-1"],draw_data:[[],["svg_p:path3807","svg_p:path3737"]],draw_name:[[],[]]};sim.ep.behaviors.IO_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==IOSR_ID)set_value(sim.ep.states[s_expr[2]],iosr);if(bus_ab==IOCR_ID)set_value(sim.ep.states[s_expr[2]],iocr);if(bus_ab==IODR_ID)set_value(sim.ep.states[s_expr[2]],iodr)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==IOSR_ID)verbal="I/O device read at IOSR of value "+iosr+". ";if(bus_ab==IOCR_ID)verbal="I/O device read at IOCR of value "+iocr+". ";if(bus_ab==IODR_ID)verbal="I/O device read at IODR of value "+iodr+". ";return verbal}};sim.ep.behaviors.IO_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab!=IOSR_ID&&bus_ab!=IOCR_ID&&bus_ab!=IODR_ID){return}if(bus_ab==IOSR_ID)set_value(sim.ep.states[s_expr[3]],bus_db);if(bus_ab==IOCR_ID)set_value(sim.ep.states[s_expr[4]],bus_db);if(bus_ab==IODR_ID)set_value(sim.ep.states[s_expr[5]],bus_db);var iocr_id=get_value(sim.ep.states[s_expr[4]]);var iodr_id=get_value(sim.ep.states[s_expr[5]]);if(iocr_id<0||iocr_id>7)return;set_var(sim.ep.internal_states.io_int_factory[iocr_id].period,iodr_id);set_var(sim.ep.internal_states.io_int_factory[iocr_id].probability,1);if(0==iodr_id)set_var(sim.ep.internal_states.io_int_factory[iocr_id].probability,0)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab==IOSR_ID)verbal="I/O device write at IOSR with value "+bus_db+". ";if(bus_ab==IOCR_ID)verbal="I/O device write at IOCR with value "+bus_db+". ";if(bus_ab==IODR_ID)verbal="I/O device write at IODR with value "+bus_db+". ";return verbal}};sim.ep.behaviors.IO_CHK_I={nparameters:4,types:["E","S","E"],operation:function(s_expr){var clk=get_value(sim.ep.states[s_expr[1]]);for(var i=sim.ep.internal_states.io_int_factory.length-1;i>=0;i--){if(get_var(sim.ep.internal_states.io_int_factory[i].period)==0)continue;if(get_var(sim.ep.internal_states.io_int_factory[i].active)==true){set_value(sim.ep.signals[s_expr[2]],1);set_value(sim.ep.states[s_expr[3]],i)}if(clk%get_var(sim.ep.internal_states.io_int_factory[i].period)==0){if(Math.random()>get_var(sim.ep.internal_states.io_int_factory[i].probability))continue;set_var(sim.ep.internal_states.io_int_factory[i].accumulated,get_var(sim.ep.internal_states.io_int_factory[i].accumulated)+1);set_var(sim.ep.internal_states.io_int_factory[i].active,true);if(typeof sim.ep.events.io[clk]=="undefined")sim.ep.events.io[clk]=[];sim.ep.events.io[clk].push(i);set_value(sim.ep.signals[s_expr[2]],1);set_value(sim.ep.states[s_expr[3]],i)}}},verbal:function(s_expr){return"Check I/O Interruption. "}};sim.ep.behaviors.INTA={nparameters:6,types:["E","S","S","E","E"],operation:function(s_expr){var clk=get_value(sim.ep.states[s_expr[1]]);if(typeof sim.ep.events.io[clk]!="undefined"){set_value(sim.ep.states[s_expr[4]],sim.ep.events.io[clk][0]);return}set_value(sim.ep.signals[s_expr[2]],0);set_value(sim.ep.states[s_expr[5]],0);for(var i=0;i>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.ep.internal_states.l3d_dim=4;sim.ep.internal_states.l3d_neltos=Math.pow(sim.ep.internal_states.l3d_dim,3);sim.ep.internal_states.l3d_state=Array.from({length:sim.ep.internal_states.l3d_neltos},(()=>({active:false})));sim.ep.internal_states.l3d_frame="0".repeat(sim.ep.internal_states.l3d_neltos);var L3DSR_ID=8448;var L3DCR_ID=8452;var L3DDR_ID=8456;sim.ep.internal_states.io_hash[L3DSR_ID]="L3DSR";sim.ep.internal_states.io_hash[L3DCR_ID]="L3DCR";sim.ep.internal_states.io_hash[L3DDR_ID]="L3DDR";sim.ep.states.L3DSR={name:"L3DSR",verbal:"L3D State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.L3DCR={name:"L3DCR",verbal:"L3D Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.L3DDR={name:"L3DDR",verbal:"L3D Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals.L3D_IOR={name:"L3D_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOR BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE SBWA"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.L3D_IOW={name:"L3D_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOW BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE SBWA; L3D_SYNC"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.behaviors.L3D_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==L3DCR_ID){set_value(sim.ep.states[s_expr[2]],iocr)}if(bus_ab==L3DDR_ID){set_value(sim.ep.states[s_expr[2]],iodr)}if(bus_ab==L3DSR_ID){var x=(iodr&4278190080)>>24;var y=(iodr&16711680)>>16;var z=(iodr&65280)>>8;var p=z*Math.pow(sim.ep.internal_states.l3d_dim,2)+y*sim.ep.internal_states.l3d_dim+x;var s=get_var(sim.ep.internal_states.l3d_state[p].active);set_value(sim.ep.states[s_expr[2]],s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==L3DSR_ID)verbal="I/O device read at L3DSR of value "+iosr+". ";if(bus_ab==L3DCR_ID)verbal="I/O device read at L3DCR of value "+iocr+". ";if(bus_ab==L3DDR_ID)verbal="I/O device read at L3DDR of value "+iodr+". ";return verbal}};sim.ep.behaviors.L3D_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab!=L3DSR_ID&&bus_ab!=L3DCR_ID&&bus_ab!=L3DDR_ID){return}if(bus_ab==L3DSR_ID){set_value(sim.ep.states[s_expr[3]],bus_db)}if(bus_ab==L3DDR_ID){set_value(sim.ep.states[s_expr[5]],bus_db)}if(bus_ab==L3DCR_ID){set_value(sim.ep.states[s_expr[4]],bus_db);var x=(bus_db&4278190080)>>24;var y=(bus_db&16711680)>>16;var z=(bus_db&65280)>>8;var p=z*Math.pow(sim.ep.internal_states.l3d_dim,2)+y*sim.ep.internal_states.l3d_dim+x;var s=(bus_db&255)!=0;set_var(sim.ep.internal_states.l3d_state[p].active,s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab==L3DSR_ID)verbal="I/O device write at L3DSR with value "+bus_db+". ";if(bus_ab==L3DCR_ID)verbal="I/O device write at L3DCR with value "+bus_db+". ";if(bus_ab==L3DDR_ID)verbal="I/O device write at L3DDR with value "+bus_db+". ";return verbal}};sim.ep.behaviors.L3D_RESET={nparameters:1,operation:function(s_expr){sim.ep.events.l3d={};for(var i=0;i>>0;if(value!=0){vec.CPU["R"+i]={type:"register",default_value:0,id:"R"+i,op:"=",value:"0x"+value.toString(16)}}}for(var i=0;i>>0;if(value!=0){vec.CPU[internal_reg[i]]={type:"register",default_value:0,id:internal_reg[i],op:"=",value:"0x"+value.toString(16)}}}return vec},read_state:function(vec,check){if(typeof vec.CPU=="undefined")vec.CPU={};var key=check["id"].toUpperCase().trim();var val=parseInt(check["value"]).toString(16);if("REGISTER"==check["type"].toUpperCase().trim()){vec.CPU[key]={type:"register",default_value:0,id:key,op:check["condition"],value:"0x"+val};return true}return false},get_state:function(reg){var r_reg=reg.toUpperCase().trim();if(typeof sim.poc.states["REG_"+r_reg]!="undefined"){var value=get_value(sim.poc.states["REG_"+r_reg])>>>0;return"0x"+value.toString(16)}r_reg=r_reg.replace("R","");var index=parseInt(r_reg);if(typeof sim.poc.states.BR[index]!="undefined"){var value=get_value(sim.poc.states.BR[index])>>>0;return"0x"+value.toString(16)}return null},get_value:function(elto){if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index))return get_value(simhw_sim_state(elto))>>>0;return get_value(simhw_sim_states().BR[index])>>>0},set_value:function(elto,value){var pc_name=simhw_sim_ctrlStates_get().pc.state;if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index)){set_value(simhw_sim_state(elto),value);if(pc_name===elto){show_asmdbg_pc()}return value}return set_value(simhw_sim_states().BR[index],value)}};sim.poc.ctrl_states.pc={name:"PC",state:"REG_PC",is_pointer:true};sim.poc.ctrl_states.sp={name:"SP",state:"BR.29",is_pointer:true};sim.poc.ctrl_states.fp={name:"FP",state:"BR.30",is_pointer:true};sim.poc.ctrl_states.ir={name:"IR",state:"REG_IR",default_eltos:{co:{begin:0,end:5,length:6},cop:{begin:27,end:31,length:5}},is_pointer:false};sim.poc.ctrl_states.mpc={name:"mPC",state:"REG_MICROADDR",is_pointer:false};sim.poc.internal_states.MC={};sim.poc.internal_states.ROM={};sim.poc.internal_states.FIRMWARE={};sim.poc.internal_states.io_hash={};sim.poc.internal_states.fire_stack=[];sim.poc.internal_states.tri_state_names=["T1","T2","T3","T6","T8","T9","T10","T11"];sim.poc.internal_states.fire_visible={databus:false,internalbus:false};sim.poc.internal_states.filter_states=["REG_IR_DECO,col-12","REG_IR,col-auto","REG_PC,col-auto","REG_SR,col-auto","REG_RT1,col-auto","REG_MAR,col-auto","REG_MBR,col-auto","REG_MICROADDR,col-auto"];sim.poc.internal_states.filter_signals=["A0,0","B,0","C,0","SELA,5","SELB,5","SELC,2","SELCOP,0","MR,0","MC,0","C0,0","C1,0","C2,0","C3,0","C4,0","C7,0","T1,0","T2,0","T3,0","T6,0","T8,0","T9,0","T10,0","T11,0","M1,0","M7,0","MA,0","MB,0","LC,0","SE,0","SIZE,0","OFFSET,0","BW,0","R,0","W,0","TA,0","TD,0","IOR,0","IOW,0","TEST_I,0","TEST_U,0"];sim.poc.internal_states.alu_flags={flag_n:0,flag_z:0,flag_v:0,flag_c:0};sim.poc.states.BR=[];sim.poc.states.BR[0]={name:"R0",verbal:"Register 0",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[1]={name:"R1",verbal:"Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[2]={name:"R2",verbal:"Register 2",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[3]={name:"R3",verbal:"Register 3",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[4]={name:"R4",verbal:"Register 4",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[5]={name:"R5",verbal:"Register 5",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[6]={name:"R6",verbal:"Register 6",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[7]={name:"R7",verbal:"Register 7",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[8]={name:"R8",verbal:"Register 8",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[9]={name:"R9",verbal:"Register 9",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[10]={name:"R10",verbal:"Register 10",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[11]={name:"R11",verbal:"Register 11",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[12]={name:"R12",verbal:"Register 12",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[13]={name:"R13",verbal:"Register 13",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[14]={name:"R14",verbal:"Register 14",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[15]={name:"R15",verbal:"Register 15",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[16]={name:"R16",verbal:"Register 16",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[17]={name:"R17",verbal:"Register 17",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[18]={name:"R18",verbal:"Register 18",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[19]={name:"R19",verbal:"Register 19",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[20]={name:"R20",verbal:"Register 20",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[21]={name:"R21",verbal:"Register 21",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[22]={name:"R22",verbal:"Register 22",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[23]={name:"R23",verbal:"Register 23",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[24]={name:"R24",verbal:"Register 24",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[25]={name:"R25",verbal:"Register 25",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[26]={name:"R26",verbal:"Register 26",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[27]={name:"R27",verbal:"Register 27",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[28]={name:"R28",verbal:"Register 28",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[29]={name:"R29",verbal:"Register 29",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[30]={name:"R30",verbal:"Register 30",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[31]={name:"R31",verbal:"Register 31",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[32]={name:"R32",verbal:"Register 32",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[33]={name:"R33",verbal:"Register 33",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[34]={name:"R34",verbal:"Register 34",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[35]={name:"R35",verbal:"Register 35",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[36]={name:"R36",verbal:"Register 36",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[37]={name:"R37",verbal:"Register 37",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[38]={name:"R38",verbal:"Register 38",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[39]={name:"R39",verbal:"Register 39",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[40]={name:"R40",verbal:"Register 40",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[41]={name:"R41",verbal:"Register 41",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[42]={name:"R42",verbal:"Register 42",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[43]={name:"R43",verbal:"Register 43",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[44]={name:"R44",verbal:"Register 44",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[45]={name:"R45",verbal:"Register 45",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[46]={name:"R46",verbal:"Register 46",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[47]={name:"R47",verbal:"Register 47",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[48]={name:"R48",verbal:"Register 48",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[49]={name:"R49",verbal:"Register 49",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[50]={name:"R50",verbal:"Register 50",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[51]={name:"R51",verbal:"Register 51",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[52]={name:"R52",verbal:"Register 52",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[53]={name:"R53",verbal:"Register 53",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[54]={name:"R54",verbal:"Register 54",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[55]={name:"R55",verbal:"Register 55",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[56]={name:"R56",verbal:"Register 56",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[57]={name:"R57",verbal:"Register 57",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[58]={name:"R58",verbal:"Register 58",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[59]={name:"R59",verbal:"Register 59",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[60]={name:"R60",verbal:"Register 60",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[61]={name:"R61",verbal:"Register 61",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[62]={name:"R62",verbal:"Register 62",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[63]={name:"R63",verbal:"Register 63",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_PC"]={name:"PC",verbal:"Program Counter Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MAR"]={name:"MAR",verbal:"Memory Address Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MBR"]={name:"MBR",verbal:"Memory Data Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_IR"]={name:"IR",verbal:"Instruction Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_SR"]={name:"SR",verbal:"State Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_RT1"]={name:"RT1",verbal:"Temporal Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_IB"]={name:"I_BUS",verbal:"Internal Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_AB"]={name:"A_BUS",verbal:"Address Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_CB"]={name:"C_BUS",verbal:"Control Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_DB"]={name:"D_BUS",verbal:"Data Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["RA_T9"]={name:"RA_T9",verbal:"Input of T9 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["RB_T10"]={name:"RB_T10",verbal:"Input of T10 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["SELEC_T3"]={name:"SELEC_T3",verbal:"Input of T3 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["ALU_T6"]={name:"ALU_T6",verbal:"Input of T6 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["MA_ALU"]={name:"MA_ALU",verbal:"Input ALU via MA",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["MB_ALU"]={name:"MB_ALU",verbal:"Input ALU via MB",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_C"]={name:"FLAG_C",verbal:"Carry Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_V"]={name:"FLAG_V",verbal:"Overflow Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_N"]={name:"FLAG_N",verbal:"Negative Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_Z"]={name:"FLAG_Z",verbal:"Zero Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_I"]={name:"FLAG_I",verbal:"Interruption Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_U"]={name:"FLAG_U",verbal:"User Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MICROADDR"]={name:"µADDR",verbal:"Microaddress Register",visible:true,nbits:"12",value:0,default_value:0,draw_data:["svg_cu:text4667"]};sim.poc.states["REG_MICROINS"]={name:"µINS",verbal:"Microinstruction Register",visible:true,nbits:"77",value:{},default_value:{},draw_data:[]};sim.poc.states["FETCH"]={name:"FETCH",verbal:"Input Fetch",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["ROM_MUXA"]={name:"ROM_MUXA",verbal:"Input ROM",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["SUM_ONE"]={name:"SUM_ONE",verbal:"Input next microinstruction",visible:false,nbits:"12",value:1,default_value:1,draw_data:[]};sim.poc.states["MUXA_MICROADDR"]={name:"MUXA_MICROADDR",verbal:"Input microaddress",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["MUXC_MUXB"]={name:"MUXC_MUXB",verbal:"Output of MUX C",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["INEX"]={name:"INEX",verbal:"Illegal Instruction Exception",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["BS_M1"]={name:"BS_M1",verbal:"from Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BS_TD"]={name:"BS_TD",verbal:"Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["INTV"]={name:"INTV",verbal:"Interruption Vector",visible:false,nbits:"8",value:0,default_value:0,draw_data:[]};sim.poc.states["M1_C1"]={name:"M1_C1",verbal:"Input of Memory Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["M7_C7"]={name:"M7_C7",verbal:"Input of State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["VAL_ZERO"]={name:"VAL_ZERO",verbal:"Wired Zero",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["VAL_ONE"]={name:"VAL_ONE",verbal:"Wired One",visible:false,nbits:"32",value:1,default_value:1,draw_data:[]};sim.poc.states["VAL_FOUR"]={name:"VAL_FOUR",verbal:"Wired Four",visible:false,nbits:"32",value:4,default_value:4,draw_data:[]};sim.poc.states["REG_IR_DECO"]={name:"IR_DECO",verbal:"Instruction Decoded",visible:true,nbits:"0",value:0,default_value:0,draw_data:[]};sim.poc.states["DECO_INS"]={name:"DECO_INS",verbal:"Instruction decoded in binary",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["CLK"]={name:"CLK",verbal:"Clock",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["ACC_TIME"]={name:"ACC_TIME",verbal:"Accumulated CPU time",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals["C"]={name:"C",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["MV MUXC_MUXB VAL_ZERO; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB INT 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB IORDY 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB MRDY 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 1 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 28 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 29 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 30 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 31 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MV MUXC_MUXB INEX; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB"],fire_name:["svg_cu:text3410"],draw_data:[["svg_cu:path3108"],["svg_cu:path3062"],["svg_cu:path3060"],["svg_cu:path3136"],["svg_cu:path3482"],["svg_cu:path3480"],["svg_cu:path3488"],["svg_cu:path3486"],["svg_cu:path3484"],["svg_cu:path3484-9"],["svg_cu:path3108-3","svg_cu:path3260-3-8-6","svg_cu:path3260-3-8","svg_cu:path3260-3"]],draw_name:[["svg_cu:path3496","svg_cu:path3414","svg_cu:path3194-08"]]};sim.poc.signals["B"]={name:"B",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV A1 MUXC_MUXB; FIRE A1","NOT_ES A1 MUXC_MUXB; FIRE A1"],depends_on:["CLK"],fire_name:["svg_cu:text3408"],draw_data:[["svg_cu:path3094-7"],["svg_cu:path3392","svg_cu:path3372","svg_cu:path3390","svg_cu:path3384","svg_cu:path3108-1","svg_cu:path3100-8-7"]],draw_name:[[],["svg_cu:path3194-0","svg_cu:path3138-8","svg_cu:path3498-6"]]};sim.poc.signals["A0"]={name:"A0",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 1; FIRE A0A1","SBIT_SIGNAL A0A1 1 1; FIRE A0A1"],depends_on:["CLK"],fire_name:["svg_cu:text3406"],draw_data:[["svg_cu:path3096"],["svg_cu:path3096"]],draw_name:[[],["svg_cu:path3138-8-1","svg_cu:path3098-2","svg_cu:path3124-2-5"]]};sim.poc.signals["A1"]={name:"A1",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 0; FIRE A0A1","SBIT_SIGNAL A0A1 1 0; FIRE A0A1"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3094"],["svg_cu:path3094"]],draw_name:[[]]};sim.poc.signals["A0A1"]={name:"A0A1",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["PLUS1 MUXA_MICROADDR REG_MICROADDR","CP_FIELD MUXA_MICROADDR REG_MICROINS/MADDR","MV MUXA_MICROADDR ROM_MUXA","MV MUXA_MICROADDR FETCH"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3102","svg_cu:path3100","svg_cu:path3098","svg_cu:path3100-9","svg_cu:path3088"],["svg_cu:path3104","svg_cu:path3134","svg_cu:path3500","svg_cu:path3416"],["svg_cu:path3504","svg_cu:path3100-8","svg_cu:path3234-9"],["svg_cu:path3124"]],draw_name:[[]]};sim.poc.signals["C0"]={name:"C0",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_MAR BUS_IB"],fire_name:["svg_p:text3077"],draw_data:[["svg_p:path3081"]],draw_name:[["svg_p:path3075"]]};sim.poc.signals["C1"]={name:"C1",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_MBR M1_C1"],fire_name:["svg_p:text3079"],draw_data:[["svg_p:path3055"]],draw_name:[["svg_p:path3073"]]};sim.poc.signals["C2"]={name:"C2",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_PC BUS_IB; UPDATEDPC"],fire_name:["svg_p:text3179"],draw_data:[["svg_p:path3217"]],draw_name:[["svg_p:path3177"]]};sim.poc.signals["C3"]={name:"C3",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_IR BUS_IB; DECO; FIRE_IFSET C 10"],fire_name:["svg_p:text3439"],draw_data:[["svg_p:path3339","svg_p:path3913-4"]],draw_name:[["svg_p:path3337"]]};sim.poc.signals["C4"]={name:"C4",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_RT1 BUS_IB"],fire_name:["svg_p:tspan482"],draw_data:[["svg_p:path3339-4"]],draw_name:[["svg_p:path3337-0"]]};sim.poc.signals["C7"]={name:"C7",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_SR M7_C7; FIRE C"],fire_name:["svg_p:text3655"],draw_data:[["svg_p:path3651-9"]],draw_name:[["svg_p:path3681"]]};sim.poc.signals["TA"]={name:"TA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_AB REG_MAR"],fire_name:["svg_p:text3091"],draw_data:[["svg_p:path3089","svg_p:path3597","svg_p:path3513","svg_p:path3601","svg_p:path3601-2","svg_p:path3187","svg_p:path3087","svg_p:path2995","svg_p:path3535"]],draw_name:[["svg_p:path3085"]]};sim.poc.signals["TD"]={name:"TD",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_DB REG_MBR; FIRE R; FIRE W"],fire_name:["svg_p:text3103"],draw_data:[["svg_p:path3101","svg_p:path3587","svg_p:path3419-8","svg_p:path3071","svg_p:path3099","svg_p:path3097","svg_p:path3559-5","svg_p:path3419-1-0","svg_p:path3583","svg_p:path3419-1","svg_p:path3491","svg_p:path3641","svg_p:path3541"]],draw_name:[["svg_p:path3095"]]};sim.poc.signals["T1"]={name:"T1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_MBR; FIRE M7; FIRE M1"],fire_name:["svg_p:text3105"],draw_data:[["svg_p:path3071","svg_p:path3069","svg_p:path3049","svg_p:path3063-9","svg_p:path3071"]],draw_name:[["svg_p:path3067"]]};sim.poc.signals["T2"]={name:"T2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_PC; FIRE M7; FIRE M1"],fire_name:["svg_p:text3449"],draw_data:[["svg_p:path3199","svg_p:path3201","svg_p:path3049"]],draw_name:[["svg_p:path3329"]]};sim.poc.signals["T3"]={name:"T3",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB SELEC_T3; FIRE M7; FIRE M1"],fire_name:["svg_p:text3451"],draw_data:[["svg_p:path3349","svg_p:path3931","svg_p:path3345","svg_p:path3049"]],draw_name:[["svg_p:path3351"]]};sim.poc.signals["T6"]={name:"T6",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB ALU_T6; FIRE M7; FIRE M1"],fire_name:["svg_p:text3457"],draw_data:[["svg_p:path3589","svg_p:path3317","svg_p:path3163-2","svg_p:path3049","svg_p:path3317-9","svg_p:path3321","svg_p:path3261-8"]],draw_name:[["svg_p:path3319"]]};sim.poc.signals["T8"]={name:"T8",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_SR; FIRE M7; FIRE M1"],fire_name:["svg_p:text3657"],draw_data:[["svg_p:path3651","svg_p:path3647","svg_p:path3049"]],draw_name:[["svg_p:path3649"]]};sim.poc.signals["T9"]={name:"T9",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RA_T9; FIRE M7; FIRE M1"],fire_name:["svg_p:text3147"],draw_data:[["svg_p:path3143","svg_p:path3139","svg_p:path3049","svg_p:path3143-9"]],draw_name:[["svg_p:path3133"]]};sim.poc.signals["T10"]={name:"T10",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RB_T10; FIRE M7; FIRE M1"],fire_name:["svg_p:text3149"],draw_data:[["svg_p:path3145","svg_p:path3141","svg_p:path3049","svg_p:path3145-5"]],draw_name:[["svg_p:path3137"]]};sim.poc.signals["T11"]={name:"T11",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","CP_FIELD BUS_IB REG_MICROINS/EXCODE; FIRE M7; FIRE M1"],fire_name:["svg_p:text3147-5","svg_cu:tspan4426"],draw_data:[["svg_p:path3081-3","svg_p:path3139-7","svg_p:path3049","svg_cu:path3081-3","svg_cu:path3139-7","svg_cu:path3502"]],draw_name:[["svg_p:path3133-6","svg_cu:path3133-6"]]};sim.poc.signals["M1"]={name:"M1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M1_C1 BUS_IB","MV M1_C1 BUS_DB"],depends_on:["C1"],fire_name:["svg_p:text3469"],draw_data:[["svg_p:path3063","svg_p:path3061","svg_p:path3059"],["svg_p:path3057","svg_p:path3641","svg_p:path3419","svg_p:path3583"]],draw_name:[[],["svg_p:path3447"]]};sim.poc.signals["M7"]={name:"M7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M7_C7 BUS_IB","MV M7_C7 REG_SR; UPDATE_FLAG M7_C7 FLAG_C 31; UPDATE_FLAG M7_C7 FLAG_V 30; UPDATE_FLAG M7_C7 FLAG_N 29; UPDATE_FLAG M7_C7 FLAG_Z 28"],depends_on:["C7"],fire_name:["svg_p:text3673"],draw_data:[["svg_p:path3691","svg_p:path3693","svg_p:path3659"],["svg_p:path3695"]],draw_name:[[],["svg_p:path3667"]]};sim.poc.signals["MA"]={name:"MA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MA_ALU RA_T9; FIRE COP","MV MA_ALU BUS_IB; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3463"],draw_data:[["svg_p:path3249","svg_p:path3161","svg_p:path3165"],["svg_p:path3279"]],draw_name:[[],["svg_p:path3423"]]};sim.poc.signals["MB"]={name:"MB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MB_ALU RB_T10; FIRE COP","MV MB_ALU REG_PC; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3465"],draw_data:[["svg_p:path3281","svg_p:path3171","svg_p:path3169"],["svg_p:path3283"]],draw_name:[[],["svg_p:path3425","svg_p:path3427"]]};sim.poc.signals["COP"]={name:"COP",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["NOP_ALU; UPDATE_NZVC","AND ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","OR ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","NOT ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","XOR ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SRL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SRA ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","RR ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","RL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUB ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","MUL ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","DIV ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","MOD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","LUI ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADDFOUR ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADDONE ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUBFOUR ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUBONE ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FADD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FSUB ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FMUL ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FDIV ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FMOD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU"],depends_on:["SELCOP"],fire_name:["svg_p:text3303"],draw_data:[["svg_p:path3237","svg_p:path3239","svg_p:path3261-8","svg_p:path3321","svg_p:path3901-6","svg_p:path3317-9"]],draw_name:[["svg_p:path3009","svg_p:path3301"]]};sim.poc.signals["SELA"]={name:"SELA",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRA SELA; RESET_CHANGED SELA"],depends_on:["RA"],fire_name:["svg_cu:text3164"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELB"]={name:"SELB",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRB SELB; RESET_CHANGED SELB"],depends_on:["RB"],fire_name:["svg_cu:text3168"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELC"]={name:"SELC",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRC SELC; RESET_CHANGED SELC"],depends_on:["RC"],fire_name:["svg_cu:text3172"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELCOP"]={name:"SELCOP",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE_IFCHANGED MC SELCOP; RESET_CHANGED SELCOP"],depends_on:["COP"],fire_name:["svg_cu:text3312"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["EXCODE"]={name:"EXCODE",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE T11"],fire_name:["svg_cu:text3312-6"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["RA"]={name:"RA",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["GET RA_T9 BR RA; FIRE_IFSET T9 1; FIRE_IFSET MA 0"],depends_on:["SELA"],fire_name:["svg_p:text3107"],draw_data:[[]],draw_name:[["svg_p:path3109"]]};sim.poc.signals["RB"]={name:"RB",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["GET RB_T10 BR RB; FIRE_IFSET T10 1; FIRE_IFSET MB 0"],depends_on:["SELB"],fire_name:["svg_p:text3123"],draw_data:[[]],draw_name:[["svg_p:path3113"]]};sim.poc.signals["RC"]={name:"RC",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["FIRE LC"],depends_on:["SELC"],fire_name:["svg_p:text3125"],draw_data:[[]],draw_name:[["svg_p:path3117"]]};sim.poc.signals["LC"]={name:"LC",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","SET BR RC BUS_IB"],fire_name:["svg_p:text3127"],draw_data:[["svg_p:path3153","svg_p:path3151","svg_p:path3129"]],draw_name:[["svg_p:path3121"]]};sim.poc.signals["SE"]={name:"SE",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3","MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3593"],draw_data:[[]],draw_name:[["svg_p:path3591","svg_p:path3447-7-7"]]};sim.poc.signals["SIZE"]={name:"SIZE",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3363"],draw_data:[[]],draw_name:[["svg_p:path3355"]]};sim.poc.signals["OFFSET"]={name:"OFFSET",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3707"],draw_data:[[]],draw_name:[["svg_p:path3359"]]};sim.poc.signals["MC"]={name:"MC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT COP REG_IR 0 5; FIRE_IFCHANGED COP MC","CP_FIELD COP REG_MICROINS/SELCOP; FIRE_IFCHANGED COP MC"],depends_on:["SELCOP"],fire_name:["svg_cu:text3322","svg_cu:text3172-1-5"],draw_data:[["svg_cu:path3320","svg_cu:path3142"],["svg_cu:path3318","svg_cu:path3502-6","svg_cu:path3232-6"]],draw_name:[[],["svg_cu:path3306"]]};sim.poc.signals["MRA"]={name:"MRA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RA REG_IR REG_MICROINS/SELA 5; FIRE RA;","CP_FIELD RA REG_MICROINS/SELA; FIRE RA;"],depends_on:["SELA"],fire_name:["svg_cu:text3222"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3260"],["svg_cu:path3270","svg_cu:path3258","svg_cu:path3260","svg_cu:path3294","svg_cu:path3288","svg_cu:path3280"]],draw_name:[[],["svg_cu:path3220"]]};sim.poc.signals["MRB"]={name:"MRB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RB REG_IR REG_MICROINS/SELB 5; FIRE RB;","CP_FIELD RB REG_MICROINS/SELB; FIRE RB;"],depends_on:["SELB"],fire_name:["svg_cu:text3242"],draw_data:[["svg_cu:path3196","svg_cu:path3278","svg_cu:path3292"],["svg_cu:path3282","svg_cu:path3258-4","svg_cu:path3278","svg_cu:path3196"]],draw_name:[[],["svg_cu:path3240"]]};sim.poc.signals["MRC"]={name:"MRC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RC REG_IR REG_MICROINS/SELC 5; FIRE RC;","CP_FIELD RC REG_MICROINS/SELC; FIRE RC;"],depends_on:["SELC"],fire_name:["svg_cu:text3254"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3232","svg_cu:path3292"],["svg_cu:path3300","svg_cu:path3294","svg_cu:path3292","svg_cu:path3288","svg_cu:path3232"]],draw_name:[[],["svg_cu:path3252"]]};sim.poc.signals["IOR"]={name:"IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOR 0 1 IOR; FIRE SCR_IOR; MOVE_BITS IO_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE IO_IOR; MOVE_BITS KBD_IOR 0 1 IOR; FIRE KBD_IOR; FIRE L3D_IOR"],fire_name:[],draw_data:[[],["svg_p:path3733","svg_p:path3491","svg_p:text3715"]],draw_name:[[],[]]};sim.poc.signals["IOW"]={name:"IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW"],fire_name:[],draw_data:[[],["svg_p:path3735","svg_p:path3491","svg_p:text3717"]],draw_name:[[],[]]};sim.poc.signals["TEST_C"]={name:"TEST_C",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_C VAL_ZERO; FIRE M7","MV FLAG_C VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3"],draw_data:[["svg_p:text3701-3"]],draw_name:[[]]};sim.poc.signals["TEST_V"]={name:"TEST_V",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_V VAL_ZERO; FIRE M7","MV FLAG_V VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-1"],draw_data:[["svg_p:text3701-3-1"]],draw_name:[[]]};sim.poc.signals["TEST_N"]={name:"TEST_N",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_N VAL_ZERO; FIRE M7","MV FLAG_N VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-2"],draw_data:[["svg_p:text3701-3-2"]],draw_name:[[]]};sim.poc.signals["TEST_Z"]={name:"TEST_Z",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_Z VAL_ZERO; FIRE M7","MV FLAG_Z VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-5"],draw_data:[["svg_p:text3701-3-5"]],draw_name:[[]]};sim.poc.signals["TEST_I"]={name:"TEST_I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE M7","MV FLAG_I VAL_ONE; FIRE M7"],depends_on:["CLK"],fire_name:["svg_cu:text3440"],draw_data:[["svg_cu:text3440"]],draw_name:[[]]};sim.poc.signals["TEST_U"]={name:"TEST_U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE M7","MV FLAG_U VAL_ONE; FIRE M7"],depends_on:["CLK"],fire_name:["svg_cu:text3442"],draw_data:[["svg_cu:text3442"]],draw_name:[[]]};sim.poc.signals["TEST_INTV"]={name:"TEST_INTV",visible:true,type:"L",value:0,default_value:0,nbits:"8",forbidden:true,behavior:["MBIT INTV TEST_INTV 0 32"],depends_on:["INT"],fire_name:["svg_p:tspan4225"],draw_data:[["svg_p:path3749"]],draw_name:[[]]};sim.poc.behaviors["NOP"]={nparameters:1,operation:function(s_expr){},verbal:function(s_expr){return""}};sim.poc.behaviors["NOP_ALU"]={nparameters:1,operation:function(s_expr){sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){return"Reset ALU flags. "}};sim.poc.behaviors["MV"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="short"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.poc.behaviors["LOAD"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Load from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_value(newval)+" ( "+show_verbal(s_expr[2])+"). "}};sim.poc.behaviors["CP_FIELD"]={nparameters:3,types:["X","X"],operation:function(s_expr){r=s_expr[2].split("/");sim_elto_org=get_reference(r[0]);newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval!="undefined"){sim_elto_dst=get_reference(s_expr[1]);set_value(sim_elto_dst,newval)}},verbal:function(s_expr){var r=s_expr[2].split("/");var sim_elto_org=get_reference(r[0]);var newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval=="undefined")newval="<undefined>";else newval=show_value(newval);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return'Copy from "'+show_verbal(r[0])+'"['+r[1]+"] "+"to "+show_verbal(s_expr[1])+" (value "+newval+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(r[0])+"."+r[1]+" ("+newval+"). "}};sim.poc.behaviors["NOT_ES"]={nparameters:3,types:["S","E"],operation:function(s_expr){set_value(sim.poc.signals[s_expr[1]],Math.abs(get_value(sim.poc.states[s_expr[2]])-1))},verbal:function(s_expr){var value=Math.abs(get_value(sim.poc.states[s_expr[2]])-1);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Logical NOT of "+s_expr[2]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Logical NOT "+s_expr[2]+"). "}};sim.poc.behaviors["GET"]={nparameters:4,types:["E","E","S"],operation:function(s_expr){set_value(sim.poc.states[s_expr[1]],get_value(sim.poc.states[s_expr[2]][sim.poc.signals[s_expr[3]].value]))},verbal:function(s_expr){var value=get_value(sim.poc.states[s_expr[2]][sim.poc.signals[s_expr[3]].value]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Register File "+s_expr[3]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Register File "+s_expr[3]+"). "}};sim.poc.behaviors["SET"]={nparameters:4,types:["E","S","E"],operation:function(s_expr){set_value(sim.poc.states[s_expr[1]][sim.poc.signals[s_expr[2]].value],get_value(sim.poc.states[s_expr[3]]))},verbal:function(s_expr){var value=get_value(sim.poc.states[s_expr[3]]);var o_ref=sim.poc.states[s_expr[1]][sim.poc.signals[s_expr[2]].value];var o_verbal=o_ref.name;if(typeof o_ref.verbal!="undefined")o_verbal=o_ref.verbal;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+o_verbal+" the value "+show_value(value)+". "}return o_verbal+" = "+show_value(value)+". "}};sim.poc.behaviors["AND"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])&get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])&get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU AND with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (AND). "}};sim.poc.behaviors["OR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])|get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])|get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU OR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (OR). "}};sim.poc.behaviors["NOT"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=~get_value(sim.poc.states[s_expr[2]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=~get_value(sim.poc.states[s_expr[2]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU NOT with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (NOT). "}};sim.poc.behaviors["XOR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])^get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])^get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU XOR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (XOR). "}};sim.poc.behaviors["SRL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Logical with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRL). "}};sim.poc.behaviors["SRA"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Arithmetic with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRA). "}};sim.poc.behaviors["SL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Left with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SL). "}};sim.poc.behaviors["RR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1|(get_value(sim.poc.states[s_expr[2]])&1)<<31;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1|(get_value(sim.poc.states[s_expr[2]])&1)<<31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Right Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (RR). "}};sim.poc.behaviors["RL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1|(get_value(sim.poc.states[s_expr[2]])&2147483648)>>>31;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1|(get_value(sim.poc.states[s_expr[2]])&2147483648)>>>31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Left Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LR). "}};sim.poc.behaviors["ADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a+b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a+b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU ADD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (ADD). "}};sim.poc.behaviors["SUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a-b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a-b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU SUB with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SUB). "}};sim.poc.behaviors["MUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a*b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a*b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MUL with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MUL). "}};sim.poc.behaviors["DIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){return"ALU DIV zero by zero (oops!). "}var result=Math.floor(a/b);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU DIV with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (DIV). "}};sim.poc.behaviors["MOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=a%b;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){return"ALU MOD zero by zero (oops!). "}var result=a%b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MOD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MOD). "}};sim.poc.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Load Upper Immediate with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LUI). "}};sim.poc.behaviors["ADDFOUR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;return"ALU ADD 4 with result "+show_value(result)+". "}};sim.poc.behaviors["ADDONE"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;return"ALU ADD 1 with result "+show_value(result)+". "}};sim.poc.behaviors["SUBFOUR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-4;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-4;return"ALU SUB 4 with result "+show_value(result)+". "}};sim.poc.behaviors["SUBONE"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-1;return"ALU SUB 1 with result "+show_value(result)+". "}};sim.poc.behaviors["FADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)+b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)+b.toFixed(2);return"ALU Float ADD with result "+result+". "}};sim.poc.behaviors["FSUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)-b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)-b.toFixed(2);return"ALU Float SUB with result "+result+". "}};sim.poc.behaviors["FMUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)*b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)*b.toFixed(2);return"ALU Float MUL with result "+result+". "}};sim.poc.behaviors["FDIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)/b.toFixed(2);return"ALU Float DIV with result "+result+". "}};sim.poc.behaviors["FMOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=(get_value(sim.poc.states[s_expr[2]])<<0)%(get_value(sim.poc.states[s_expr[3]])<<0);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)%b.toFixed(2);return"ALU Float MOD with result "+result+". "}};sim.poc.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;return"ALU Load Upper Immediate with result "+show_value(result)+". "}};sim.poc.behaviors["PLUS1"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;set_value(sim.poc.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Add one to "+show_verbal(s_expr[2])+" and copy to "+show_verbal(s_expr[1])+" with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 1"+" ("+show_value(result)+"). "}};sim.poc.behaviors["PLUS4"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;set_value(sim.poc.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Add four to "+show_verbal(s_expr[2])+" and copy to "+show_verbal(s_expr[1])+" with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 4"+" ("+show_value(result)+"). "}};sim.poc.behaviors["MBIT"]={nparameters:5,types:["X","X","I","I"],operation:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);set_value(sim_elto_dst,parseInt(n2,2))},verbal:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3=parseInt(n2,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(n3)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(n3)+", "+size+" bits from bit "+offset+"). "}};sim.poc.behaviors["MBIT_SN"]={nparameters:5,types:["S","E","E","I"],operation:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.poc.states[s_expr[3]]);else if(typeof sim.poc.states[r[0]].value[r[1]]!="undefined")base=sim.poc.states[r[0]].value[r[1]];else if(typeof sim.poc.signals[r[1]].default_value!="undefined")base=sim.poc.signals[r[1]].default_value;else if(typeof sim.poc.states[r[1]].default_value!="undefined")base=sim.poc.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.poc.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.poc.states[s_expr[3]]);else if(typeof sim.poc.states[r[0]].value[r[1]]!="undefined")base=sim.poc.states[r[0]].value[r[1]];else if(typeof sim.poc.signals[r[1]].default_value!="undefined")base=sim.poc.signals[r[1]].default_value;else if(typeof sim.poc.states[r[1]].default_value!="undefined")base=sim.poc.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.poc.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);var from_elto="";if(1==r.length)from_elto=show_verbal(s_expr[3]);else from_elto='"'+show_verbal(s_expr[2])+'"['+r[1]+"] ";var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+from_elto+"into "+show_verbal(s_expr[1])+" "+"value "+parseInt(n3,2)+". "}return show_verbal(s_expr[1])+" = "+from_elto+" ("+parseInt(n3,2)+"). "}};sim.poc.behaviors["SBIT_SIGNAL"]={nparameters:4,types:["X","I","I"],operation:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)},verbal:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)}};sim.poc.behaviors["UPDATE_FLAG"]={nparameters:4,types:["X","X","I"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value&~(1<>>0)},verbal:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Update "+show_verbal(s_expr[2])+" to value "+sim_elto_org.value+". "}return show_verbal(s_expr[1])+"."+show_verbal(s_expr[3])+" = "+sim_elto_org.value+". "}};sim.poc.behaviors["MBITS"]={nparameters:8,types:["E","I","E","S","S","I","S"],operation:function(s_expr){var offset=parseInt(sim.poc.signals[s_expr[4]].value);var size=parseInt(sim.poc.signals[s_expr[5]].value);var n1=get_value(sim.poc.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.poc.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}set_value(sim.poc.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var offset=parseInt(sim.poc.signals[s_expr[4]].value);var size=parseInt(sim.poc.signals[s_expr[5]].value);var n1=get_value(sim.poc.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.poc.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}n1=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return" Copy from "+show_verbal(s_expr[3])+" to "+show_verbal(s_expr[1])+" value "+show_value(n1)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[3])+" ("+show_value(n1)+", "+size+" bits from bit "+offset+"). "}};sim.poc.behaviors["BSEL"]={nparameters:6,types:["E","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;set_value(sim.poc.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var posd=parseInt(s_expr[2]);var len=parseInt(s_expr[3]);var poso=parseInt(s_expr[5]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;var n5=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[4])+" to "+show_verbal(s_expr[1])+" value "+show_value(n5)+" (copied "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[4])+" ("+show_value(n5)+", "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}};sim.poc.behaviors["EXT_SIG"]={nparameters:3,types:["E","I"],operation:function(s_expr){var n1=get_value(sim.poc.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}set_value(sim.poc.states[s_expr[1]],parseInt(n4,2))},verbal:function(s_expr){var n1=get_value(sim.poc.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}var n5=parseInt(n4,2);return"Sign Extension with value "+show_value(n5)+". "}};sim.poc.behaviors["MOVE_BITS"]={nparameters:5,types:["S","I","I","S"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=0;var len=parseInt(s_expr[3]);var n1=sim.poc.signals[s_expr[4]].value.toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.poc.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.poc.behaviors["MOVE_BITSE"]={nparameters:6,types:["S","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.poc.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.poc.behaviors["DECO"]={nparameters:1,operation:function(s_expr){sim.poc.states["INEX"].value=0;var oi=decode_instruction(sim.poc.internal_states.FIRMWARE,sim.poc.ctrl_states.ir,get_value(sim.poc.states["REG_IR"]));if(null==oi.oinstruction){ws_alert("ERROR: undefined instruction code in IR ("+"co:"+oi.op_code.toString(2)+", "+"cop:"+oi.cop_code.toString(2)+")");sim.poc.states["ROM_MUXA"].value=0;sim.poc.states["INEX"].value=1;return-1}var rom_addr=oi.op_code<<6;if(typeof oi.oinstruction.cop!="undefined"){rom_addr=rom_addr+oi.cop_code}if(typeof sim.poc.internal_states["ROM"][rom_addr]=="undefined"){ws_alert("ERROR: undefined rom address "+rom_addr+" in firmware");sim.poc.states["ROM_MUXA"].value=0;return-1}sim.poc.states["ROM_MUXA"].value=sim.poc.internal_states["ROM"][rom_addr];var val=get_value(sim.poc.states["DECO_INS"]);set_value(sim.poc.states["DECO_INS"],val+1);var pc=get_value(sim.poc.states["REG_PC"])-4;var decins=get_deco_from_pc(pc);set_value(sim.poc.states["REG_IR_DECO"],decins);show_dbg_ir(get_value(sim.poc.states["REG_IR_DECO"]))},verbal:function(s_expr){return"Decode instruction. "}};sim.poc.behaviors["FIRE"]={nparameters:2,types:["S"],operation:function(s_expr){if(sim.poc.internal_states.fire_stack.indexOf(s_expr[1])!=-1){return}sim.poc.internal_states.fire_stack.push(s_expr[1]);update_draw(sim.poc.signals[s_expr[1]],sim.poc.signals[s_expr[1]].value);if("L"==sim.poc.signals[s_expr[1]].type){update_state(s_expr[1])}sim.poc.internal_states.fire_stack.pop(s_expr[1]);check_buses(s_expr[1])},verbal:function(s_expr){return""}};sim.poc.behaviors["FIRE_IFSET"]={nparameters:3,types:["S","I"],operation:function(s_expr){if(get_value(sim.poc.signals[s_expr[1]])!=parseInt(s_expr[2])){return}sim.poc.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.poc.behaviors["FIRE_IFCHANGED"]={nparameters:3,types:["S","X"],operation:function(s_expr){sim_elto=get_reference(s_expr[2]);if(sim_elto.changed==false)return;sim.poc.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.poc.behaviors["RESET_CHANGED"]={nparameters:2,types:["X"],operation:function(s_expr){sim_elto=get_reference(s_expr[1]);sim_elto.changed=false},verbal:function(s_expr){return""}};sim.poc.behaviors["CLOCK"]={nparameters:1,operation:function(s_expr){var new_maddr=null;var mcelto=null;var t0=performance.now();var val=get_value(sim.poc.states["CLK"]);set_value(sim.poc.states["CLK"],val+1);new_maddr=get_value(sim.poc.states["REG_MICROADDR"]);mcelto=sim.poc.internal_states["MC"][new_maddr];if(typeof mcelto!=="undefined"&&false==mcelto.is_native){for(var i=0;i>>0},set_value:function(elto,value){var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.poc.internal_states.MP,elto,melto);show_main_memory(sim.poc.internal_states.MP,elto,typeof valref==="undefined",true);return value}};sim.poc.internal_states.segments={};sim.poc.internal_states.MP={};sim.poc.internal_states.MP_wc=0;sim.poc.signals.MRDY={name:"MRDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED MRDY C","FIRE_IFCHANGED MRDY C"],fire_name:["svg_p:tspan3916"],draw_data:[[],["svg_p:path3895","svg_p:path3541"]],draw_name:[[],[]]};sim.poc.signals.R={name:"R",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_READ BUS_AB BUS_DB BW MRDY CLK; FIRE M1; FIRE MRDY"],fire_name:["svg_p:text3533-5-2"],draw_data:[[],["svg_p:path3557","svg_p:path3571"]],draw_name:[[],[]]};sim.poc.signals.W={name:"W",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_WRITE BUS_AB BUS_DB BW MRDY CLK; FIRE M1; FIRE MRDY"],fire_name:["svg_p:text3533-5-08"],draw_data:[[],["svg_p:path3559","svg_p:path3575","svg_p:path3447-7"]],draw_name:[[],[]]};sim.poc.signals.BW={name:"BW",verbal:["Access to one byte from memory. ","Access to two bytes from memory. ","Access to three bytes from memory. ","Access to a word from memory. "],visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["FIRE R; FIRE W","FIRE R; FIRE W","FIRE R; FIRE W","FIRE R; FIRE W"],fire_name:["svg_p:text3533-5-2-8"],draw_data:[["svg_p:path3557-0"]],draw_name:[[],[]]};sim.poc.behaviors.MEM_READ={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);sim.poc.signals[s_expr[4]].value=0;var remain=get_var(sim.poc.internal_states.MP_wc);if(typeof sim.poc.events.mem[clk-1]!="undefined"&&sim.poc.events.mem[clk-1]>0){remain=sim.poc.events.mem[clk-1]-1}sim.poc.events.mem[clk]=remain;if(remain>0){return}var wordress=address&4294967292;var value=main_memory_getvalue(sim.poc.internal_states.MP,wordress);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}dbvalue=main_memory_extractvalues(value,bw,address&3);sim.poc.states[s_expr[2]].value=dbvalue>>>0;sim.poc.signals[s_expr[4]].value=1;show_main_memory(sim.poc.internal_states.MP,wordress,full_redraw,false)},verbal:function(s_expr){var verbal="";var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);switch(bw){case 0:bw_type="byte";break;case 1:bw_type="half";break;case 2:bw_type="three bytes";break;case 3:bw_type="word";break}var value=main_memory_getvalue(sim.poc.internal_states.MP,address);if(typeof value==="undefined"){value=0}verbal="Try to read a "+bw_type+" from memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". ";return verbal}};sim.poc.behaviors.MEM_WRITE={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);sim.poc.signals[s_expr[4]].value=0;var remain=get_var(sim.poc.internal_states.MP_wc);if(typeof sim.poc.events.mem[clk-1]!="undefined"&&sim.poc.events.mem[clk-1]>0){remain=sim.poc.events.mem[clk-1]-1}sim.poc.events.mem[clk]=remain;if(remain>0){return}var wordress=address&4294967292;var value=main_memory_getvalue(sim.poc.internal_states.MP,wordress);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}value=main_memory_updatevalues(value,dbvalue,bw,address&3);var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var elto=main_memory_set(sim.poc.internal_states.MP,wordress,melto);sim.poc.signals[s_expr[4]].value=1;show_main_memory(sim.poc.internal_states.MP,wordress,full_redraw,true)},verbal:function(s_expr){var verbal="";var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);switch(bw){case 0:bw_type="byte";break;case 1:bw_type="half";break;case 2:bw_type="three bytes";break;case 3:bw_type="word";break}var value=main_memory_getvalue(sim.poc.internal_states.MP,address);if(typeof value==="undefined"){value=0}verbal="Try to write a "+bw_type+" to memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". ";return verbal}};sim.poc.behaviors.MEMORY_RESET={nparameters:1,operation:function(s_expr){sim.poc.events.mem={}},verbal:function(s_expr){return"Reset the memory (all values will be zeroes). "}};sim.poc.components.IO={name:"IO",version:"1",abilities:["IO_TIMER"],details_name:["IO_STATS","IO_CONFIG"],details_fire:[["svg_p:text3775"],[]],write_state:function(vec){return vec},read_state:function(o,check){return false},get_state:function(reg){return null},get_value:function(elto){var associated_state=simhw_internalState_get("io_hash",elto);var value=get_value(simhw_sim_state(associated_state))>>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.poc.internal_states.io_int_factory=[];sim.poc.internal_states.io_int_factory[0]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[1]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[2]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[3]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[4]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[5]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[6]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[7]={period:0,probability:.5,accumulated:0,active:false};var IOSR_ID=4352;var IOCR_ID=4356;var IODR_ID=4360;sim.poc.internal_states.io_hash[IOSR_ID]="IOSR";sim.poc.internal_states.io_hash[IOCR_ID]="IOCR";sim.poc.internal_states.io_hash[IODR_ID]="IODR";sim.poc.states.IOSR={name:"IOSR",verbal:"IO State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.IOCR={name:"IOCR",verbal:"IO Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.IODR={name:"IODR",verbal:"IO Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals.INT={name:"INT",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE C","FIRE C"],fire_name:["svg_p:tspan4199"],draw_data:[[],["svg_p:path3809"]],draw_name:[[],[]]};sim.poc.signals.IORDY={name:"IORDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED IORDY C","FIRE_IFCHANGED IORDY C"],fire_name:["svg_p:tspan4089","svg_p:path3793","svg_p:tspan4089"],draw_data:[[],["svg_p:path3897"]],draw_name:[[],[]]};sim.poc.signals.IO_IOR={name:"IO_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOR BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE M1"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.IO_IOW={name:"IO_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOW BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE M1"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.IO_IE={name:"IO_IE",visible:true,type:"L",value:1,default_value:1,nbits:"1",behavior:["NOP","IO_CHK_I CLK INT INTV; FIRE C"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.poc.signals.INTA={name:"INTA",visible:true,type:"L",value:1,default_value:0,nbits:"1",behavior:["NOP","INTA CLK INT INTA BUS_DB INTV; FIRE M1; FIRE C"],fire_name:["svg_p:text3785-0-6-0-5-5-1-1"],draw_data:[[],["svg_p:path3807","svg_p:path3737"]],draw_name:[[],[]]};sim.poc.behaviors.IO_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==IOSR_ID)set_value(sim.poc.states[s_expr[2]],iosr);if(bus_ab==IOCR_ID)set_value(sim.poc.states[s_expr[2]],iocr);if(bus_ab==IODR_ID)set_value(sim.poc.states[s_expr[2]],iodr)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==IOSR_ID)verbal="I/O device read at IOSR of value "+iosr+". ";if(bus_ab==IOCR_ID)verbal="I/O device read at IOCR of value "+iocr+". ";if(bus_ab==IODR_ID)verbal="I/O device read at IODR of value "+iodr+". ";return verbal}};sim.poc.behaviors.IO_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab!=IOSR_ID&&bus_ab!=IOCR_ID&&bus_ab!=IODR_ID){return}if(bus_ab==IOSR_ID)set_value(sim.poc.states[s_expr[3]],bus_db);if(bus_ab==IOCR_ID)set_value(sim.poc.states[s_expr[4]],bus_db);if(bus_ab==IODR_ID)set_value(sim.poc.states[s_expr[5]],bus_db);var iocr_id=get_value(sim.poc.states[s_expr[4]]);var iodr_id=get_value(sim.poc.states[s_expr[5]]);if(iocr_id<0||iocr_id>7)return;set_var(sim.poc.internal_states.io_int_factory[iocr_id].period,iodr_id);set_var(sim.poc.internal_states.io_int_factory[iocr_id].probability,1);if(0==iodr_id)set_var(sim.poc.internal_states.io_int_factory[iocr_id].probability,0)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab==IOSR_ID)verbal="I/O device write at IOSR with value "+bus_db+". ";if(bus_ab==IOCR_ID)verbal="I/O device write at IOCR with value "+bus_db+". ";if(bus_ab==IODR_ID)verbal="I/O device write at IODR with value "+bus_db+". ";return verbal}};sim.poc.behaviors.IO_CHK_I={nparameters:4,types:["E","S","E"],operation:function(s_expr){var clk=get_value(sim.poc.states[s_expr[1]]);for(var i=sim.poc.internal_states.io_int_factory.length-1;i>=0;i--){if(get_var(sim.poc.internal_states.io_int_factory[i].period)==0)continue;if(get_var(sim.poc.internal_states.io_int_factory[i].active)==true){set_value(sim.poc.signals[s_expr[2]],1);set_value(sim.poc.states[s_expr[3]],i)}if(clk%get_var(sim.poc.internal_states.io_int_factory[i].period)==0){if(Math.random()>get_var(sim.poc.internal_states.io_int_factory[i].probability))continue;set_var(sim.poc.internal_states.io_int_factory[i].accumulated,get_var(sim.poc.internal_states.io_int_factory[i].accumulated)+1);set_var(sim.poc.internal_states.io_int_factory[i].active,true);if(typeof sim.poc.events.io[clk]=="undefined")sim.poc.events.io[clk]=[];sim.poc.events.io[clk].push(i);set_value(sim.poc.signals[s_expr[2]],1);set_value(sim.poc.states[s_expr[3]],i)}}},verbal:function(s_expr){return"Check I/O Interruption. "}};sim.poc.behaviors.INTA={nparameters:6,types:["E","S","S","E","E"],operation:function(s_expr){var clk=get_value(sim.poc.states[s_expr[1]]);if(typeof sim.poc.events.io[clk]!="undefined"){set_value(sim.poc.states[s_expr[4]],sim.poc.events.io[clk][0]);return}set_value(sim.poc.signals[s_expr[2]],0);set_value(sim.poc.states[s_expr[5]],0);for(var i=0;i>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("L3DR"),1);compute_behavior("FIRE L3DR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("L3DW"),1);compute_behavior("FIRE L3DW");return value}};sim.poc.internal_states.l3d_dim=4;sim.poc.internal_states.l3d_neltos=Math.pow(sim.poc.internal_states.l3d_dim,3);sim.poc.internal_states.l3d_state=Array.from({length:sim.poc.internal_states.l3d_neltos},(()=>({active:false})));sim.poc.internal_states.l3d_frame="0".repeat(sim.poc.internal_states.l3d_neltos);var L3DSR_ID=8448;var L3DCR_ID=8452;var L3DDR_ID=8456;sim.poc.internal_states.io_hash[L3DSR_ID]="L3DSR";sim.poc.internal_states.io_hash[L3DCR_ID]="L3DCR";sim.poc.internal_states.io_hash[L3DDR_ID]="L3DDR";sim.poc.states.L3DSR={name:"L3DSR",verbal:"L3D State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.L3DCR={name:"L3DCR",verbal:"L3D Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.L3DDR={name:"L3DDR",verbal:"L3D Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals.L3D_IOR={name:"L3D_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOR BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE M1"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.L3D_IOW={name:"L3D_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOW BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE M1; L3D_SYNC"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.behaviors.L3D_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==L3DCR_ID){set_value(sim.poc.states[s_expr[2]],iocr)}if(bus_ab==L3DDR_ID){set_value(sim.poc.states[s_expr[2]],iodr)}if(bus_ab==L3DCR_ID){var x=(iodr&4278190080)>>24;var y=(iodr&16711680)>>16;var z=(iodr&65280)>>8;var p=z*Math.pow(sim.poc.internal_states.l3d_dim,2)+y*sim.poc.internal_states.l3d_dim+x;var s=get_var(sim.poc.internal_states.l3d_state[p].active);set_value(sim.poc.states[s_expr[2]],s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==L3DSR_ID)verbal="I/O device read at L3DSR of value "+iosr+". ";if(bus_ab==L3DCR_ID)verbal="I/O device read at L3DCR of value "+iocr+". ";if(bus_ab==L3DDR_ID)verbal="I/O device read at L3DDR of value "+iodr+". ";return verbal}};sim.poc.behaviors.L3D_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab!=L3DSR_ID&&bus_ab!=L3DCR_ID&&bus_ab!=L3DDR_ID){return}if(bus_ab==L3DSR_ID){set_value(sim.poc.states[s_expr[3]],bus_db)}if(bus_ab==L3DDR_ID){set_value(sim.poc.states[s_expr[5]],bus_db)}if(bus_ab==L3DCR_ID){set_value(sim.poc.states[s_expr[4]],bus_db);var x=(bus_db&4278190080)>>24;var y=(bus_db&16711680)>>16;var z=(bus_db&65280)>>8;var p=z*Math.pow(sim.poc.internal_states.l3d_dim,2)+y*sim.poc.internal_states.l3d_dim+x;var s=(bus_db&255)!=0;var l3dstates=sim.poc.internal_states.l3d_state;set_var(l3dstates[p].active,s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab==L3DSR_ID)verbal="I/O device write at L3DSR with value "+bus_db+". ";if(bus_ab==L3DCR_ID)verbal="I/O device write at L3DCR with value "+bus_db+". ";if(bus_ab==L3DDR_ID)verbal="I/O device write at L3DDR with value "+bus_db+". ";return verbal}};sim.poc.behaviors.L3D_RESET={nparameters:1,operation:function(s_expr){sim.poc.events.l3d={};for(var i=0;i0)line2=context.newlines[context.newlines.length-1]+1;var line1=0;if(context.newlines.length>1)line1=context.newlines[context.newlines.length-2]+1;var lowI=line1;var highI=Math.min(context.t-1,line2+32);for(;typeof context.text[highI+1]!="undefined"&&context.text[highI+1]!="\n";highI++);var line3=highI+2;highI++;for(;typeof context.text[highI+1]!="undefined"&&context.text[highI+1]!="\n";highI++);highI++;context.error="
"+"
"+"...\n";for(var i=lowI;i"+"(*) "+i18n_get_TagFor("compiler","PROBLEM AROUND LINE")+" "+context.line+": 
"+msgError+".
";if(typeof ga!=="undefined"){ga("send","event","compile","compile.error","compile.error."+msgError)}return context}function getLabelContext(context){return{t:context.t,line:context.line,newlines:context.newlines.slice()}}function setLabelContext(context,labelContext){context.t=labelContext.t;context.line=labelContext.line;context.newlines=labelContext.newlines}function getComments(context){return context.comments.join("\n")}function resetComments(context){context.comments=[]}function nextNative(context){var first=context.t;var last=context.t;var braces=1;while(context.t",""":'"',"'":"'"};function treatHTMLSequences(text_with_html){var re=null;var key=null;for(key in html_sequences){re=new RegExp(key,"gi");text_with_html=text_with_html.replace(re,html_sequences[key])}return text_with_html}function read_microprg(context){var microprograma=[];var microcomments=[];resetComments(context);if(!isToken(context,"{")){return langError(context,i18n_get_TagFor("compiler","OPEN BRACE NOT FOUND"))}nextToken(context);while(!isToken(context,"}")){var microInstruccionAux={};if(!isToken(context,"(")){var newLabelName=getToken(context);newLabelName=newLabelName.substring(0,newLabelName.length-1);if("TAG"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","LABEL NOT FOUND")+"'"+newLabelName+"'")}for(var contadorMCAux in context.etiquetas){if(context.etiquetas[contadorMCAux]==newLabelName){return langError(context,i18n_get_TagFor("compiler","REPEATED LABEL")+"'"+getToken(context)+"'")}}context.etiquetas[context.contadorMC]=newLabelName;if(newLabelName.match("[a-zA-Z_0-9]*")[0]!=newLabelName){return langError(context,i18n_get_TagFor("compiler","INVALID LABEL FORMAT")+"'"+getToken(context)+"'")}nextToken(context)}if(!isToken(context,"(")){return langError(context,i18n_get_TagFor("compiler","OPEN PAREN. NOT FOUND"))}nextToken(context);while(!isToken(context,")")){var nombre_tok=getToken(context).toUpperCase();if(nombre_tok=="MADDR"){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);var labelsNotFoundAux={};labelsNotFoundAux.nombre=getToken(context);labelsNotFoundAux.cycle=microprograma.length;labelsNotFoundAux.index=context.i;labelsNotFoundAux.instruction=context.instrucciones.length;var etiquetaFounded=0;for(var k in context.etiquetas){if(isToken(context,context.etiquetas[k])){microInstruccionAux[nombre_tok]=k.toString();etiquetaFounded=1}}if(etiquetaFounded==0){context.labelsNotFound.push(labelsNotFoundAux)}nextToken(context);if(isToken(context,","))nextToken(context);continue}if(typeof simhw_sim_signal(nombre_tok)=="undefined"){return langError(context,i18n_get_TagFor("compiler","SIGNAL NOT EXISTS")+"'"+nombre_tok+"'")}if(typeof simhw_sim_signal(nombre_tok).forbidden!="undefined"){return langError(context,nombre_tok+" "+i18n_get_TagFor("compiler","SIGNAL NO DIRECTLY"))}microInstruccionAux[nombre_tok]=1;nextToken(context);if(isToken(context,"=")){nextToken(context);microInstruccionAux[nombre_tok]=parseInt(getToken(context),2);if(getToken(context).match("[01]*")[0]!=getToken(context)){return langError(context,i18n_get_TagFor("compiler","INCORRECT BIN. FORMAT")+"'"+getToken(context)+"'")}if(microInstruccionAux[nombre_tok]>=Math.pow(2,simhw_sim_signal(nombre_tok).nbits)){return langError(context,i18n_get_TagFor("compiler","OUT OF RANGE")+"'"+getToken(context)+"'")}nextToken(context)}if(isToken(context,",")){nextToken(context)}}var acc_cmt=getComments(context);microcomments.push(acc_cmt);resetComments(context);microprograma.push(microInstruccionAux);context.contadorMC++;nextToken(context);if(isToken(context,","))nextToken(context)}if(microprograma.length===0){return langError(context,i18n_get_TagFor("compiler","EMPTY MICROCODE"))}nextToken(context);return{NATIVE:"",microprograma:microprograma,microcomments:microcomments}}function read_native(context){var microprograma=[];var microcomments=[];if(!isToken(context,"{")){return langError(context,i18n_get_TagFor("compiler","OPEN BRACE NOT FOUND"))}nextNative(context);var native_code=getToken(context);microprograma.push({});microcomments.push("");nextToken(context);return{NATIVE:native_code,microprograma:microprograma,microcomments:microcomments}}function find_first_cocop(context,curr_instruction,first_co,last_co){var k=0;var m=0;var ret={};ret.label_co="";ret.label_cop="";var cop_overlaps=false;for(m=0;m100){return langError(context,i18n_get_TagFor("compiler","MORE 100 FIELDS"))}if(auxValue=="co"){return langError(context,i18n_get_TagFor("compiler","CO AS FIELD NAME"))}if(auxValue=="nwords"){return langError(context,i18n_get_TagFor("compiler","NW AS FIELD NAME"))}}if(isToken(context,"(")){firma=firma+",(";if(plus_found)firmaUsuario=firmaUsuario+"+(";else firmaUsuario=firmaUsuario+" (";nextToken(context);if(!isToken(context,",")&&!isToken(context,"(")&&!isToken(context,")")){var campoAux={};campoAux.name=getToken(context);campos.push(campoAux);numeroCampos++;firma=firma+getToken(context);firmaUsuario=firmaUsuario+getToken(context);nextToken(context)}else{return langError(context,i18n_get_TagFor("compiler","MISSING TOKEN ON")+"'"+context.co_cop[instruccionAux.co].signature+"'")}if(isToken(context,")")){firma=firma+")";firmaUsuario=firmaUsuario+")";nextToken(context)}else{return langError(context,i18n_get_TagFor("compiler","MISSING ) ON")+"'"+context.co_cop[instruccionAux.co].signature+"'")}}firma=firma+",";firmaUsuario=firmaUsuario+" "}firma=firma.substr(0,firma.length-1);firma=firma.replace(/,,/g,",");firmaUsuario=firmaUsuario.substr(0,firmaUsuario.length-1);firmaUsuario=firmaUsuario.replace(/ /g," ");instruccionAux.signature=firma;instruccionAux.signatureGlobal=firma;instruccionAux.signatureUser=firmaUsuario;instruccionAux.signatureRaw=firmaUsuario;nextToken(context);if(!isToken(context,"co")){return langError(context,i18n_get_TagFor("compiler","NO CO FIELD"))}nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.co=getToken(context);if(getToken(context).match("[01]*")[0]!=getToken(context)||getToken(context).length!==xr_info.ir.default_eltos.co.length){return langError(context,i18n_get_TagFor("compiler","INCORRECT CO BIN.")+"'"+getToken(context)+"'")}if(instruccionAux.co!=all_ones_co){if(typeof context.co_cop[instruccionAux.co]!=="undefined"&&context.co_cop[instruccionAux.co].cop===null){return langError(context,i18n_get_TagFor("compiler","CO ALREADY USED")+context.co_cop[instruccionAux.co].signature)}if(typeof context.co_cop[instruccionAux.co]=="undefined"){context.co_cop[instruccionAux.co]={};context.co_cop[instruccionAux.co].signature=instruccionAux.signature;context.co_cop[instruccionAux.co].cop=null}}nextToken(context);if(isToken(context,","))nextToken(context);if(isToken(context,"cop")){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.cop=getToken(context);if(getToken(context).match("[01]*")[0]!=getToken(context)){return langError(context,i18n_get_TagFor("compiler","INCORRECT COP BIN.")+"'"+getToken(context)+"'")}if(context.co_cop[instruccionAux.co].cop!=null&&typeof context.co_cop[instruccionAux.co].cop[instruccionAux.cop]!="undefined"){return langError(context,i18n_get_TagFor("compiler","CO+COP ALREADY USED")+"'"+context.co_cop[instruccionAux.co].cop[instruccionAux.cop]+"'")}if(context.co_cop[instruccionAux.co].cop==null)context.co_cop[instruccionAux.co].cop={};context.co_cop[instruccionAux.co].cop[instruccionAux.cop]=instruccionAux.signature;nextToken(context);if(isToken(context,",")){nextToken(context)}}if(!isToken(context,"nwords")){return langError(context,i18n_get_TagFor("compiler","NO NWORDS"))}nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.nwords=getToken(context);nextToken(context);if(isToken(context,","))nextToken(context);var camposInsertados=0;var overlapping={};while(camposInsertados32*parseInt(instruccionAux.nwords)-1){return langError(context,i18n_get_TagFor("compiler","STARTBIT OoR")+"'"+getToken(context)+"'")}nextToken(context);if(!isToken(context,",")){return langError(context,i18n_get_TagFor("compiler","COMMA NOT FOUND"))}nextToken(context);campos[camposInsertados].stopbit=getToken(context);var stop=parseInt(campos[camposInsertados].stopbit);if(stop>32*parseInt(instruccionAux.nwords)){return langError(context,i18n_get_TagFor("compiler","STOPBIT OoR")+"'"+getToken(context)+"'")}for(i=stop;i<=start;i++){if(typeof overlapping[i]!="undefined"){return langError(context,i18n_get_TagFor("compiler","OVERLAPPING FIELD")+campos[camposInsertados].name)}overlapping[i]=1}nextToken(context);if(!isToken(context,")")){return langError(context,i18n_get_TagFor("compiler","CLOSE PAREN. NOT FOUND"))}nextToken(context);if(campos[camposInsertados].type=="address"){if(getToken(context)!="abs"&&getToken(context)!="rel"){return langError(context,i18n_get_TagFor("compiler","INCORRECT ADDRESSING"))}campos[camposInsertados].address_type=getToken(context);nextToken(context)}if(isToken(context,",")){nextToken(context)}camposInsertados++}instruccionAux.fields=campos;instruccionAux.help="";if(isToken(context,"help")){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.help=getToken(context);if("STRING"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","UNKNOWN ESCAPE CHAR")+"'"+getToken(context)+"'")}nextToken(context);if(isToken(context,",")){nextToken(context)}}instruccionAux.is_native=false;if(isToken(context,"native")){instruccionAux["is_native"]=true;nextToken(context);if(isToken(context,","))nextToken(context)}if(instruccionAux["is_native"]===false&&typeof instruccionAux.cop!=="undefined"&&instruccionAux.cop.length!==xr_info.ir.default_eltos.cop.length){return langError(context,i18n_get_TagFor("compiler","BAD COP BIN. LEN.")+"'"+getToken(context)+"'")}ret={};if(true==instruccionAux.is_native)ret=read_native(context);else ret=read_microprg(context);if(typeof ret.error!="undefined")return ret;instruccionAux.NATIVE=ret.NATIVE;instruccionAux.microcode=ret.microprograma;instruccionAux.microcomments=ret.microcomments;context.instrucciones.push(instruccionAux);context.contadorMC=context.contadorMC+9;if(!isToken(context,"}")){return langError(context,i18n_get_TagFor("compiler","CLOSE BRACE NOT FOUND"))}nextToken(context)}if(context.stackRegister==null){return langError(context,i18n_get_TagFor("compiler","SP NOT DEFINED"))}var found=false;for(i=0;i=last_co){return langError(context,i18n_get_TagFor("compiler","NO CO CODES"))}first_co=parseInt(r.label_co,2);curr_instruction.co=r.label_co;context.co_cop[r.label_co].signature=curr_instruction.signature;if(r.label_cop!==""){curr_instruction.cop=r.label_cop;context.co_cop[r.label_co].cop[r.label_cop]=curr_instruction.signature;context.co_cop[r.label_co].withcop=true}}var labelsFounded=0;if(context.labelsNotFound.length>0){for(i=0;i0){for(var j=0;j0){file+="registers"+"\n{\n";for(i=0;i1&&n[0]=="0"){return ret}if(typeof n==="string"&&n.includes(".")){return ret}if(!isNaN(parseFloat(n))&&isFinite(n)){ret.isDecimal=true;ret.number=parseInt(n);return ret}return ret}function isOctal(n){var ret={number:0,isDecimal:false};if(n.substring(0,1)=="0"){var octal=n.substring(1).replace(/\b0+/g,"");ret.number=parseInt(octal,8);ret.isDecimal=ret.number.toString(8)===octal;return ret}return ret}function isHex(n){var ret={number:0,isDecimal:false};if(n.substring(0,2).toLowerCase()=="0x"){var hex=n.substring(2).toLowerCase().replace(/\b0+/g,"");if(hex==""){hex="0"}ret.number=parseInt(hex,16);ret.isDecimal=ret.number.toString(16)===hex;return ret}return ret}function isChar(n){var ret={number:0,isDecimal:false};var ret1=treatControlSequences(n);if(true==ret1.error){return ret}var possible_value=ret1.string;if(possible_value[0]=="'"&&possible_value[2]=="'"||possible_value[0]=='"'&&possible_value[2]=='"'){ret.number=possible_value.charCodeAt(1);ret.isDecimal=true;return ret}return ret}function isFloat(n){var ret={number:0,isFloat:false};var non_float=/[a-df-zA-DF-Z]+/;if(non_float.test(n)===true){return ret}ret.number=parseFloat(n);ret.isFloat=!isNaN(ret.number);return ret}function get_decimal_value(possible_value){var ret={number:0,isDecimal:true};ret=isOctal(possible_value);if(ret.isDecimal===false){ret=isHex(possible_value)}if(ret.isDecimal===false){ret=isDecimal(possible_value)}if(ret.isDecimal===false){ret=isChar(possible_value)}return ret}function decimal2binary(number,size){var num_bits=number.toString(2);if(num_bits.length>WORD_LENGTH){return[num_bits,size-num_bits.length]}num_bits=(number>>>0).toString(2);if(number>=0){return[num_bits,size-num_bits.length]}num_bits="1"+num_bits.replace(/^[1]+/g,"");if(num_bits.length>size){return[num_bits,size-num_bits.length]}num_bits="1".repeat(size-num_bits.length)+num_bits;return[num_bits,size-num_bits.length]}function float2binary(f,size){var buf=new ArrayBuffer(8);var float=new Float32Array(buf);var uint=new Uint32Array(buf);float[0]=f;return decimal2binary(uint[0],size)}function get_inm_value(value){var ret1={};var ret={number:0,isDecimal:false,isFloat:false};ret1=get_decimal_value(value);if(ret1.isDecimal==true){ret1.isFloat=false;return ret1}ret1=isFloat(value);if(ret1.isFloat==true){ret1.isDecimal=false;return ret1}return ret}function isValidTag(tag){if(tag.trim()==""){return false}var ret=isDecimal(tag[0]);if(ret.isDecimal==true){return false}var myRegEx=/[^a-z,_\d]/i;return!myRegEx.test(tag)}function sum_array(a){return a.reduce((function(a,b){return a+b}),0)}function get_candidate(advance,instruction){var candidate=false;var candidates={};var signatures={};for(i=0;icandidates[i]){min=candidates[i];candidate=i}}}return candidate?parseInt(candidate):candidate}function reset_assembly(nwords){return"0".repeat(WORD_LENGTH*nwords)}function assembly_replacement(machineCode,num_bits,startbit,stopbit,free_space){var machineCodeAux=machineCode.substring(0,machineCode.length-startbit+free_space);machineCode=machineCodeAux+num_bits+machineCode.substring(machineCode.length-stopbit);return machineCode}function assembly_co_cop(machineCode,co,cop){var xr_info=simhw_sim_ctrlStates_get();if(co!==false)machineCode=assembly_replacement(machineCode,co,WORD_LENGTH,WORD_LENGTH-6,0);if(cop!==false)machineCode=assembly_replacement(machineCode,cop,xr_info.ir.default_eltos.cop.length,0,0);return machineCode}function writememory_and_reset(mp,gen,nwords){if(gen.byteWord>=WORD_BYTES){var melto={value:gen.machineCode,source_tracking:gen.track_source,comments:gen.comments};main_memory_set(mp,"0x"+gen.seg_ptr.toString(16),melto);gen.seg_ptr=gen.seg_ptr+WORD_BYTES;gen.byteWord=0;gen.track_source=[];gen.comments=[];gen.machineCode=reset_assembly(nwords)}}function is_end_of_file(context){return""===getToken(context)&&context.t>=context.text.length}function read_data(context,datosCU,ret){var seg_name=getToken(context);var gen={};gen.byteWord=0;gen.track_source=[];gen.comments=[];gen.machineCode=reset_assembly(1);gen.seg_ptr=ret.seg[seg_name].begin;nextToken(context);while(!is_directive_segment(getToken(context))&&!is_end_of_file(context)){var possible_tag="";while(!is_directive_datatype(getToken(context))&&!is_end_of_file(context)){possible_tag=getToken(context);if("TAG"!=getTokenType(context)){if(""==possible_tag){possible_tag="[empty]"}return langError(context,i18n_get_TagFor("compiler","NO TAG OR DIRECTIVE")+"'"+possible_tag+"'")}var tag=possible_tag.substring(0,possible_tag.length-1);if(!isValidTag(tag)){return langError(context,i18n_get_TagFor("compiler","INVALID TAG FORMAT")+"'"+tag+"'")}if(context.firmware[tag]){return langError(context,i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+tag+"'")}if(ret.labels2[tag]){return langError(context,i18n_get_TagFor("compiler","REPEATED TAG")+"'"+tag+"'")}ret.labels2[tag]="0x"+(gen.seg_ptr+gen.byteWord).toString(16);nextToken(context)}if(is_end_of_file(context)){break}var possible_datatype=getToken(context);if(".word"==possible_datatype||".half"==possible_datatype||".byte"==possible_datatype||".float"==possible_datatype||".double"==possible_datatype){var size=get_datatype_size(possible_datatype);nextToken(context);var possible_value=getToken(context);while(!is_directive(getToken(context))&&!is_end_of_file(context)){var label_found=false;var ret1=get_inm_value(possible_value);var number=ret1.number;if(ret1.isDecimal==false&&ret1.isFloat==false){if(".word"!==possible_datatype){return langError(context,i18n_get_TagFor("compiler","NO NUMERIC DATATYPE")+"'"+possible_value+"'")}if(!isValidTag(possible_value)){return langError(context,i18n_get_TagFor("compiler","INVALID TAG FORMAT")+"'"+possible_value+"'")}if(context.firmware[possible_value]){return langError(context,i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+possible_value+"'")}number=0;label_found=true}if(ret1.isDecimal==true)a=decimal2binary(number,size*BYTE_LENGTH);else a=float2binary(number,size*BYTE_LENGTH);num_bits=a[0];free_space=a[1];if(free_space<0){return langError(context,i18n_get_TagFor("compiler","EXPECTED VALUE")+possible_datatype+"' ("+size*BYTE_LENGTH+" bits), "+i18n_get_TagFor("compiler","BUT INSERTED")+possible_value+"' ("+num_bits.length+" bits) "+i18n_get_TagFor("compiler","INSTEAD"))}writememory_and_reset(ret.mp,gen,1);while((gen.seg_ptr+gen.byteWord)%size!=0){gen.byteWord++;writememory_and_reset(ret.mp,gen,1)}if(""!=possible_tag){ret.labels2[possible_tag.substring(0,possible_tag.length-1)]="0x"+(gen.seg_ptr+gen.byteWord).toString(16);possible_tag=""}if(label_found){ret.labels["0x"+gen.seg_ptr.toString(16)]={name:possible_value,addr:gen.seg_ptr,startbit:31,stopbit:0,rel:undefined,nwords:1,labelContext:getLabelContext(context)}}gen.machineCode=assembly_replacement(gen.machineCode,num_bits,BYTE_LENGTH*(size+gen.byteWord),BYTE_LENGTH*gen.byteWord,free_space);gen.byteWord+=size;gen.track_source.push(possible_value);nextToken(context);if(","==getToken(context)){nextToken(context)}if(is_directive(getToken(context))||"TAG"==getTokenType(context)||"."==getToken(context)[0]){break}possible_value=getToken(context)}}else if(".space"==possible_datatype){nextToken(context);var possible_value=getToken(context);var ret1=isDecimal(possible_value);possible_value=ret1.number;if(ret1.isDecimal==false){return langError(context,i18n_get_TagFor("compiler","NO NUMBER OF BYTES")+"'"+possible_value+"'")}if(possible_value<0){return langError(context,i18n_get_TagFor("compiler","NO POSITIVE NUMBER")+"'"+possible_value+"'")}for(i=0;i=0){return langError(context,i18n_get_TagFor("compiler","INVALID ALIGN VALUE")+"'"+possible_value+"'. "+i18n_get_TagFor("compiler","REMEMBER ALIGN VAL"))}writememory_and_reset(ret.mp,gen,1);var align_offset=Math.pow(2,parseInt(possible_value));switch(align_offset){case 1:break;case 2:if(gen.byteWord&1==1)gen.byteWord++;break;default:writememory_and_reset(ret.mp,gen,1);while(gen.seg_ptr%align_offset!=0||gen.byteWord!=0){gen.byteWord++;writememory_and_reset(ret.mp,gen,1)}}nextToken(context)}else if(".ascii"==possible_datatype||".asciiz"==possible_datatype){nextToken(context);var possible_value=getToken(context);var ret1=treatControlSequences(possible_value);if(true==ret1.error){return langError(context,ret1.string)}possible_value=ret1.string;while(!is_directive(getToken(context))&&!is_end_of_file(context)){writememory_and_reset(ret.mp,gen,1);if('"'!==possible_value[0]){return langError(context,i18n_get_TagFor("compiler","NO QUOTATION MARKS")+"'"+possible_value+"'")}if('"'!==possible_value[possible_value.length-1]){return langError(context,i18n_get_TagFor("compiler","NOT CLOSED STRING"))}if(""==possible_value){return langError(context,i18n_get_TagFor("compiler","NOT CLOSED STRING"))}if("STRING"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","NO QUOTATION MARKS")+"'"+possible_value+"'")}for(i=0;i0){var melto={value:gen.machineCode,source_tracking:gen.track_source,comments:gen.comments};main_memory_set(ret.mp,"0x"+gen.seg_ptr.toString(16),melto);gen.seg_ptr=gen.seg_ptr+WORD_BYTES}ret.seg[seg_name].end=gen.seg_ptr}function read_text(context,datosCU,ret){var seg_name=getToken(context);var seg_ptr=ret.seg[seg_name].begin;var firmware=context.firmware;var pseudoInstructions=context.pseudoInstructions;var finish=[];var isPseudo=false;var pfinish=[];var npseudoInstructions=0;var pseudo_fields={};var counter=-1;var candidate;var error="";var registers={};for(i=0;i=signature_fields[j].length){if("TAG"!=getTokenType(context)&&!firmware[value]&&!is_end_of_file(context)){advance[j]=0}continue}var field=firmware[instruction][j].fields[i];var size=field.startbit-field.stopbit+1;var label_found=false;var sel_found=false;switch(field.type){case"address":case"inm":if(isPseudo&&"sel"==value){counter++;var start=pfinish[counter++];var stop=pfinish[counter++];var value=pseudo_fields[pfinish[counter++]];counter++;sel_found=true}var ret1=get_inm_value(value);converted=ret1.number;if(ret1.isDecimal==false&&ret1.isFloat==false){error=i18n_get_TagFor("compiler","NO NUMERIC DATATYPE")+"'"+value+"'";if(value[0]=="'"){advance[j]=0;break}if(!isValidTag(value)){advance[j]=0;break}if(firmware[value]){error=i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+value+"'";advance[j]=0;break}label_found=true}if(sel_found){if(ret1.isDecimal==true)res=decimal2binary(converted,WORD_LENGTH);else res=float2binary(converted,WORD_LENGTH);if(res[1]<0){return langError(context,"'"+value+"' "+i18n_get_TagFor("compiler","BIGGER THAN")+WORD_LENGTH+" "+i18n_get_TagFor("compiler","BITS"))}converted="0".repeat(res[1])+res[0];converted=converted.substring(WORD_LENGTH-start-1,WORD_LENGTH-stop);converted=parseInt(converted,2);s[i+1]="0x"+converted.toString(16)}if(!label_found){if(ret1.isDecimal==true)var res=decimal2binary(converted,size);else var res=float2binary(converted,size);if(field.type=="address"&&"rel"==field.address_type){res=decimal2binary(converted-seg_ptr-WORD_BYTES,size)}}break;case"reg":if(typeof value==="undefined"){error=i18n_get_TagFor("compiler","INS. MISSING FIELD");advance[j]=0;break}var aux=false;if(value.startsWith("(")){if("(reg)"!=signature_fields[j][i]){error=i18n_get_TagFor("compiler","UNEXPECTED (REG)");advance[j]=0;break}if(counter==-1){nextToken(context);value=getToken(context)}else{value=pseudo_fields[pfinish[counter++]]}aux=true}else{if("(reg)"==signature_fields[j][i]){error=i18n_get_TagFor("compiler","EXPECTED (REG)")+"'"+value+"'";advance[j]=0;break}}if(typeof registers[value]==="undefined"){error=i18n_get_TagFor("compiler","EXPECTED REG")+"'"+value+"'";advance[j]=0;break}if(aux){s[i+1]="("+value+")";if(counter==-1){nextToken(context);aux=getToken(context)}else{aux=pfinish[counter++]}if(")"!=aux){error=i18n_get_TagFor("compiler","CLOSE PAREN. NOT FOUND");advance[j]=0;break}}var ret1=isDecimal(registers[value]);converted=ret1.number;var res=decimal2binary(converted,size);value=s[i+1];break;default:return langError(context,i18n_get_TagFor("compiler","UNKNOWN 1")+"'"+field.type+"'")}if(advance[j]==1&&!label_found){if(res[1]<0){if(field.type=="address"&&"rel"==field.address_type){error="Relative value ("+(converted-seg_ptr-WORD_BYTES)+" in decimal)"+i18n_get_TagFor("compiler","NEEDS")+res[0].length+i18n_get_TagFor("compiler","SPACE FOR # BITS")+size+" "+i18n_get_TagFor("compiler","BITS")}else{error="'"+value+"'"+i18n_get_TagFor("compiler","NEEDS")+res[0].length+i18n_get_TagFor("compiler","SPACE FOR # BITS")+size+" "+i18n_get_TagFor("compiler","BITS")}advance[j]=0}}if(advance[j]==1&&!(isPseudo&&counter==-1)){binaryAux[j][i]={num_bits:label_found?false:res[0],free_space:label_found?false:res[1],startbit:field.startbit,stopbit:field.stopbit,rel:label_found?field.address_type:false,islabel:label_found,field_name:value}}}if(sum_array(advance)==0){break}if("TAG"==getTokenType(context)||firmware[value]){break}}for(i=0;i0&&i0&&i==firmware[instruction].length-1){format+=" or "}format+="'"+firmware[instruction][i].signatureUser+"'"}if(format==""){format="'"+instruction+"' "+i18n_get_TagFor("compiler","UNKNOWN MC FORMAT")}var sum_res=sum_array(advance);if(sum_res==0){if(advance.length===1){return langError(context,error+".
"+i18n_get_TagFor("compiler","REMEMBER I. FORMAT")+format)}return langError(context,i18n_get_TagFor("compiler","NOT MATCH MICRO")+"
"+i18n_get_TagFor("compiler","REMEMBER I. FORMAT")+format+". "+i18n_get_TagFor("compiler","CHECK MICROCODE"))}if(sum_res>1){candidate=get_candidate(advance,firmware[instruction]);if(candidate===false){return langError(context,i18n_get_TagFor("compiler","SEVERAL CANDIDATES")+format)}}if(isPseudo){if(counter==-1){var s_ori=s.join(" ");s_ori=s_ori.trim();var key="";var val="";pseudo_fields={};for(i=0;i1){s_ori=" "}if(pfinish[counter]=="\n"){counter++}}var machineCode=reset_assembly(firmware[instruction][candidate].nwords);machineCode=assembly_co_cop(machineCode,firmware[instruction][candidate].co,firmware[instruction][candidate].cop);for(i=0;i=0;i--){if(icontext.text.length){break}}ret.seg[seg_name].end=seg_ptr}function simlang_compile(text,datosCU){var context={};context.line=1;context.error=null;context.i=0;context.contadorMC=0;context.etiquetas={};context.labelsNotFound=[];context.instrucciones=[];context.co_cop={};context.registers=[];context.text=text;context.tokens=[];context.token_types=[];context.t=0;context.newlines=[];context.pseudoInstructions=[];context.stackRegister=null;context.firmware={};context.comments=[];for(i=0;i=0;j--){var melto={value:machineCode.substring(j*WORD_LENGTH,(j+1)*WORD_LENGTH),source_tracking:null,comments:null};main_memory_set(ret.mp,"0x"+auxAddr.toString(16),melto);auxAddr+=WORD_BYTES}}if(text_found){if(typeof ret.labels2["main"]==="undefined"&&typeof ret.labels2["kmain"]==="undefined"){return langError(context,i18n_get_TagFor("compiler","NO MAIN OR KMAIN"))}}for(var key in ret.labels2){ret.revlabels2[ret.labels2[key]]=key}for(var skey in ret.seg){ret.revseg.push({begin:parseInt(ret.seg[skey].begin),name:skey})}return ret}var WSCFG={};function get_cfg(field){return WSCFG[field].value}function set_cfg(field,value){WSCFG[field].value=value}function update_cfg(field,value){WSCFG[field].value=value;simcore_record_append_new("Set configuration option "+field+" to "+value,'update_cfg("'+field+'","'+value+'");\n');ga("send","event","config","config."+WSCFG.version.value,"config."+WSCFG.version.value+"."+field+"."+value);save_cfg()}function is_cfg_empty(){return Object.keys(WSCFG).length===0}function save_cfg(){try{for(var item in WSCFG){localStorage.setItem("wepsim_"+item,get_cfg(item))}}catch(err){console.log("WepSIM can not save the configuration in a persistent way on this web browser,\n"+"found following error: \n"+err.message)}set_secondary_cfg()}function restore_cfg(){WSCFG=get_primary_cfg();set_secondary_cfg();if(localStorage===null){return}var default_value=null;var saved_value=null;for(var item in WSCFG){if(item==="version"){continue}default_value=get_cfg(item);set_cfg(item,localStorage.getItem("wepsim_"+item));if(WSCFG[item].type!="string"){try{saved_value=JSON.parse(get_cfg(item));set_cfg(item,saved_value)}catch(e){saved_value=null}}if(saved_value===null){set_cfg(item,default_value)}}set_secondary_cfg()}function reset_cfg(){WSCFG=get_primary_cfg();set_secondary_cfg();save_cfg()}function reset_cfg_values(){WSCFG=get_primary_cfg();set_secondary_cfg()}function upgrade_cfg(){var wscfg=get_primary_cfg();var item=null;for(item in wscfg){if(typeof WSCFG[item]==="undefined"){WSCFG[item]=wscfg[item]}if(WSCFG[item].value===null||WSCFG[item].value==="null"){WSCFG[item].value=wscfg[item].value}}if(wscfg.build.value!=WSCFG.build.value){for(item in wscfg){if(wscfg[item].upgrade){WSCFG[item]=wscfg[item]}}}set_secondary_cfg();save_cfg()}function is_mobile(){if(typeof navigator==="undefined"){return false}return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function is_cordova(){return document.URL.indexOf("http://")===-1&&document.URL.indexOf("https://")===-1}function get_primary_cfg(){var wscfg={version:{upgrade:false,type:"string",value:"2.1.5"},build:{upgrade:true,type:"string",value:"2.1.5.20201220A"},color_data_active:{upgrade:false,type:"string",value:"#0066FF"},color_data_inactive:{upgrade:false,type:"string",value:"rgb(0, 0, 0)"},color_name_active:{upgrade:false,type:"string",value:"red"},color_name_inactive:{upgrade:false,type:"string",value:"rgb(0, 0, 0)"},size_active:{upgrade:false,type:"float",value:1.25},size_inactive:{upgrade:false,type:"float",value:.02},is_byvalue:{upgrade:false,type:"boolean",value:false},RF_display_format:{upgrade:false,type:"string",value:"unsigned_16_fill"},RF_display_name:{upgrade:false,type:"string",value:"numerical"},MEM_display_format:{upgrade:true,type:"string",value:"unsigned_16_nofill"},MEM_show_segments:{upgrade:true,type:"boolean",value:false},MEM_show_source:{upgrade:true,type:"boolean",value:false},MEM_display_direction:{upgrade:true,type:"string",value:"h2l"},is_editable:{upgrade:false,type:"boolean",value:true},DBG_delay:{upgrade:false,type:"int",value:5},DBG_level:{upgrade:false,type:"string",value:"microinstruction"},DBG_limitins:{upgrade:false,type:"int",value:1e4},DBG_limitick:{upgrade:false,type:"int",value:1e3},ICON_theme:{upgrade:false,type:"string",value:"classic"},AS_enable:{upgrade:true,type:"boolean",value:true},AS_delay:{upgrade:true,type:"int",value:500},NOTIF_delay:{upgrade:false,type:"int",value:1e3},CPUCU_size:{upgrade:true,type:"int",value:7},C1C2_size:{upgrade:true,type:"int",value:8},SHOWCODE_label:{upgrade:false,type:"boolean",value:true},SHOWCODE_addr:{upgrade:false,type:"boolean",value:true},SHOWCODE_hex:{upgrade:false,type:"boolean",value:true},SHOWCODE_ins:{upgrade:false,type:"boolean",value:true},SHOWCODE_pins:{upgrade:false,type:"boolean",value:true},ws_mode:{upgrade:false,type:"string",value:"newbie"},ws_action:{upgrade:false,type:"string",value:"checkpoint"},is_interactive:{upgrade:false,type:"boolean",value:true},is_quick_interactive:{upgrade:false,type:"boolean",value:false},ws_idiom:{upgrade:false,type:"string",value:"en"},use_voice:{upgrade:false,type:"boolean",value:false},ws_skin_ui:{upgrade:false,type:"string",value:"classic"},ws_skin_user:{upgrade:false,type:"string",value:"only_asm:of:only_frequent:of"},ws_skin_dark_mode:{upgrade:false,type:"boolean",value:false},editor_theme:{upgrade:false,type:"string",value:"default"},editor_mode:{upgrade:false,type:"string",value:"default"},base_url:{upgrade:true,type:"string",value:"https://acaldero.github.io/wepsim/ws_dist/"},cfg_url:{upgrade:true,type:"string",value:"examples/configuration/default.json"},example_url:{upgrade:true,type:"string",value:"examples/examples_set/default.json"},hw_url:{upgrade:true,type:"string",value:"examples/hardware/hw.json"},max_json_size:{upgrade:true,type:"int",value:1*1024*1024},verbal_verbose:{upgrade:false,type:"string",value:"math"}};if(is_mobile()){wscfg.NOTIF_delay.value=2e3;wscfg.ICON_theme.value="cat1";wscfg.CPUCU_size.value=7;wscfg.C1C2_size.value=14;wscfg.ws_skin_ui.value="compact"}return wscfg}function set_secondary_cfg(){var dbg_delay=get_cfg("DBG_delay");if(dbg_delay<5){cfg_show_rf_delay=350;cfg_show_eltos_delay=350;cfg_show_main_memory_delay=450;cfg_show_control_memory_delay=360;cfg_show_dbg_ir_delay=300;cfg_show_rf_refresh_delay=120}else{cfg_show_rf_delay=100;cfg_show_eltos_delay=100;cfg_show_main_memory_delay=150;cfg_show_control_memory_delay=120;cfg_show_dbg_ir_delay=100;cfg_show_rf_refresh_delay=30}cfg_show_asmdbg_pc_delay=50;if(dbg_delay<3)cfg_show_asmdbg_pc_delay=150}var ws_cfg_hash={};var ws_cfg_set=[];function cfgset_init(){var url_list=get_cfg("cfg_url");ws_cfg_set=wepsim_url_getJSON(url_list);for(var i=0;i"+index+"/"+ws_records.length+" "+msg)}if(ws_record_pb_obj!==null){var next_pbval=100*index/ws_records.length;ws_record_pb_obj.css("width",next_pbval+"%").attr("aria-valuenow",next_pbval)}}function simcore_record_playAt(index_current,index_last){if(ws_is_playing===false){simcore_record_showMsg(ws_last_played,"Stopped by user.");return}ws_last_played=index_current;if(index_current>=index_last){simcore_record_showMsg(index_last,"Done.");return}if(ws_records[index_current].description==="_pending event_"){simcore_record_playAt(index_current+1,index_last);return}eval(ws_records[index_current].element);var index_next=index_current+1;simcore_record_showMsg(index_next,ws_records[index_current].description);var wait_time=500;if(index_next0&&ws_records[ws_records.length-1].description==="_pending event_"){distance=ws_glowing_time}simcore_record_pushElto("_pending event_",";",distance)}}function simcore_record_resolve_pending(description,elto){if(ws_is_recording===true){var last_pending=ws_records.length;while(last_pending>0){last_pending--;if(ws_records[last_pending].description==="_pending event_"){break}}if(last_pending===0){simcore_record_setTimeBeforeNow(0);simcore_record_append_new(description,elto);return}ws_records[last_pending].description=description;ws_records[last_pending].element=elto;simcore_record_showMsg(0,"Recording...")}}function simcore_record_setTimeBeforeNow(distance){ws_last_time=Date.now()-distance}function simcore_record_addTimeAfterLast(distance){ws_last_time=ws_last_time+distance}function get_simware(){var cf=simhw_internalState("FIRMWARE");if(typeof cf["firmware"]=="undefined")cf["firmware"]=[];if(typeof cf["mp"]=="undefined")cf["mp"]={};if(typeof cf["seg"]=="undefined")cf["seg"]={};if(typeof cf["labels"]=="undefined")cf["labels"]={};if(typeof cf["labels2"]=="undefined")cf["labels2"]={};if(typeof cf["labels_firm"]=="undefined")cf["labels_firm"]={};if(typeof cf["registers"]=="undefined")cf["registers"]={};if(typeof cf["pseudoInstructions"]=="undefined")cf["pseudoInstructions"]=[];if(typeof cf["stackRegister"]=="undefined")cf["stackRegister"]=null;if(typeof cf["cihash"]=="undefined")cf["cihash"]={};if(typeof cf["cocop_hash"]=="undefined")cf["cocop_hash"]={};if(typeof cf["revlabels"]=="undefined")cf["revlabels"]={};if(typeof cf["revlabels2"]=="undefined")cf["revlabels2"]={};if(typeof cf["revseg"]=="undefined")cf["revseg"]=[];return cf}function set_simware(preWARE){var cf=simhw_internalState("FIRMWARE");if(typeof preWARE["firmware"]!="undefined")cf["firmware"]=preWARE["firmware"];if(typeof preWARE["mp"]!="undefined")cf["mp"]=preWARE["mp"];if(typeof preWARE["registers"]!="undefined")cf["registers"]=preWARE["registers"];if(typeof preWARE["pseudoInstructions"]!="undefined")cf["pseudoInstructions"]=preWARE["pseudoInstructions"];if(typeof preWARE["seg"]!="undefined")cf["seg"]=preWARE["seg"];if(typeof preWARE["labels"]!="undefined")cf["labels"]=preWARE["labels"];if(typeof preWARE["revlabels"]!="undefined")cf["revlabels"]=preWARE["revlabels"];if(typeof preWARE["revlabels2"]!="undefined")cf["revlabels2"]=preWARE["revlabels2"];if(typeof preWARE["labels_firm"]!="undefined")cf["labels_firm"]=preWARE["labels_firm"];if(typeof preWARE["stackRegister"]!="undefined")cf["stackRegister"]=preWARE["stackRegister"];if(typeof preWARE["cihash"]!="undefined")cf["cihash"]=preWARE["cihash"];if(typeof preWARE["cocop_hash"]!="undefined")cf["cocop_hash"]=preWARE["cocop_hash"];if(typeof preWARE["labels2"]!="undefined")cf["labels2"]=preWARE["labels2"];if(typeof preWARE["revseg"]!="undefined")cf["revseg"]=preWARE["revseg"]}function array_includes(arr,val){if(typeof arr.includes!="undefined"){return arr.includes(val)}for(var i=0;i0)tri_name=tri_activated_name;if(tri_activated>1)break}if(tri_activated>0){update_draw(simhw_sim_signal(tri_name),1)}if(simhw_internalState_get("fire_visible","internalbus")==true){update_bus_visibility("internalbus_fire","hidden");simhw_internalState_set("fire_visible","internalbus",false)}if(tri_activated>1){update_bus_visibility("internalbus_fire","visible");simhw_internalState_set("fire_visible","internalbus",true);simhw_sim_state("BUS_IB").value=4294967295}}function fn_updateE_now(key){if("E"==simhw_sim_signal(key).type){update_state(key)}}function fn_updateE_future(key){if(jit_fire_ndep[key]<1)fn_updateE_now(key);else return new Promise((function(resolve,reject){fn_updateE_now(key)}))}function fn_updateL_now(key){update_draw(simhw_sim_signal(key),simhw_sim_signal(key).value);if("L"==simhw_sim_signal(key).type){update_state(key)}}function fn_updateL_future(key){if(jit_fire_ndep[key]<1)fn_updateL_now(key);else return new Promise((function(resolve,reject){fn_updateL_now(key)}))}function update_state(key){var index_behavior=0;switch(simhw_sim_signal(key).behavior.length){case 0:return;break;case 1:index_behavior=0;break;default:index_behavior=simhw_sim_signal(key).value;if(simhw_sim_signal(key).behavior.lengthreg_maddr){break}assoc_i=i}if(-1==assoc_i){ws_alert("A new 'unknown' instruction is inserted,\n"+"please edit it (co, nwords, etc.) in the firmware textarea.");var new_ins=new Object;new_ins["name"]="unknown";new_ins["signature"]="unknown";new_ins["signatureGlobal"]="unknown";new_ins["co"]=0;new_ins["nwords"]=0;new_ins["mc-start"]=0;new_ins["fields"]=new Array;new_ins["microcode"]=new Array;new_ins["microcomments"]=new Array;SIMWARE["firmware"].push(new_ins);assoc_i=SIMWARE["firmware"].length-1}var pos=reg_maddr-parseInt(SIMWARE["firmware"][assoc_i]["mc-start"]);if(typeof SIMWARE["firmware"][assoc_i]["microcode"][pos]=="undefined"){SIMWARE["firmware"][assoc_i]["microcode"][pos]=new Object;SIMWARE["firmware"][assoc_i]["microcomments"][pos]=""}SIMWARE["firmware"][assoc_i]["microcode"][pos][key]=simhw_sim_signal(key).value;if(simhw_sim_signal(key).default_value==simhw_sim_signal(key).value){delete SIMWARE["firmware"][assoc_i]["microcode"][pos][key]}var bits=get_value(simhw_sim_state("REG_IR")).toString(2);bits="00000000000000000000000000000000".substring(0,32-bits.length)+bits;show_memories_values()}function propage_signal_update(key){if(true===get_cfg("is_interactive")){if(simhw_sim_signal(key).value!=simhw_sim_signal(key).default_value)simhw_sim_state("REG_MICROINS").value[key]=simhw_sim_signal(key).value;else delete simhw_sim_state("REG_MICROINS").value[key];var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var curr_maddr=get_value(simhw_sim_state(maddr_name));var mc_obj=simhw_internalState("MC");var mcelto=control_memory_get(mc_obj,curr_maddr);if(typeof mcelto==="undefined"){mcelto={}}mcelto.value[key]=simhw_sim_signal(key).value;mcelto.comments=[];control_memory_set(mc_obj,curr_maddr,mcelto);update_signal_firmware(key);var SIMWARE=get_simware();document.getElementById("inputFirmware").value=saveFirmware(SIMWARE)}compute_behavior("FIRE "+key)}function update_memories(preSIMWARE){var i=0;set_simware(preSIMWARE);var SIMWARE=get_simware();simhw_internalState_reset("MC",{});var mc_obj=simhw_internalState("MC");var mcelto=null;for(i=0;i>23&255)-127;var mantissa=1+(hexvalue&8388607)/8388608;var valuef=sign*mantissa*Math.pow(2,exponent);if(-127===exponent)if(1===mantissa)valuef=sign===1?"+0":"-0";else valuef=sign*((hexvalue&8388607)/8388607)*Math.pow(2,-126);if(128===exponent)if(1===mantissa)valuef=sign===1?"+Inf":"-Inf";else valuef="NaN";return valuef}function hex2char8(hexvalue){var valuec=[];valuec[0]=String.fromCharCode((hexvalue&4278190080)>>24);valuec[1]=String.fromCharCode((hexvalue&16711680)>>16);valuec[2]=String.fromCharCode((hexvalue&65280)>>8);valuec[3]=String.fromCharCode((hexvalue&255)>>0);return valuec}function simcoreui_pack(val,pack_size){var base_str="0".repeat(pack_size);return base_str.substring(0,pack_size-val.length)+val}function hex2bin(hexvalue){var valuebin=hexvalue.toString(2);valuebin=simcoreui_pack(valuebin,32);valuebin=valuebin.substring(0,4)+" "+valuebin.substring(4,8)+" "+valuebin.substring(8,12)+" "+valuebin.substring(12,16)+"
"+valuebin.substring(16,20)+" "+valuebin.substring(20,24)+" "+valuebin.substring(24,28)+" "+valuebin.substring(28,32);return valuebin}function value2string(format,value){var fmt_value="";var fmt=format.split("_");switch(fmt[0]){case"unsigned":fmt_value=value.toString(fmt[1]).toUpperCase();break;case"float":fmt_value=hex2float(value);break;case"char":fmt_value="'"+String.fromCharCode(value)+"'";break;default:fmt_value=value.toString()}if(fmt[2]==="fill"){fmt_value=simcoreui_pack(fmt_value,8)}return fmt_value}function get_deco_from_pc(pc){var mp_obj=simhw_internalState("MP");if(typeof mp_obj==="undefined"||typeof mp_obj[pc]==="undefined"||typeof mp_obj[pc].source==="undefined"){return""}return mp_obj[pc].source}function get_verbal_from_current_mpc(){var active_signals="";var active_verbal="";var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var curr_maddr=get_value(simhw_sim_state(maddr_name));var mcelto=simhw_internalState_get("MC",curr_maddr);var mins=get_value(mcelto);for(var key in mins){if("MADDR"===key){active_verbal=active_verbal+"MADDR is "+mins[key]+". ";continue}active_signals=active_signals+key+" ";active_verbal=active_verbal+compute_signal_verbals(key,mins[key])}active_signals=active_signals.trim();if(active_signals==="")active_signals="";if(active_verbal.trim()==="")active_verbal="";return"Activated signals are: "+active_signals+". Associated actions are: "+active_verbal}function get_verbal_from_current_pc(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=get_value(simhw_sim_state(pc_name));var pc=parseInt(reg_pc)-4;var decins=get_deco_from_pc(pc);if(""==decins.trim()){decins="not jet defined"}return"Current instruction is: "+decins+" and PC points to "+show_value(pc)+". "}function ko_observable(initial_value){if(typeof ko==="undefined"){return initial_value}if(typeof cfg_show_rf_refresh_delay==="undefined"){cfg_show_rf_refresh_delay=120}return ko.observable(initial_value).extend({rateLimit:cfg_show_rf_refresh_delay})}function ko_rebind_state(state,id_elto){if(typeof ko==="undefined"){return}if(typeof cfg_show_rf_refresh_delay==="undefined"){cfg_show_rf_refresh_delay=120}var state_obj=simhw_sim_state(state);if(typeof state_obj.value!=="function"){state_obj.value=ko.observable(state_obj.value).extend({rateLimit:cfg_show_rf_refresh_delay})}var ko_context=document.getElementById(id_elto);ko.cleanNode(ko_context);ko.applyBindings(simhw_sim_state(state),ko_context)}function show_rf_names(){return simcore_action_ui("CPU",0,"show_rf_names")()}function get_screen_content(){return simcore_action_ui("SCREEN",0,"get_screen_content")()}function set_screen_content(screen){simcore_action_ui("SCREEN",0,"set_screen_content")(screen)}function get_keyboard_content(){return simcore_action_ui("KBD",0,"get_keyboard_content")()}function set_keyboard_content(keystrokes){simcore_action_ui("KBD",0,"set_keyboard_content")(keystrokes)}function show_main_memory(memory,index,redraw,updates){return simcore_action_ui("MEMORY",0,"show_main_memory")(memory,index,redraw,updates)}function show_control_memory(memory,index,redraw){return simcore_action_ui("MEMORY",0,"show_control_memory")(memory,index,redraw)}function show_memories_values(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=get_value(simhw_sim_state(pc_name));show_main_memory(simhw_internalState("MP"),reg_pc,true,true);var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var reg_maddr=get_value(simhw_sim_state(maddr_name));show_control_memory(simhw_internalState("MC"),reg_maddr,true)}function update_draw(obj,value){return simcore_action_ui("CPU",1,"update_draw")(obj,value)}function update_bus_visibility(bus_name,value){return simcore_action_ui("CPU",1,"update_bus_visibility")(bus_name,value)}function refresh(){for(var key in simhw_sim_signals()){update_draw(simhw_sim_signals()[key],simhw_sim_signals()[key].value);check_buses(key)}show_dbg_ir(get_value(simhw_sim_state("REG_IR_DECO")))}function show_dbg_ir(value){return simcore_action_ui("MEMORY",0,"show_dbg_ir")(value)}function show_dbg_mpc(){return simcore_action_ui("MEMORY",0,"show_dbg_mpc")()}function show_asmdbg_pc(){return simcore_action_ui("MEMORY",0,"show_asmdbg_pc")()}function ws_alert(msg){if(typeof document==="undefined"){console.log(msg);return true}alert(msg);return true}function element_scroll_get(list_id){var offset=0;var obj_byid=$(list_id);if(obj_byid.length>0){offset=obj_byid[0].scrollTop}return offset}function element_scroll_set(list_id,offset){var obj_byid=$(list_id);if(obj_byid.length>0){obj_byid[0].scrollTop=offset}}function element_scroll_setRelative(list_id,obj_id,offset){var obj_byid=$(obj_id);if(obj_byid.length>0){var topPos=obj_byid[0].offsetTop;element_scroll_set(list_id,topPos+offset)}}function simcore_init(with_ui){var ret={};ret.msg="";ret.ok=true;if(with_ui){restore_cfg()}else{reset_cfg_values()}return ret}function simcore_init_hw(simhw_name){var ret={};ret.msg="";ret.ok=true;var hwid=simhw_getIdByName(simhw_name);if(hwid<0){ret.msg="ERROR: unknown hardware: "+simhw_name+".
\n";ret.ok=false;return ret}simhw_setActive(hwid);var ret1=simcore_init_ui({});if(false===ret1.ok){ret.msg=ret.msg;ret.ok=false;return ret}return ret}function simcore_welcome(){var ret={};ret.msg="";ret.ok=true;console.log("");console.log("██╗ ██╗███████╗██████╗ ███████╗██╗███╗ ███╗");console.log("██║ ██║██╔════╝██╔══██╗██╔════╝██║████╗ ████║");console.log("██║ █╗ ██║█████╗ ██████╔╝███████╗██║██╔████╔██║");console.log("██║███╗██║██╔══╝ ██╔═══╝ ╚════██║██║██║╚██╔╝██║");console.log("╚███╔███╔╝███████╗██║ ███████║██║██║ ╚═╝ ██║");console.log(" ╚══╝╚══╝ ╚══════╝╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝");console.log("");console.log("Stable: https://github.com/wepsim/wepsim");console.log("Beta: https://github.com/acaldero/wepsim");console.log("");return ret}function simcore_init_ui(hash_detail2init){var ret={};ret.msg="";ret.ok=true;var detail_id=0;var sim_components=simhw_sim_components();for(var elto in sim_components){sim_components[elto].details_ui=[];for(var index in sim_components[elto].details_name){sim_components[elto].details_ui[index]={};detail_id=sim_components[elto].details_name[index];if(typeof hash_detail2init[detail_id]!=="undefined"){sim_components[elto].details_ui[index]=hash_detail2init[detail_id];sim_components[elto].details_ui[index].init()}}}return ret}function simcore_action_ui(component_name,detail_id,action_name){var sim_components=simhw_sim_components();if(typeof sim_components[component_name].details_ui[detail_id][action_name]==="undefined"){return simcore_do_nothing_handler}return sim_components[component_name].details_ui[detail_id][action_name]}function simcore_init_eventlistener(context,hash_detail2action,hash_signal2action){var context_obj=null;var r=[];var o=null;context_obj=document.getElementById(context).contentDocument;if(null==context_obj){console.log('warning: unreferenced graphic element context named "'+r[0]+'".');return}var sim_signals=simhw_sim_signals();for(var key in sim_signals){if(typeof hash_signal2action[key+"click"]==="undefined"){hash_signal2action[key+"click"]=function(key_value){return function(){hash_signal2action[""](key_value,"click")}}(key)}if(typeof hash_signal2action[key+"dblclick"]==="undefined"){hash_signal2action[key+"dblclick"]=function(key_value){return function(){hash_signal2action[""](key_value,"dblclick")}}(key)}for(var j=0;j\n"+"Please load some assembly code.
";ret.ok=false;return ret}var SIMWARE=get_simware();if(!(typeof curr_segments[".ktext"]!="undefined"&&SIMWARE.labels2.kmain)&&!(typeof curr_segments[".text"]!="undefined"&&SIMWARE.labels2.main)){ret.msg="labels 'kmain' (in .ktext) or 'main' (in .text) do not exist!";ret.ok=false;return ret}return ret}function simcore_check_if_can_continue2(reg_maddr,reg_pc){var ret={};ret.ok=true;ret.msg="";var curr_MC=simhw_internalState("MC");var mcelto=control_memory_get(curr_MC,reg_maddr);if(typeof mcelto==="undefined"){var hex_maddr="0x"+parseInt(reg_maddr).toString(16);ret.ok=false;ret.msg="Error: undefined microinstruction at "+hex_maddr+".";return ret}var curr_segments=simhw_internalState("segments");if(reg_pc=curr_segments[".ktext"].begin){return ret}if(reg_pc=curr_segments[".text"].begin){return ret}if(mcelto.is_native&&0===reg_maddr){return ret}if(0!==reg_maddr){if(reg_pc==curr_segments[".ktext"].end||reg_pc==curr_segments[".text"].end){return ret}}ret.ok=false;ret.msg="The program has finished because the PC register points outside .ktext/.text code segments";return ret}function simcore_check_if_can_continue(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=parseInt(get_value(simhw_sim_state(pc_name)));var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var reg_maddr=get_value(simhw_sim_state(maddr_name));return simcore_check_if_can_continue2(reg_maddr,reg_pc)}function simcore_reset(){var ret={};ret.msg="";ret.ok=true;var SIMWARE=get_simware();var curr_firm=simhw_internalState("FIRMWARE");var curr_segments=simhw_internalState("segments");var curr_MC=simhw_internalState("MC");var sim_components=simhw_sim_components();var ctrl_states=simhw_sim_ctrlStates_get();var pc_name=ctrl_states.pc.state;var pc_state=simhw_sim_state(pc_name);var sp_name=ctrl_states.sp.state;var sp_state=simhw_sim_state(sp_name);if(curr_firm.stackRegister!=null){sp_name=curr_firm.stackRegister;sp_state=simhw_sim_states().BR[sp_name];ctrl_states.sp.state="BR."+curr_firm.stackRegister}for(var elto in sim_components){var reset_signal_name=sim_components[elto].name+"_RESET";compute_general_behavior(reset_signal_name)}if(typeof curr_segments[".ktext"]!=="undefined"&&SIMWARE.labels2.kmain){set_value(pc_state,parseInt(SIMWARE.labels2.kmain));show_asmdbg_pc()}else if(typeof curr_segments[".text"]!=="undefined"&&SIMWARE.labels2.main){set_value(pc_state,parseInt(SIMWARE.labels2.main));show_asmdbg_pc()}if(typeof curr_segments[".stack"]!=="undefined"&&typeof sp_state!=="undefined"){set_value(sp_state,parseInt(curr_segments[".stack"].end)&4294967292)}var new_maddr=get_value(simhw_sim_state("MUXA_MICROADDR"));var mcelto=control_memory_get(curr_MC,new_maddr);if(typeof mcelto==="undefined"){mcelto={value:simhw_sim_state("REG_MICROINS").default_value,is_native:false}}var new_mins=get_value(mcelto);if(false==mcelto.is_native){compute_general_behavior("CLOCK")}show_dbg_ir(get_value(simhw_sim_state("REG_IR_DECO")));for(elto in sim_components){for(var index in sim_components[elto].details_name){if(typeof sim_components[elto].details_ui[index].reset!=="undefined"){sim_components[elto].details_ui[index].reset()}}}return ret}function simcore_execute_microinstruction(){var ret=simcore_check_if_can_continue();if(false===ret.ok){return ret}compute_general_behavior("CLOCK");show_dbg_mpc();return ret}function simcore_execute_microinstruction2(reg_maddr,reg_pc){var ret=simcore_check_if_can_continue2(reg_maddr,reg_pc);if(false===ret.ok){return ret}compute_general_behavior("CLOCK");show_dbg_mpc();return ret}function simcore_execute_microprogram(options){var ret=simcore_check_if_can_continue();if(false===ret.ok){return ret}var before_state=null;var after_state=null;var curr_mpc="";var curr_MC=simhw_internalState("MC");var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var maddr_state=simhw_sim_state(maddr_name);if(typeof options.before_microinstruction==="undefined"){options.before_microinstruction=simcore_do_nothing_handler}if(typeof options.after_microinstruction==="undefined"){options.after_microinstruction=simcore_do_nothing_handler}var i_clks=0;var limitless=options.cycles_limit<0;var cur_addr=0;var mcelto=null;do{options.before_microinstruction(curr_MC,cur_addr);compute_general_behavior("CLOCK");i_clks++;options.after_microinstruction(curr_MC,cur_addr);if(limitless===false&&i_clks>=options.cycles_limit){ret.msg="Warning: clock cycles limit reached in a single instruction.";ret.ok=false;break}cur_addr=get_value(maddr_state);mcelto=control_memory_get(curr_MC,cur_addr);if(typeof mcelto==="undefined"){ret.msg="Error: undefined microinstruction at "+cur_addr+".";ret.ok=false;break}}while(i_clks=code_begin||reg_pc=kcode_begin){options.before_instruction(SIMWARE,reg_pc);ret1=simcore_execute_microprogram(options);if(false===ret1.ok){return ret1}options.after_instruction(SIMWARE,reg_pc);ins_executed++;if(ins_executed>options.instruction_limit){ret.ok=false;ret.msg="more than "+options.instruction_limit+" instructions executed before application ends.";return ret}reg_pc_before=reg_pc;reg_pc=get_value(pc_state)}return ret}function simcore_do_nothing_handler(){return null}function simcore_compile_firmware(textToMCompile){var ret={};ret.msg="";ret.ok=true;if(""==textToMCompile){ret.msg="Empty Firmware";ret.ok=false;return ret}var preSM=null;try{preSM=loadFirmware(textToMCompile);ret.simware=preSM}catch(e){ret.msg="ERROR: at line: "+e.lineNumber+" and column: "+e.columnNumber;ret.ok=false;return ret}if(preSM.error!=null){ret.msg=preSM.error;ret.ok=false;return ret}update_memories(preSM);simcore_reset();return ret}function simcore_compile_assembly(textToCompile){var ret={};ret.msg="";ret.ok=true;var SIMWARE=get_simware();if(SIMWARE.firmware.length===0){ret.msg="Empty microcode, please load the microcode first.";ret.ok=false;return ret}var SIMWAREaddon=simlang_compile(textToCompile,SIMWARE);ret.simware=SIMWAREaddon;if(SIMWAREaddon.error!=null){ret.msg=SIMWAREaddon.error;ret.ok=false;return ret}set_simware(SIMWAREaddon);update_memories(SIMWARE);simcore_reset();return ret}function simcore_hardware_export(hw_name){var ret={};ret.msg="{}";ret.ok=false;var hw_obj=simhw_getObjByName(hw_name);if(null===hw_obj){return ret}ret.ok=true;ret.msg=JSON.stringify(hw_obj,(function(key,value){if(typeof value==="function"){return"/Function("+value.toString()+")/"}return value}));return ret}function simcore_hardware_import(hw_json){var ret={};ret.msg="";ret.ok=true;hw_obj=JSON.parse(hw_json,(function(key,value){if(typeof value==="string"&&value.startsWith("/Function(")&&value.endsWith(")/")){value=value.substring(10,value.length-2);return eval("("+value+")")}return value}));simhw_add(hw_obj);return ret}function simcore_native_get_signal(elto){return get_value(simhw_sim_signal(elto))>>>0}function simcore_native_set_signal(elto,value){set_value(simhw_sim_signal(elto),value);compute_behavior("FIRE "+elto);return value}function simcore_native_get_value(component,elto){var index=0;var sim_components=simhw_sim_components();var compo_index=component;if("BR"===component)compo_index="CPU";if("DEVICE"===component)compo_index="IO";if(typeof sim_components[compo_index].get_value!=="undefined"){return sim_components[compo_index].get_value(elto)}return false}function simcore_native_set_value(component,elto,value){var index=0;var sim_components=simhw_sim_components();var compo_index=component;if("BR"===component)compo_index="CPU";if("DEVICE"===component)compo_index="IO";if(typeof sim_components[compo_index].set_value!=="undefined"){return sim_components[compo_index].set_value(elto,value)}return false}function simcore_native_get_fields(signature_raw){var SIMWARE=get_simware();for(var key in SIMWARE.firmware){if(SIMWARE.firmware[key].signatureRaw===signature_raw){return SIMWARE.firmware[key].fields}}}function simcore_native_get_field_from_ir(fields,index){if(typeof fields[index]==="undefined"){ws_alert("simcore_native_get_field_from_ir: index ("+index+") out of range.");return false}var value=get_value(simhw_sim_state("REG_IR"));var left_shift=31-parseInt(fields[index].startbit);var right_shift=parseInt(fields[index].stopbit);value=value<>>left_shift;value=value>>>right_shift;return value}function simcore_native_deco(){compute_behavior("DECO")}function simcore_native_go_maddr(maddr){set_value(simhw_sim_state("MUXA_MICROADDR"),maddr)}function simcore_native_go_opcode(){var maddr=get_value(simhw_sim_state("ROM_MUXA"));set_value(simhw_sim_state("MUXA_MICROADDR"),maddr)}function simcore_native_go_instruction(signature_raw){var SIMWARE=get_simware();for(var key in SIMWARE.firmware){if(SIMWARE.firmware[key].signatureRaw===signature_raw){var maddr=SIMWARE.firmware[key]["mc-start"];set_value(simhw_sim_state("MUXA_MICROADDR"),maddr);return}}}function simcore_simstate_checklist2state(checklist){var o={};var ret=false;checklist=checklist.replace(/;|==|!=|>=|<=|=|>|v!=""));for(var i=0;i"===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)>parseInt(diff.expected);else if("<"===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)="===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)>=parseInt(diff.expected);else if("<="===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)<=parseInt(diff.expected);else if("=="===expected_result[compo][elto].op)diff.fulfill=diff.expected==diff.obtained;else if("!="===expected_result[compo][elto].op)diff.fulfill=diff.expected!=diff.obtained;d.result.push(diff);if(diff.fulfill===false)d.errors++}}if(newones_too&&typeof obtained_result[compo]!="undefined"){for(elto in obtained_result[compo]){d.neltos_obtained++;if(typeof expected_result[compo]!="undefined"&&typeof expected_result[compo][elto]!="undefined"){continue}diff={};diff.expected=obtained_result[compo][elto].default_value;diff.obtained=obtained_result[compo][elto].value;diff.fulfill=diff.expected===diff.obtained;diff.elto_type=compo.toLowerCase();diff.elto_id=obtained_result[compo][elto].id;diff.elto_op="=";d.result.push(diff);if(diff.fulfill===false)d.errors++}}}return d}function simcore_simstate_diff_results(expected_result,obtained_result){return simcore_simstate_check_results(expected_result,obtained_result,true)}function simcore_simstate_diff_states(before_state_obj,after_state_obj){var before_arr=simcore_simstate_state2checklist(before_state_obj,"").split(";");var after_arr=simcore_simstate_state2checklist(after_state_obj,"").split(";");return after_arr.filter((function(elto){return!before_arr.includes(elto)})).join(";").trim()}function simcore_simstate_checkreport2txt(checklist){var o="";for(var i=0;i"+""+""+"Type"+"IdentificationId."+"Values in the clipboard state"+"Values in the selected state"+""+""+"";for(var i=0;i"+""+checklist[i].elto_type+""+""+checklist[i].elto_id+""+""+checklist[i].elto_op+" "+checklist[i].expected+""+""+checklist[i].obtained+""+""}o+=""+"";return o}function simcore_voice_canSpeak(){if(typeof window.speechSynthesis=="undefined"){return false}if(false===get_cfg("use_voice")){return false}return true}function simcore_voice_speak(msg){var ssu=null;if(simcore_voice_canSpeak()){ssu=new SpeechSynthesisUtterance(msg);ssu.lang="es-ES";if("en"==get_cfg("ws_idiom"))ssu.lang="en-US";if("es"==get_cfg("ws_idiom"))ssu.lang="es-EN";window.speechSynthesis.speak(ssu)}}function simcore_voice_stopSpeak(){if(simcore_voice_canSpeak()){window.speechSynthesis.cancel()}}var simcore_rest={};function simcore_rest_reset(){simcore_rest={}}function simcore_rest_add(name,description){simcore_rest[name]={endpoint:description.endpoint,user:description.user,pass:description.pass,last_request:null}}function simcore_rest_list(){return simcore_rest}function simcore_rest_get(name){return simcore_rest[name]}function simcore_rest_call(name,method,uri,data){var rest_info=simcore_rest[name];if(typeof rest_info==="undefined"){return false}var api_endpoint=rest_info.endpoint;if(typeof api_endpoint=="function"){api_endpoint=api_endpoint()}if(api_endpoint.trim()===""){return false}var basic_auth="Basic "+btoa(rest_info.user+":"+rest_info.pass);var enc_data=JSON.stringify(data);var request={url:api_endpoint+uri,type:method,contentType:"application/json",accepts:"application/json",cache:false,dataType:"json",data:enc_data,beforeSend:function(xhr){if(rest_info.user.trim()!==""){xhr.setRequestHeader("Authorization",basic_auth)}},error:function(jqXHR){console.log("ajax error "+jqXHR.status)}};rest_info.last_request=$.ajax(request);return true}var simcore_notifications=[];function simcore_notifications_get(){return simcore_notifications}function simcore_notifications_reset(){simcore_notifications=[]}function simcore_notifications_add2(ntf){simcore_notifications.push({title:ntf.title,message:ntf.message,type:ntf.type,date:ntf.date})}function simcore_notifications_add(ntf_title,ntf_message,ntf_type,ntf_delay){simcore_notifications.push({title:$("

").html(ntf_title).text(),message:$("

").html(ntf_message).text(),type:ntf_type,date:(new Date).getTime()})}function get_value(sim_obj){if(typeof sim_obj.value=="function"){return sim_obj.value()}return sim_obj.value}function set_value(sim_obj,value){if(typeof sim_obj.value=="function"){if(sim_obj.value()!=value)sim_obj.changed=true;sim_obj.value(value)}else{if(sim_obj.value!=value)sim_obj.changed=true;sim_obj.value=value}}function reset_value(sim_obj){if(typeof sim_obj.value=="function"){if(sim_obj.value()!=sim_obj.default_value)sim_obj.changed=true;set_value(sim_obj,sim_obj.default_value)}else if(typeof sim_obj.default_value=="object"){sim_obj.changed=true;sim_obj.value=Object.create(sim_obj.default_value)}else if(sim_obj instanceof Array){sim_obj.changed=true;for(var i=0;i1;melto.breakpoint=melto.breakpoint||comments_str.trim().split("break:").length>1;melto.notify=comments_str.trim().split("notify:");for(var k=0;k1;melto.breakpoint=melto.breakpoint||comments_str.trim().split("break:").length>1;melto.notify=comments_str.trim().split("notify:");for(var k=0;k>8;if(2==filter_elto)dbvalue=(value&16711680)>>16;if(3==filter_elto)dbvalue=(value&4278190080)>>24;break;case 1:if(0==filter_elto)dbvalue=value&65535;if(1==filter_elto)dbvalue=value&65535;if(2==filter_elto)dbvalue=(value&4294901760)>>16;if(3==filter_elto)dbvalue=(value&4294901760)>>16;break;case 2:if(0==filter_elto)dbvalue=value&16777215;if(1==filter_elto)dbvalue=value&4294967040;break;case 3:dbvalue=value;break}return dbvalue}function main_memory_updatevalues(value,dbvalue,filter_size,filter_elto){switch(filter_size){case 0:if(0==filter_elto)value=value&4294967040|dbvalue&255;if(1==filter_elto)value=value&4294902015|(dbvalue&255)<<8;if(2==filter_elto)value=value&4278255615|(dbvalue&255)<<16;if(3==filter_elto)value=value&16777215|(dbvalue&255)<<24;break;case 1:if(0==filter_elto)value=value&4294901760|dbvalue&65535;if(1==filter_elto)value=value&4294901760|dbvalue&65535;if(2==filter_elto)value=value&65535|(dbvalue&65535)<<16;if(3==filter_elto)value=value&65535|(dbvalue&65535)<<16;break;case 2:if(0==filter_elto)value=value&4278190080|dbvalue&16777215;if(1==filter_elto)value=value&255|dbvalue&4294967040;break;case 3:value=dbvalue;break}return value}function main_memory_get_program_counter(){var r_ref=simhw_sim_ctrlStates_get().pc;var r_value=null;if(typeof r_ref!=="undefined"){r_ref=simhw_sim_state(r_ref.state)}if(typeof r_ref!=="undefined"){r_value=get_value(r_ref)}return r_value}function main_memory_get_baseaddr(){var r_ref=simhw_sim_ctrlStates_get();if(typeof r_ref==="undefined"){return null}var parts=null;var r_value=0;var r_ref2=null;var all_baseaddr={};for(var elto in r_ref){if(r_ref[elto].is_pointer==false){continue}parts=r_ref[elto].state.split(".");if(parts[0]=="BR"){r_value=4294967292;r_ref2=simhw_sim_states().BR[parts[1]]}else{r_value=0;r_ref2=simhw_sim_state(r_ref[elto].state)}if(typeof r_ref2!=="undefined"){r_value=get_value(r_ref2)}all_baseaddr[elto]=r_value}return all_baseaddr} \ No newline at end of file +var sim={systems:[],active:null,index:0};function simhw_add(newElto){var found=-1;for(var m=0;m=0&&sim.systems.length>=newActive){sim.active=sim.systems[newActive];sim.index=newActive}compile_behaviors();firedep_to_fireorder(jit_fire_dep);compute_references();compile_verbals()}function simhw_getIdByName(short_name){for(var m=0;m>>0).toString(16)}function check_behavior(){if(0==simhw_sim_signals().length){ws_alert("ALERT: empty signals!!!")}if(0==simhw_sim_states().length){ws_alert("ALERT: empty states!!!")}for(var key in simhw_sim_signals()){for(var key2 in simhw_sim_signal(key).behavior){var behaviors=simhw_sim_signal(key).behavior[key2].split(";");for(var i=0;i "+behavior_k[0]+" ("+behavior_i+")");return}if(behavior_k.length!=simhw_syntax_behavior(behavior_k[0]).nparameters){ws_alert("ALERT: Behavior has an incorrect number of elements --\x3e "+behavior_i+"/"+simhw_syntax_behavior(behavior_k[0]).nparameters);return}for(var j=1;j '"+behavior_i);return}else if("S"==t&&typeof simhw_sim_signal(s[0])=="undefined"){ws_alert("ALERT: Behavior has an undefined reference to a signal -> '"+behavior_i);return}else if("X"==t&&typeof simhw_sim_state(s[0])=="undefined"&&typeof simhw_sim_signal(s[0])=="undefined"){ws_alert("ALERT: Behavior has an undefined reference to a object state OR signal -> '"+behavior_i);return}}}}}}var jit_behaviors=false;var jit_verbals=false;var jit_fire_dep=null;var jit_fire_order=null;var jit_dep_network=null;var jit_fire_ndep=null;function firedep_to_fireorder(jit_fire_dep){var allfireto=false;jit_fire_order=[];jit_fire_ndep=[];for(var sig in simhw_sim_signals()){if(typeof jit_fire_dep[sig]=="undefined"){jit_fire_order.push(sig);continue}ndep=0;allfireto=false;for(var sigorg in jit_fire_dep[sig]){ndep++;if(jit_fire_dep[sig][sigorg]==simhw_sim_signal(sigorg).behavior.length){allfireto=true}}jit_fire_ndep[sig]=ndep;if(allfireto==false)jit_fire_order.push(sig)}}function compile_behaviors(){var jit_bes="";jit_fire_dep={};var sig_obj=null;var expr_obj=null;for(var sig in simhw_sim_signals()){jit_bes+="simhw_sim_signal('"+sig+"').behavior_fn = new Array();\n";for(var val in simhw_sim_signal(sig).behavior){var input_behavior=simhw_sim_signal(sig).behavior[val];var jit_be="";var s_exprs=input_behavior.split(";");for(var i=0;i>>0;if(value!=0){vec.CPU["R"+i]={type:"register",default_value:0,id:"R"+i,op:"=",value:"0x"+value.toString(16)}}}for(i=0;i>>0;if(value!=0){vec.CPU[internal_reg[i]]={type:"register",default_value:0,id:internal_reg[i],op:"=",value:"0x"+value.toString(16)}}}return vec},read_state:function(vec,check){if(typeof vec.CPU=="undefined"){vec.CPU={}}var key=check["id"].toUpperCase().trim();var val=parseInt(check["value"]).toString(16);if("REGISTER"==check["type"].toUpperCase().trim()){vec.CPU[key]={type:"register",default_value:0,id:key,op:check["condition"],value:"0x"+val};return true}return false},get_state:function(reg){var r_reg=reg.toUpperCase().trim();if(typeof sim.ep.states["REG_"+r_reg]!="undefined"){var value=get_value(sim.ep.states["REG_"+r_reg])>>>0;return"0x"+value.toString(16)}r_reg=r_reg.replace("R","");var index=parseInt(r_reg);if(typeof sim.ep.states.BR[index]!="undefined"){var value=get_value(sim.ep.states.BR[index])>>>0;return"0x"+value.toString(16)}return null},get_value:function(elto){if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index))return get_value(simhw_sim_state(elto))>>>0;return get_value(simhw_sim_states().BR[index])>>>0},set_value:function(elto,value){var pc_name=simhw_sim_ctrlStates_get().pc.state;if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index)){set_value(simhw_sim_state(elto),value);if(pc_name===elto){show_asmdbg_pc()}return value}return set_value(simhw_sim_states().BR[index],value)}};sim.ep.ctrl_states.pc={name:"PC",state:"REG_PC",is_pointer:true};sim.ep.ctrl_states.sp={name:"SP",state:"BR.29",is_pointer:true};sim.ep.ctrl_states.fp={name:"FP",state:"BR.30",is_pointer:true};sim.ep.ctrl_states.ir={name:"IR",state:"REG_IR",default_eltos:{co:{begin:0,end:5,length:6},cop:{begin:28,end:31,length:4}},is_pointer:false};sim.ep.ctrl_states.mpc={name:"mPC",state:"REG_MICROADDR",is_pointer:false};sim.ep.internal_states.MC={};sim.ep.internal_states.ROM={};sim.ep.internal_states.FIRMWARE={};sim.ep.internal_states.io_hash={};sim.ep.internal_states.fire_stack=[];sim.ep.internal_states.tri_state_names=["T1","T2","T3","T4","T5","T6","T7","T8","T9","T10","T11"];sim.ep.internal_states.fire_visible={databus:false,internalbus:false};sim.ep.internal_states.filter_states=["REG_IR_DECO,col-12","REG_IR,col-auto","REG_PC,col-auto","REG_MAR,col-auto","REG_MBR,col-auto","REG_RT1,col-auto","REG_RT2,col-auto","REG_RT3,col-auto","REG_SR,col-auto","REG_MICROADDR,col-auto"];sim.ep.internal_states.filter_signals=["A0,0","B,0","C,0","SELA,5","SELB,5","SELC,2","SELCOP,0","MR,0","MC,0","C0,0","C1,0","C2,0","C3,0","C4,0","C5,0","C6,0","C7,0","T1,0","T2,0","T3,0","T4,0","T5,0","T6,0","T7,0","T8,0","T9,0","T10,0","T11,0","M1,0","M2,0","M7,0","MA,0","MB,0","SELP,0","LC,0","SE,0","SIZE,0","OFFSET,0","BW,0","R,0","W,0","TA,0","TD,0","IOR,0","IOW,0","TEST_I,0","TEST_U,0"];sim.ep.internal_states.alu_flags={flag_n:0,flag_z:0,flag_v:0,flag_c:0};sim.ep.states.BR=[];sim.ep.states.BR[0]={name:"R0",verbal:"Register 0",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[1]={name:"R1",verbal:"Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[2]={name:"R2",verbal:"Register 2",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[3]={name:"R3",verbal:"Register 3",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[4]={name:"R4",verbal:"Register 4",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[5]={name:"R5",verbal:"Register 5",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[6]={name:"R6",verbal:"Register 6",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[7]={name:"R7",verbal:"Register 7",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[8]={name:"R8",verbal:"Register 8",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[9]={name:"R9",verbal:"Register 9",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[10]={name:"R10",verbal:"Register 10",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[11]={name:"R11",verbal:"Register 11",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[12]={name:"R12",verbal:"Register 12",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[13]={name:"R13",verbal:"Register 13",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[14]={name:"R14",verbal:"Register 14",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[15]={name:"R15",verbal:"Register 15",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[16]={name:"R16",verbal:"Register 16",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[17]={name:"R17",verbal:"Register 17",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[18]={name:"R18",verbal:"Register 18",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[19]={name:"R19",verbal:"Register 19",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[20]={name:"R20",verbal:"Register 20",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[21]={name:"R21",verbal:"Register 21",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[22]={name:"R22",verbal:"Register 22",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[23]={name:"R23",verbal:"Register 23",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[24]={name:"R24",verbal:"Register 24",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[25]={name:"R25",verbal:"Register 25",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[26]={name:"R26",verbal:"Register 26",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[27]={name:"R27",verbal:"Register 27",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[28]={name:"R28",verbal:"Register 28",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[29]={name:"R29",verbal:"Register 29",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[30]={name:"R30",verbal:"Register 30",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[31]={name:"R31",verbal:"Register 31",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_PC"]={name:"PC",verbal:"Program Counter Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MAR"]={name:"MAR",verbal:"Memory Address Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MBR"]={name:"MBR",verbal:"Memory Data Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_IR"]={name:"IR",verbal:"Instruction Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT1"]={name:"RT1",verbal:"Temporal 1 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT2"]={name:"RT2",verbal:"Temporal 2 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT3"]={name:"RT3",verbal:"Temporal 3 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_SR"]={name:"SR",verbal:"State Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_IB"]={name:"I_BUS",verbal:"Internal Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_AB"]={name:"A_BUS",verbal:"Address Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_CB"]={name:"C_BUS",verbal:"Control Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_DB"]={name:"D_BUS",verbal:"Data Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["C2_T2"]={name:"C2_T2",verbal:"Output of PC",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["RA_T9"]={name:"RA_T9",verbal:"Input of T9 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["RB_T10"]={name:"RB_T10",verbal:"Input of T10 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["SELEC_T3"]={name:"SELEC_T3",verbal:"Input of T3 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["SELP_M7"]={name:"SELP_M7",verbal:"Output of MUX SelP",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["ALU_C6"]={name:"ALU_C6",verbal:"Input of Temporal 3 Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["MA_ALU"]={name:"MA_ALU",verbal:"Input ALU via MA",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["MB_ALU"]={name:"MB_ALU",verbal:"Input ALU via MB",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_C"]={name:"FLAG_C",verbal:"Carry Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_V"]={name:"FLAG_V",verbal:"Overflow Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_N"]={name:"FLAG_N",verbal:"Negative Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_Z"]={name:"FLAG_Z",verbal:"Zero Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_I"]={name:"FLAG_I",verbal:"Interruption Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_U"]={name:"FLAG_U",verbal:"User Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MICROADDR"]={name:"µADDR",verbal:"Microaddress Register",visible:true,nbits:"12",value:0,default_value:0,draw_data:["svg_cu:text4667"]};sim.ep.states["REG_MICROINS"]={name:"µINS",verbal:"Microinstruction Register",visible:true,nbits:"77",value:{},default_value:{},draw_data:[]};sim.ep.states["FETCH"]={name:"FETCH",verbal:"Input Fetch",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["ROM_MUXA"]={name:"ROM_MUXA",verbal:"Input ROM",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["SUM_ONE"]={name:"SUM_ONE",verbal:"Input next microinstruction",visible:false,nbits:"12",value:1,default_value:1,draw_data:[]};sim.ep.states["MUXA_MICROADDR"]={name:"MUXA_MICROADDR",verbal:"Input microaddress",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["MUXC_MUXB"]={name:"MUXC_MUXB",verbal:"Output of MUX C",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["INEX"]={name:"INEX",verbal:"Illegal Instruction Exception",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["BS_M1"]={name:"BS_M1",verbal:"from Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BS_TD"]={name:"BS_TD",verbal:"Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["INTV"]={name:"INTV",verbal:"Interruption Vector",visible:false,nbits:"8",value:0,default_value:0,draw_data:[]};sim.ep.states["M2_C2"]={name:"M2_C2",verbal:"Input of Program Counter",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["M1_C1"]={name:"M1_C1",verbal:"Input of Memory Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["M7_C7"]={name:"M7_C7",verbal:"Input of State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["VAL_ZERO"]={name:"VAL_ZERO",verbal:"Wired Zero",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["VAL_ONE"]={name:"VAL_ONE",verbal:"Wired One",visible:false,nbits:"32",value:1,default_value:1,draw_data:[]};sim.ep.states["VAL_FOUR"]={name:"VAL_FOUR",verbal:"Wired Four",visible:false,nbits:"32",value:4,default_value:4,draw_data:[]};sim.ep.states["REG_IR_DECO"]={name:"IR_DECO",verbal:"Instruction Decoded",visible:true,nbits:"0",value:0,default_value:0,draw_data:[]};sim.ep.states["DECO_INS"]={name:"DECO_INS",verbal:"Instruction decoded in binary",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["CLK"]={name:"CLK",verbal:"Clock",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["ACC_TIME"]={name:"ACC_TIME",verbal:"Accumulated CPU time",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals["C"]={name:"C",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["MV MUXC_MUXB VAL_ZERO; FIRE B","MBIT MUXC_MUXB INT 0 1; FIRE B","MBIT MUXC_MUXB IORDY 0 1; FIRE B","MBIT MUXC_MUXB MRDY 0 1; FIRE B","MBIT MUXC_MUXB REG_SR 0 1; FIRE B","MBIT MUXC_MUXB REG_SR 1 1; FIRE B","MBIT MUXC_MUXB REG_SR 28 1; FIRE B","MBIT MUXC_MUXB REG_SR 29 1; FIRE B","MBIT MUXC_MUXB REG_SR 30 1; FIRE B","MBIT MUXC_MUXB REG_SR 31 1; FIRE B","MV MUXC_MUXB INEX; FIRE B"],fire_name:["svg_cu:text3410"],draw_data:[["svg_cu:path3108"],["svg_cu:path3062"],["svg_cu:path3060"],["svg_cu:path3136"],["svg_cu:path3482"],["svg_cu:path3480"],["svg_cu:path3488"],["svg_cu:path3486"],["svg_cu:path3484"],["svg_cu:path3484-9"],["svg_cu:path3108-3","svg_cu:path3260-3-8-6","svg_cu:path3260-3-8","svg_cu:path3260-3"]],draw_name:[["svg_cu:path3496","svg_cu:path3414","svg_cu:path3194-08"]]};sim.ep.signals["B"]={name:"B",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV A1 MUXC_MUXB; FIRE A1","NOT_ES A1 MUXC_MUXB; FIRE A1"],depends_on:["CLK"],fire_name:["svg_cu:text3408"],draw_data:[["svg_cu:path3094-7"],["svg_cu:path3392","svg_cu:path3372","svg_cu:path3390","svg_cu:path3384","svg_cu:path3108-1","svg_cu:path3100-8-7"]],draw_name:[[],["svg_cu:path3194-0","svg_cu:path3138-8","svg_cu:path3498-6"]]};sim.ep.signals["A0"]={name:"A0",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 1; FIRE A0A1","SBIT_SIGNAL A0A1 1 1; FIRE A0A1"],depends_on:["CLK"],fire_name:["svg_cu:text3406"],draw_data:[["svg_cu:path3096"],["svg_cu:path3096"]],draw_name:[[],["svg_cu:path3138-8-1","svg_cu:path3098-2","svg_cu:path3124-2-5"]]};sim.ep.signals["A1"]={name:"A1",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 0; FIRE A0A1","SBIT_SIGNAL A0A1 1 0; FIRE A0A1"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3094"],["svg_cu:path3094"]],draw_name:[[]]};sim.ep.signals["A0A1"]={name:"A0A1",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["PLUS1 MUXA_MICROADDR REG_MICROADDR","CP_FIELD MUXA_MICROADDR REG_MICROINS/MADDR","MV MUXA_MICROADDR ROM_MUXA","MV MUXA_MICROADDR FETCH"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3102","svg_cu:path3100","svg_cu:path3098","svg_cu:path3100-9","svg_cu:path3088"],["svg_cu:path3104","svg_cu:path3134","svg_cu:path3500","svg_cu:path3416"],["svg_cu:path3504","svg_cu:path3100-8","svg_cu:path3234-9"],["svg_cu:path3124"]],draw_name:[[]]};sim.ep.signals["C0"]={name:"C0",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_MAR BUS_IB"],fire_name:["svg_p:text3077"],draw_data:[["svg_p:path3081"]],draw_name:[["svg_p:path3075"]]};sim.ep.signals["C1"]={name:"C1",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_MBR M1_C1"],fire_name:["svg_p:text3079"],draw_data:[["svg_p:path3055"]],draw_name:[["svg_p:path3073"]]};sim.ep.signals["C2"]={name:"C2",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_PC M2_C2; UPDATEDPC"],fire_name:["svg_p:text3179"],draw_data:[["svg_p:path3485"]],draw_name:[["svg_p:path3177"]]};sim.ep.signals["C3"]={name:"C3",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_IR BUS_IB; DECO; FIRE_IFSET C 10"],fire_name:["svg_p:text3439"],draw_data:[["svg_p:path3339"]],draw_name:[["svg_p:path3337"]]};sim.ep.signals["C4"]={name:"C4",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT1 BUS_IB"],fire_name:["svg_p:text3441"],draw_data:[["svg_p:path3263"]],draw_name:[["svg_p:path3255"]]};sim.ep.signals["C5"]={name:"C5",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT2 BUS_IB"],fire_name:["svg_p:text3443"],draw_data:[["svg_p:path3277"]],draw_name:[["svg_p:path3269"]]};sim.ep.signals["C6"]={name:"C6",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT3 ALU_C6"],fire_name:["svg_p:text3445"],draw_data:[["svg_p:path3325","svg_p:path3323"]],draw_name:[["svg_p:path3245"]]};sim.ep.signals["C7"]={name:"C7",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_SR M7_C7; FIRE C"],fire_name:["svg_p:text3655"],draw_data:[["svg_p:path3651-9"]],draw_name:[["svg_p:path3681"]]};sim.ep.signals["TA"]={name:"TA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_AB REG_MAR; MOVE_BITSE A1A0 0 2 BUS_AB 0; FIRE_IFCHANGED A1A0 A1A0"],fire_name:["svg_p:text3091"],draw_data:[["svg_p:path3089","svg_p:path3597","svg_p:path3513","svg_p:path3601","svg_p:path3601-2","svg_p:path3187","svg_p:path3087","svg_p:path2995","svg_p:path3535"]],draw_name:[["svg_p:path3085"]]};sim.ep.signals["TD"]={name:"TD",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_DB BS_TD; MOVE_BITSE A1A0 0 2 BUS_AB 0; FIRE_IFCHANGED A1A0 A1A0"],fire_name:["svg_p:text3103"],draw_data:[["svg_p:path3101","svg_p:path3587","svg_p:path3515","svg_p:path3071","svg_p:path3419","svg_p:path3099","svg_p:path3097","svg_p:path3559-5","svg_p:path3419-1-0","svg_p:path3583","svg_p:path3419-1","svg_p:path3491","svg_p:path3641","svg_p:path3541"]],draw_name:[["svg_p:path3095"]]};sim.ep.signals["T1"]={name:"T1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_MBR; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3105"],draw_data:[["svg_p:path3071","svg_p:path3069","svg_p:path3049","svg_p:path3063-9","svg_p:path3071","svg_p:path3071"]],draw_name:[["svg_p:path3067"]]};sim.ep.signals["T2"]={name:"T2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_PC; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3449"],draw_data:[["svg_p:path3199","svg_p:path3201","svg_p:path3049"]],draw_name:[["svg_p:path3329"]]};sim.ep.signals["T3"]={name:"T3",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB SELEC_T3; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3451"],draw_data:[["svg_p:path3349","svg_p:path3931","svg_p:path3345","svg_p:path3049"]],draw_name:[["svg_p:path3351"]]};sim.ep.signals["T4"]={name:"T4",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT1; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3453"],draw_data:[["svg_p:path3261","svg_p:path3259","svg_p:path3049"]],draw_name:[["svg_p:path3305"]]};sim.ep.signals["T5"]={name:"T5",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT2; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3455"],draw_data:[["svg_p:path3275","svg_p:path3273","svg_p:path3049"]],draw_name:[["svg_p:path3307"]]};sim.ep.signals["T6"]={name:"T6",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB ALU_C6; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3457"],draw_data:[["svg_p:path3589","svg_p:path3317","svg_p:path3163-2","svg_p:path3049"]],draw_name:[["svg_p:path3319"]]};sim.ep.signals["T7"]={name:"T7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT3; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3459"],draw_data:[["svg_p:path3327","svg_p:path3311","svg_p:path3049"]],draw_name:[["svg_p:path3313"]]};sim.ep.signals["T8"]={name:"T8",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_SR; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3657"],draw_data:[["svg_p:path3651","svg_p:path3647","svg_p:path3049"]],draw_name:[["svg_p:path3649"]]};sim.ep.signals["T9"]={name:"T9",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RA_T9; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3147"],draw_data:[["svg_p:path3143","svg_p:path3139","svg_p:path3049","svg_p:path3143-9"]],draw_name:[["svg_p:path3133"]]};sim.ep.signals["T10"]={name:"T10",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RB_T10; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3149"],draw_data:[["svg_p:path3145","svg_p:path3141","svg_p:path3049","svg_p:path3145-5"]],draw_name:[["svg_p:path3137"]]};sim.ep.signals["T11"]={name:"T11",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","CP_FIELD BUS_IB REG_MICROINS/EXCODE; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3147-5","svg_cu:tspan4426"],draw_data:[["svg_p:path3145","svg_p:path3081-3","svg_p:path3139-7","svg_p:path3049","svg_cu:path3081-3","svg_cu:path3139-7","svg_cu:path3502"]],draw_name:[["svg_p:path3133-6","svg_cu:path3133-6"]]};sim.ep.signals["M1"]={name:"M1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M1_C1 BUS_IB","MV M1_C1 BS_M1"],depends_on:["C1"],fire_name:["svg_p:text3469"],draw_data:[["svg_p:path3063","svg_p:path3061","svg_p:path3059"],["svg_p:path3057","svg_p:path3641","svg_p:path3419","svg_p:path3583"]],draw_name:[[],["svg_p:path3447"]]};sim.ep.signals["M2"]={name:"M2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M2_C2 BUS_IB","PLUS4 M2_C2 REG_PC"],depends_on:["C2"],fire_name:["svg_p:text3471"],draw_data:[["svg_p:path3217","svg_p:path3215","svg_p:path3213","svg_p:path3213-9"],["svg_p:path3211","svg_p:path3209","svg_p:path3193","svg_p:path3207","svg_p:path3197","svg_p:path3201"]],draw_name:[[],["svg_p:path3467","svg_p:path3467"]]};sim.ep.signals["M7"]={name:"M7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M7_C7 BUS_IB","MV M7_C7 SELP_M7"],depends_on:["C7"],fire_name:["svg_p:text3673"],draw_data:[["svg_p:path3691","svg_p:path3693","svg_p:path3659"],["svg_p:path3695"]],draw_name:[[],["svg_p:path3667"]]};sim.ep.signals["MA"]={name:"MA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MA_ALU RA_T9; FIRE COP","MV MA_ALU REG_RT1; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3463"],draw_data:[["svg_p:path3249","svg_p:path3161","svg_p:path3165"],["svg_p:path3279"]],draw_name:[[],["svg_p:path3423"]]};sim.ep.signals["MB"]={name:"MB",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MV MB_ALU RB_T10; FIRE COP","MV MB_ALU REG_RT2; FIRE COP","MV MB_ALU VAL_FOUR; FIRE COP","MV MB_ALU VAL_ONE; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3465"],draw_data:[["svg_p:path3281","svg_p:path3171","svg_p:path3169"],["svg_p:path3283"],["svg_p:path3295","svg_p:path3293"],["svg_p:path3297","svg_p:path3299"]],draw_name:[[],["svg_p:path3425","svg_p:path3427"]]};sim.ep.signals["COP"]={name:"COP",visible:true,type:"L",value:0,default_value:0,nbits:"4",forbidden:true,behavior:["NOP_ALU; UPDATE_NZVC","AND ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","OR ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","NOT ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","XOR ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SRL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SRA ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","RR ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","RL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","ADD ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SUB ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","MUL ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","DIV ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","MOD ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","LUI ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3"],depends_on:["SELCOP"],fire_name:["svg_p:text3303"],draw_data:[["svg_p:path3237","svg_p:path3239","svg_p:path3261-8","svg_p:path3321","svg_p:path3901-6","svg_p:path3317-9"]],draw_name:[["svg_p:path3009","svg_p:path3301"]]};sim.ep.signals["SELP"]={name:"SELP",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["NOP","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_U 0; FIRE M7","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_I 1; FIRE M7","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_C 31; UPDATE_FLAG SELP_M7 FLAG_V 30; UPDATE_FLAG SELP_M7 FLAG_N 29; UPDATE_FLAG SELP_M7 FLAG_Z 28; FIRE M7"],fire_name:["svg_p:text3703"],draw_data:[[],["svg_p:path3643"],["svg_p:path3705"],["svg_p:path3675","svg_p:path3331"]],draw_name:[[],["svg_p:path3697"]]};sim.ep.signals["SELA"]={name:"SELA",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RA"],depends_on:["RA"],fire_name:["svg_cu:text3164"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELB"]={name:"SELB",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RB"],depends_on:["RB"],fire_name:["svg_cu:text3168"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELC"]={name:"SELC",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RC"],depends_on:["RC"],fire_name:["svg_cu:text3172"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELCOP"]={name:"SELCOP",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE MC"],depends_on:["COP"],fire_name:["svg_cu:text3312"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["EXCODE"]={name:"EXCODE",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE T11"],fire_name:["svg_cu:text3312-6"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["RA"]={name:"RA",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["GET RA_T9 BR RA; FIRE_IFSET T9 1; FIRE_IFSET MA 0"],depends_on:["SELA"],fire_name:["svg_p:text3107"],draw_data:[[]],draw_name:[["svg_p:path3109"]]};sim.ep.signals["RB"]={name:"RB",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["GET RB_T10 BR RB; FIRE_IFSET T10 1; FIRE_IFSET MB 0"],depends_on:["SELB"],fire_name:["svg_p:text3123"],draw_data:[[]],draw_name:[["svg_p:path3113"]]};sim.ep.signals["RC"]={name:"RC",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["FIRE LC"],depends_on:["SELC"],fire_name:["svg_p:text3125"],draw_data:[[]],draw_name:[["svg_p:path3117"]]};sim.ep.signals["LC"]={name:"LC",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","SET BR RC BUS_IB"],fire_name:["svg_p:text3127"],draw_data:[["svg_p:path3153","svg_p:path3151","svg_p:path3129"]],draw_name:[["svg_p:path3121"]]};sim.ep.signals["SE"]={name:"SE",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3; MOVE_BITS SBWA 4 1 SE; FIRE_IFCHANGED SBWA SE","MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3; MOVE_BITS SBWA 4 1 SE; FIRE_IFCHANGED SBWA SE"],depends_on:["T3"],fire_name:["svg_p:text3593","svg_p:text3431"],draw_data:[[]],draw_name:[["svg_p:path3591","svg_p:path3447-7-7"]]};sim.ep.signals["SIZE"]={name:"SIZE",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3363"],draw_data:[[]],draw_name:[["svg_p:path3355"]]};sim.ep.signals["OFFSET"]={name:"OFFSET",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3707"],draw_data:[[]],draw_name:[["svg_p:path3359"]]};sim.ep.signals["MC"]={name:"MC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT COP REG_IR 0 4; FIRE COP;","CP_FIELD COP REG_MICROINS/SELCOP; FIRE COP;"],depends_on:["SELCOP"],fire_name:["svg_cu:text3322","svg_cu:text3172-1-5"],draw_data:[["svg_cu:path3320","svg_cu:path3142"],["svg_cu:path3318","svg_cu:path3502-6","svg_cu:path3232-6"]],draw_name:[[],["svg_cu:path3306"]]};sim.ep.signals["MR"]={name:"MR",verbal:["Copy from IR[SelA], from IR[SelB], and from IR[SelB] into RA, RB, and RC. ","Copy SelA, SelB, and SelB into RA, RB, and RC. "],visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MR_RA MR; FIRE MR_RA; MV MR_RB MR; FIRE MR_RB; MV MR_RC MR; FIRE MR_RC;","MV MR_RA MR; FIRE MR_RA; MV MR_RB MR; FIRE MR_RB; MV MR_RC MR; FIRE MR_RC;"],depends_on:["SELA","SELB","SELC"],fire_name:["svg_cu:text3222","svg_cu:text3242","svg_cu:text3254","svg_cu:text3172-1"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3260","svg_cu:path3196","svg_cu:path3278","svg_cu:path3232","svg_cu:path3292"],["svg_cu:path3270","svg_cu:path3282","svg_cu:path3300","svg_cu:path3258","svg_cu:path3260","svg_cu:path3258-4","svg_cu:path3278","svg_cu:path3196","svg_cu:path3294","svg_cu:path3292","svg_cu:path3288","svg_cu:path3232","svg_cu:path3280"]],draw_name:[[],["svg_cu:path3220","svg_cu:path3240","svg_cu:path3252"]]};sim.ep.signals["MR_RA"]={name:"MR_RA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RA REG_IR REG_MICROINS/SELA 5; FIRE RA;","CP_FIELD RA REG_MICROINS/SELA; FIRE RA;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["MR_RB"]={name:"MR_RB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RB REG_IR REG_MICROINS/SELB 5; FIRE RB;","CP_FIELD RB REG_MICROINS/SELB; FIRE RB;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["MR_RC"]={name:"MR_RC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RC REG_IR REG_MICROINS/SELC 5; FIRE RC;","CP_FIELD RC REG_MICROINS/SELC; FIRE RC;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["BW"]={name:"BW",verbal:["Select one byte (based on A1A0) from Word. ","Select two bytes (one Half Word based on A1A0) from Word. ","","Select the full Word. "],visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW"],fire_name:["svg_p:text3433"],draw_data:[["svg_p:path3061-2-6","svg_p:path3101-8","svg_p:path3535-8"]],draw_name:[[],[]]};sim.ep.signals["A1A0"]={name:"A1A0",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA"],fire_name:["svg_p:text3603"],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["BWA"]={name:"BWA",visible:false,type:"L",value:0,default_value:0,nbits:"4",behavior:["BSEL BS_TD 0 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 8 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 24 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W"],fire_name:["svg_p:text3533-5"],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["SBWA"]={name:"SBWA",visible:false,type:"L",value:0,default_value:0,nbits:"5",behavior:["BSEL BS_M1 0 8 BUS_DB 0; FIRE M1","BSEL BS_M1 0 8 BUS_DB 8; FIRE M1","BSEL BS_M1 0 8 BUS_DB 16; FIRE M1","BSEL BS_M1 0 8 BUS_DB 24; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","BSEL BS_M1 0 8 BUS_DB 0; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 8; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 16; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 24; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["IOR"]={name:"IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS KBD_IOR 0 1 IOR; MOVE_BITS SCR_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE KBD_IOR; FIRE SCR_IOR; FIRE L3D_IOR"],fire_name:["svg_p:text3715"],draw_data:[[],["svg_p:path3733","svg_p:path3491","svg_p:text3715"]],draw_name:[[],[]]};sim.ep.signals["IOW"]={name:"IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW"],fire_name:["svg_p:text3717"],draw_data:[[],["svg_p:path3735","svg_p:path3491","svg_p:text3717"]],draw_name:[[],[]]};sim.ep.signals["I"]={name:"I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_I VAL_ONE; FIRE_IFSET SELP 2"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["U"]={name:"U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_U VAL_ONE; FIRE_IFSET SELP 2"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["TEST_C"]={name:"TEST_C",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_C VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_C VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3"],draw_data:[["svg_p:text3701-3"]],draw_name:[[]]};sim.ep.signals["TEST_V"]={name:"TEST_V",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_V VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_V VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-1"],draw_data:[["svg_p:text3701-3-1"]],draw_name:[[]]};sim.ep.signals["TEST_N"]={name:"TEST_N",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_N VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_N VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-2"],draw_data:[["svg_p:text3701-3-2"]],draw_name:[[]]};sim.ep.signals["TEST_Z"]={name:"TEST_Z",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_Z VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_Z VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-5"],draw_data:[["svg_p:text3701-3-5"]],draw_name:[[]]};sim.ep.signals["TEST_I"]={name:"TEST_I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_I VAL_ONE; FIRE_IFSET SELP 2"],depends_on:["CLK"],fire_name:["svg_p:text3669"],draw_data:[["svg_p:text3669"]],draw_name:[[]]};sim.ep.signals["TEST_U"]={name:"TEST_U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE_IFSET SELP 1","MV FLAG_U VAL_ONE; FIRE_IFSET SELP 1"],depends_on:["CLK"],fire_name:["svg_p:text3669-1"],draw_data:[["svg_p:text3669-1"]],draw_name:[[]]};sim.ep.signals["TEST_INTV"]={name:"TEST_INTV",visible:true,type:"L",value:0,default_value:0,nbits:"8",forbidden:true,behavior:["MBIT INTV TEST_INTV 0 32"],depends_on:["INT"],fire_name:["svg_p:tspan4225"],draw_data:[["svg_p:path3749"]],draw_name:[[]]};sim.ep.behaviors["NOP"]={nparameters:1,operation:function(s_expr){},verbal:function(s_expr){return""}};sim.ep.behaviors["NOP_ALU"]={nparameters:1,operation:function(s_expr){sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=0;sim.ep.internal_states.alu_flags.flag_c=0;sim.ep.internal_states.alu_flags.flag_v=0},verbal:function(s_expr){return""}};sim.ep.behaviors["MV"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.ep.behaviors["LOAD"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Load from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.ep.behaviors["CP_FIELD"]={nparameters:3,types:["X","X"],operation:function(s_expr){r=s_expr[2].split("/");sim_elto_org=get_reference(r[0]);newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval!="undefined"){sim_elto_dst=get_reference(s_expr[1]);set_value(sim_elto_dst,newval)}},verbal:function(s_expr){var r=s_expr[2].split("/");var sim_elto_org=get_reference(r[0]);var newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval=="undefined")newval="<undefined>";else newval=show_value(newval);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from Field "+r[1]+" of "+show_verbal(r[0])+" to "+show_verbal(s_expr[1])+" value "+newval+". "}return show_verbal(s_expr[1])+" = "+show_verbal(r[0])+"."+r[1]+" ("+newval+"). "}};sim.ep.behaviors["NOT_ES"]={nparameters:3,types:["S","E"],operation:function(s_expr){set_value(sim.ep.signals[s_expr[1]],Math.abs(get_value(sim.ep.states[s_expr[2]])-1))},verbal:function(s_expr){var value=Math.abs(get_value(sim.ep.states[s_expr[2]])-1);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Logical NOT of "+s_expr[2]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Logical NOT "+s_expr[2]+"). "}};sim.ep.behaviors["GET"]={nparameters:4,types:["E","E","S"],operation:function(s_expr){set_value(sim.ep.states[s_expr[1]],get_value(sim.ep.states[s_expr[2]][sim.ep.signals[s_expr[3]].value]))},verbal:function(s_expr){var value=get_value(sim.ep.states[s_expr[2]][sim.ep.signals[s_expr[3]].value]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Register File "+s_expr[3]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Register File "+s_expr[3]+"). "}};sim.ep.behaviors["SET"]={nparameters:4,types:["E","S","E"],operation:function(s_expr){set_value(sim.ep.states[s_expr[1]][sim.ep.signals[s_expr[2]].value],get_value(sim.ep.states[s_expr[3]]))},verbal:function(s_expr){var value=get_value(sim.ep.states[s_expr[3]]);var o_ref=sim.ep.states[s_expr[1]][sim.ep.signals[s_expr[2]].value];var o_verbal=o_ref.name;if(typeof o_ref.verbal!="undefined")o_verbal=o_ref.verbal;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+o_verbal+" the value "+show_value(value)+". "}return o_verbal+" = "+show_value(value)+". "}};sim.ep.behaviors["AND"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])&get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])&get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU AND with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (AND). "}};sim.ep.behaviors["OR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])|get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])|get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU OR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (OR). "}};sim.ep.behaviors["NOT"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=~get_value(sim.ep.states[s_expr[2]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=~get_value(sim.ep.states[s_expr[2]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU NOT with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (NOT). "}};sim.ep.behaviors["XOR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])^get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])^get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU XOR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (XOR). "}};sim.ep.behaviors["SRL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Logical with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRL). "}};sim.ep.behaviors["SRA"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Arithmetic with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRA). "}};sim.ep.behaviors["SL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=result>>>31},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Left with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SL). "}};sim.ep.behaviors["RR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1|(get_value(sim.ep.states[s_expr[2]])&1)<<31;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1|(get_value(sim.ep.states[s_expr[2]])&1)<<31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Right Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (RR). "}};sim.ep.behaviors["RL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1|(get_value(sim.ep.states[s_expr[2]])&2147483648)>>>31;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1|(get_value(sim.ep.states[s_expr[2]])&2147483648)>>>31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Left Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LR). "}};sim.ep.behaviors["ADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a+b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a+b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU ADD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (ADD). "}};sim.ep.behaviors["SUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a-b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a-b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU SUB with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SUB). "}};sim.ep.behaviors["MUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a*b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=0;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a*b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MUL with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MUL). "}};sim.ep.behaviors["DIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){set_value(sim.ep.states[s_expr[1]],0);sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=1;sim.ep.internal_states.alu_flags.flag_v=1;sim.ep.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){return"ALU DIV zero by zero (oops!). "}var result=Math.floor(a/b);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU DIV with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (DIV). "}};sim.ep.behaviors["MOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){set_value(sim.ep.states[s_expr[1]],0);sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=1;sim.ep.internal_states.alu_flags.flag_v=1;sim.ep.internal_states.alu_flags.flag_c=0;return}var result=a%b;set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){return"ALU MOD zero by zero (oops!). "}var result=a%b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MOD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MOD). "}};sim.ep.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<16;set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<16;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Load Upper Immediate with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LUI). "}};sim.ep.behaviors["PLUS1"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+1;set_value(sim.ep.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+show_verbal(s_expr[1])+" "+show_verbal(s_expr[2])+" plus one with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 1"+" ("+show_value(result)+"). "}};sim.ep.behaviors["PLUS4"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+4;set_value(sim.ep.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+4;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+show_verbal(s_expr[1])+" "+show_verbal(s_expr[2])+" plus four with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 4"+" ("+show_value(result)+"). "}};sim.ep.behaviors["MBIT"]={nparameters:5,types:["X","X","I","I"],operation:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);set_value(sim_elto_dst,parseInt(n2,2))},verbal:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3=parseInt(n2,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(n3)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(n3)+", "+size+" bits from bit "+offset+"). "}};sim.ep.behaviors["MBIT_SN"]={nparameters:5,types:["S","E","E","I"],operation:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.ep.states[s_expr[3]]);else if(typeof sim.ep.states[r[0]].value[r[1]]!="undefined")base=sim.ep.states[r[0]].value[r[1]];else if(typeof sim.ep.signals[r[1]].default_value!="undefined")base=sim.ep.signals[r[1]].default_value;else if(typeof sim.ep.states[r[1]].default_value!="undefined")base=sim.ep.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.ep.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.ep.states[s_expr[3]]);else if(typeof sim.ep.states[r[0]].value[r[1]]!="undefined")base=sim.ep.states[r[0]].value[r[1]];else if(typeof sim.ep.signals[r[1]].default_value!="undefined")base=sim.ep.signals[r[1]].default_value;else if(typeof sim.ep.states[r[1]].default_value!="undefined")base=sim.ep.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.ep.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);var from_elto="";if(1==r.length)from_elto=show_verbal(s_expr[3]);else from_elto=show_verbal(s_expr[2])+"["+r[1]+"] ";var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+from_elto+"into "+show_verbal(s_expr[1])+" "+"value "+parseInt(n3,2)+". "}return show_verbal(s_expr[1])+" = "+from_elto+" ("+parseInt(n3,2)+"). "}};sim.ep.behaviors["SBIT_SIGNAL"]={nparameters:4,types:["X","I","I"],operation:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)},verbal:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)}};sim.ep.behaviors["UPDATE_FLAG"]={nparameters:4,types:["X","X","I"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value&~(1<>>0)},verbal:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Update "+show_verbal(s_expr[2])+" to value "+sim_elto_org.value+". "}return show_verbal(s_expr[1])+"."+show_verbal(s_expr[3])+" = "+sim_elto_org.value+". "}};sim.ep.behaviors["MBITS"]={nparameters:8,types:["E","I","E","S","S","I","S"],operation:function(s_expr){var offset=parseInt(sim.ep.signals[s_expr[4]].value);var size=parseInt(sim.ep.signals[s_expr[5]].value);var n1=get_value(sim.ep.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.ep.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}set_value(sim.ep.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var offset=parseInt(sim.ep.signals[s_expr[4]].value);var size=parseInt(sim.ep.signals[s_expr[5]].value);var n1=get_value(sim.ep.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.ep.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}n1=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return" Copy from "+show_verbal(s_expr[3])+" to "+show_verbal(s_expr[1])+" value "+show_value(n1)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[3])+" ("+show_value(n1)+", "+size+" bits from bit "+offset+"). "}};sim.ep.behaviors["BSEL"]={nparameters:6,types:["E","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;set_value(sim.ep.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var posd=parseInt(s_expr[2]);var len=parseInt(s_expr[3]);var poso=parseInt(s_expr[5]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;var n5=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[4])+" to "+show_verbal(s_expr[1])+" value "+show_value(n5)+" (copied "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[4])+" ("+show_value(n5)+", "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}};sim.ep.behaviors["EXT_SIG"]={nparameters:3,types:["E","I"],operation:function(s_expr){var n1=get_value(sim.ep.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}set_value(sim.ep.states[s_expr[1]],parseInt(n4,2))},verbal:function(s_expr){var n1=get_value(sim.ep.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}var n5=parseInt(n4,2);return"Sign Extension with value "+show_value(n5)+". "}};sim.ep.behaviors["MOVE_BITS"]={nparameters:5,types:["S","I","I","S"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=0;var len=parseInt(s_expr[3]);var n1=sim.ep.signals[s_expr[4]].value.toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.ep.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.ep.behaviors["MOVE_BITSE"]={nparameters:6,types:["S","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.ep.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.ep.behaviors["DECO"]={nparameters:1,operation:function(s_expr){sim.ep.states["INEX"].value=0;var oi=decode_instruction(sim.ep.internal_states.FIRMWARE,sim.ep.ctrl_states.ir,get_value(sim.ep.states["REG_IR"]));if(null==oi.oinstruction){ws_alert("ERROR: undefined instruction code in IR ("+"co:"+oi.op_code.toString(2)+", "+"cop:"+oi.cop_code.toString(2)+")");sim.ep.states["ROM_MUXA"].value=0;sim.ep.states["INEX"].value=1;return-1}var rom_addr=oi.op_code<<6;if(typeof oi.oinstruction.cop!="undefined"){rom_addr=rom_addr+oi.cop_code}if(typeof sim.ep.internal_states["ROM"][rom_addr]=="undefined"){ws_alert("ERROR: undefined rom address "+rom_addr+" in firmware");sim.ep.states["ROM_MUXA"].value=0;return-1}sim.ep.states["ROM_MUXA"].value=sim.ep.internal_states["ROM"][rom_addr];var val=get_value(sim.ep.states["DECO_INS"]);set_value(sim.ep.states["DECO_INS"],val+1);var pc=get_value(sim.ep.states["REG_PC"])-4;var decins=get_deco_from_pc(pc);set_value(sim.ep.states["REG_IR_DECO"],decins);show_dbg_ir(get_value(sim.ep.states["REG_IR_DECO"]))},verbal:function(s_expr){return"Decode instruction. "}};sim.ep.behaviors["FIRE"]={nparameters:2,types:["S"],operation:function(s_expr){if(sim.ep.internal_states.fire_stack.indexOf(s_expr[1])!=-1){return}sim.ep.internal_states.fire_stack.push(s_expr[1]);update_draw(sim.ep.signals[s_expr[1]],sim.ep.signals[s_expr[1]].value);if("L"==sim.ep.signals[s_expr[1]].type){update_state(s_expr[1])}sim.ep.internal_states.fire_stack.pop(s_expr[1]);check_buses(s_expr[1])},verbal:function(s_expr){return""}};sim.ep.behaviors["FIRE_IFSET"]={nparameters:3,types:["S","I"],operation:function(s_expr){if(get_value(sim.ep.signals[s_expr[1]])!=parseInt(s_expr[2])){return}sim.ep.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.ep.behaviors["FIRE_IFCHANGED"]={nparameters:3,types:["S","X"],operation:function(s_expr){sim_elto=get_reference(s_expr[2]);if(sim_elto.changed==false){return}sim.ep.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.ep.behaviors["RESET_CHANGED"]={nparameters:2,types:["X"],operation:function(s_expr){sim_elto=get_reference(s_expr[1]);sim_elto.changed=false},verbal:function(s_expr){return""}};sim.ep.behaviors["CLOCK"]={nparameters:1,operation:function(s_expr){var new_maddr=null;var mcelto=null;var t0=performance.now();var val=get_value(sim.ep.states["CLK"]);set_value(sim.ep.states["CLK"],val+1);new_maddr=get_value(sim.ep.states["REG_MICROADDR"]);mcelto=sim.ep.internal_states["MC"][new_maddr];if(typeof mcelto!=="undefined"&&false==mcelto.is_native){for(var i=0;i>>0},set_value:function(elto,value){var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.ep.internal_states.MP,elto,melto);show_main_memory(sim.ep.internal_states.MP,elto,typeof valref==="undefined",true);return value}};sim.ep.internal_states.segments={};sim.ep.internal_states.MP={};sim.ep.internal_states.MP_wc=0;sim.ep.signals.MRDY={name:"MRDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED MRDY C","FIRE_IFCHANGED MRDY C"],fire_name:["svg_p:tspan3916","svg_p:text3909"],draw_data:[[],["svg_p:path3895","svg_p:path3541"]],draw_name:[[],[]]};sim.ep.signals.R={name:"R",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_READ BUS_AB BUS_DB BWA MRDY CLK; FIRE MRDY"],fire_name:["svg_p:text3533-5-2","svg_p:text3713"],draw_data:[[],["svg_p:path3557","svg_p:path3571"]],draw_name:[[],[]]};sim.ep.signals.W={name:"W",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_WRITE BUS_AB BUS_DB BWA MRDY CLK; FIRE MRDY"],fire_name:["svg_p:text3533-5-08","svg_p:text3527","svg_p:text3431-7"],draw_data:[[],["svg_p:path3559","svg_p:path3575","svg_p:path3447-7"]],draw_name:[[],[]]};sim.ep.behaviors.MEM_READ={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);sim.ep.signals[s_expr[4]].value=0;var remain=get_var(sim.ep.internal_states.MP_wc);if(typeof sim.ep.events.mem[clk-1]!="undefined"&&sim.ep.events.mem[clk-1]>0){remain=sim.ep.events.mem[clk-1]-1}sim.ep.events.mem[clk]=remain;if(remain>0){return}address=address&4294967292;var value=main_memory_getvalue(sim.ep.internal_states.MP,address);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}dbvalue=main_memory_fusionvalues(dbvalue,value,bw);sim.ep.states[s_expr[2]].value=dbvalue>>>0;sim.ep.signals[s_expr[4]].value=1;show_main_memory(sim.ep.internal_states.MP,address,full_redraw,false)},verbal:function(s_expr){var verbal="";var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);var bw_type="word";if(0==(bw&12))bw_type="byte";else if(1==(bw&12))bw_type="half";var value=main_memory_getvalue(sim.ep.internal_states.MP,address);if(typeof value==="undefined")value=0;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){verbal="Try to read a "+bw_type+" from memory "+"at address 0x"+address.toString(16)+" with value 0x"+value.toString(16)+". "}verbal="Memory output = 0x"+value.toString(16)+" (Read a "+bw_type+" from 0x"+address.toString(16)+"). ";return verbal}};sim.ep.behaviors.MEM_WRITE={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);sim.ep.signals[s_expr[4]].value=0;var remain=get_var(sim.ep.internal_states.MP_wc);if(typeof sim.ep.events.mem[clk-1]!="undefined"&&sim.ep.events.mem[clk-1]>0){remain=sim.ep.events.mem[clk-1]-1}sim.ep.events.mem[clk]=remain;if(remain>0){return}address=address&4294967292;var value=main_memory_getvalue(sim.ep.internal_states.MP,address);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}value=main_memory_fusionvalues(value,dbvalue,bw);var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.ep.internal_states.MP,address,melto);sim.ep.signals[s_expr[4]].value=1;show_main_memory(sim.ep.internal_states.MP,address,full_redraw,true)},verbal:function(s_expr){var verbal="";var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);var bw_type="word";if(0==(bw&12))bw_type="byte";else if(1==(bw&12))bw_type="half";var value=main_memory_getvalue(sim.ep.internal_states.MP,address);if(typeof value==="undefined")value=0;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){verbal="Try to write a "+bw_type+" to memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". "}verbal="Memory[0x"+address.toString(16)+"] = "+"0x"+value.toString(16)+" (Write a "+bw_type+" to 0x"+address.toString(16)+"). ";return verbal}};sim.ep.behaviors.MEMORY_RESET={nparameters:1,operation:function(s_expr){sim.ep.events.mem={}},verbal:function(s_expr){return"Reset main memory (all values will be zeroes). "}};sim.ep.components.IO={name:"IO",version:"1",abilities:["IO_TIMER"],details_name:["IO_STATS","IO_CONFIG"],details_fire:[["svg_p:text3775"],[]],write_state:function(vec){return vec},read_state:function(o,check){return false},get_state:function(reg){return null},get_value:function(elto){var associated_state=simhw_internalState_get("io_hash",elto);var value=get_value(simhw_sim_state(associated_state))>>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.ep.internal_states.io_int_factory=[];sim.ep.internal_states.io_int_factory[0]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[1]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[2]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[3]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[4]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[5]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[6]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[7]={period:0,probability:.5,accumulated:0,active:false};var IOSR_ID=4352;var IOCR_ID=4356;var IODR_ID=4360;sim.ep.internal_states.io_hash[IOSR_ID]="IOSR";sim.ep.internal_states.io_hash[IOCR_ID]="IOCR";sim.ep.internal_states.io_hash[IODR_ID]="IODR";sim.ep.states.IOSR={name:"IOSR",verbal:"IO State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.IOCR={name:"IOCR",verbal:"IO Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.IODR={name:"IODR",verbal:"IO Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals.INT={name:"INT",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE C","FIRE C"],fire_name:["svg_p:tspan4199"],draw_data:[[],["svg_p:path3809"]],draw_name:[[],[]]};sim.ep.signals.IORDY={name:"IORDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED IORDY C","FIRE_IFCHANGED IORDY C"],fire_name:["svg_p:tspan4089","svg_p:path3793","svg_p:text3911"],draw_data:[[],["svg_p:path3897"]],draw_name:[[],[]]};sim.ep.signals.IO_IOR={name:"IO_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOR BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE SBWA"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.IO_IOW={name:"IO_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOW BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE SBWA"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.IO_IE={name:"IO_IE",visible:true,type:"L",value:1,default_value:1,nbits:"1",behavior:["NOP","IO_CHK_I CLK INT INTV; FIRE C"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals.INTA={name:"INTA",visible:true,type:"L",value:1,default_value:0,nbits:"1",behavior:["NOP","INTA CLK INT INTA BUS_DB INTV; FIRE BW; FIRE C"],fire_name:["svg_p:text3785-0-6-0-5-5-1-1"],draw_data:[[],["svg_p:path3807","svg_p:path3737"]],draw_name:[[],[]]};sim.ep.behaviors.IO_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==IOSR_ID)set_value(sim.ep.states[s_expr[2]],iosr);if(bus_ab==IOCR_ID)set_value(sim.ep.states[s_expr[2]],iocr);if(bus_ab==IODR_ID)set_value(sim.ep.states[s_expr[2]],iodr)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==IOSR_ID)verbal="I/O device read at IOSR of value "+iosr+". ";if(bus_ab==IOCR_ID)verbal="I/O device read at IOCR of value "+iocr+". ";if(bus_ab==IODR_ID)verbal="I/O device read at IODR of value "+iodr+". ";return verbal}};sim.ep.behaviors.IO_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab!=IOSR_ID&&bus_ab!=IOCR_ID&&bus_ab!=IODR_ID){return}if(bus_ab==IOSR_ID)set_value(sim.ep.states[s_expr[3]],bus_db);if(bus_ab==IOCR_ID)set_value(sim.ep.states[s_expr[4]],bus_db);if(bus_ab==IODR_ID)set_value(sim.ep.states[s_expr[5]],bus_db);var iocr_id=get_value(sim.ep.states[s_expr[4]]);var iodr_id=get_value(sim.ep.states[s_expr[5]]);if(iocr_id<0||iocr_id>7)return;set_var(sim.ep.internal_states.io_int_factory[iocr_id].period,iodr_id);set_var(sim.ep.internal_states.io_int_factory[iocr_id].probability,1);if(0==iodr_id)set_var(sim.ep.internal_states.io_int_factory[iocr_id].probability,0)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab==IOSR_ID)verbal="I/O device write at IOSR with value "+bus_db+". ";if(bus_ab==IOCR_ID)verbal="I/O device write at IOCR with value "+bus_db+". ";if(bus_ab==IODR_ID)verbal="I/O device write at IODR with value "+bus_db+". ";return verbal}};sim.ep.behaviors.IO_CHK_I={nparameters:4,types:["E","S","E"],operation:function(s_expr){var clk=get_value(sim.ep.states[s_expr[1]]);for(var i=sim.ep.internal_states.io_int_factory.length-1;i>=0;i--){if(get_var(sim.ep.internal_states.io_int_factory[i].period)==0)continue;if(get_var(sim.ep.internal_states.io_int_factory[i].active)==true){set_value(sim.ep.signals[s_expr[2]],1);set_value(sim.ep.states[s_expr[3]],i)}if(clk%get_var(sim.ep.internal_states.io_int_factory[i].period)==0){if(Math.random()>get_var(sim.ep.internal_states.io_int_factory[i].probability))continue;set_var(sim.ep.internal_states.io_int_factory[i].accumulated,get_var(sim.ep.internal_states.io_int_factory[i].accumulated)+1);set_var(sim.ep.internal_states.io_int_factory[i].active,true);if(typeof sim.ep.events.io[clk]=="undefined")sim.ep.events.io[clk]=[];sim.ep.events.io[clk].push(i);set_value(sim.ep.signals[s_expr[2]],1);set_value(sim.ep.states[s_expr[3]],i)}}},verbal:function(s_expr){return"Check I/O Interruption. "}};sim.ep.behaviors.INTA={nparameters:6,types:["E","S","S","E","E"],operation:function(s_expr){var clk=get_value(sim.ep.states[s_expr[1]]);if(typeof sim.ep.events.io[clk]!="undefined"){set_value(sim.ep.states[s_expr[4]],sim.ep.events.io[clk][0]);return}set_value(sim.ep.signals[s_expr[2]],0);set_value(sim.ep.states[s_expr[5]],0);for(var i=0;i>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.ep.internal_states.l3d_dim=4;sim.ep.internal_states.l3d_neltos=Math.pow(sim.ep.internal_states.l3d_dim,3);sim.ep.internal_states.l3d_state=Array.from({length:sim.ep.internal_states.l3d_neltos},(()=>({active:false})));sim.ep.internal_states.l3d_frame="0".repeat(sim.ep.internal_states.l3d_neltos);var L3DSR_ID=8448;var L3DCR_ID=8452;var L3DDR_ID=8456;sim.ep.internal_states.io_hash[L3DSR_ID]="L3DSR";sim.ep.internal_states.io_hash[L3DCR_ID]="L3DCR";sim.ep.internal_states.io_hash[L3DDR_ID]="L3DDR";sim.ep.states.L3DSR={name:"L3DSR",verbal:"L3D State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.L3DCR={name:"L3DCR",verbal:"L3D Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.L3DDR={name:"L3DDR",verbal:"L3D Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals.L3D_IOR={name:"L3D_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOR BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE SBWA"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.L3D_IOW={name:"L3D_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOW BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE SBWA; L3D_SYNC"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.behaviors.L3D_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==L3DCR_ID){set_value(sim.ep.states[s_expr[2]],iocr)}if(bus_ab==L3DDR_ID){set_value(sim.ep.states[s_expr[2]],iodr)}if(bus_ab==L3DSR_ID){var x=(iodr&4278190080)>>24;var y=(iodr&16711680)>>16;var z=(iodr&65280)>>8;var p=z*Math.pow(sim.ep.internal_states.l3d_dim,2)+y*sim.ep.internal_states.l3d_dim+x;var s=get_var(sim.ep.internal_states.l3d_state[p].active);set_value(sim.ep.states[s_expr[2]],s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==L3DSR_ID)verbal="I/O device read at L3DSR of value "+iosr+". ";if(bus_ab==L3DCR_ID)verbal="I/O device read at L3DCR of value "+iocr+". ";if(bus_ab==L3DDR_ID)verbal="I/O device read at L3DDR of value "+iodr+". ";return verbal}};sim.ep.behaviors.L3D_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab!=L3DSR_ID&&bus_ab!=L3DCR_ID&&bus_ab!=L3DDR_ID){return}if(bus_ab==L3DSR_ID){set_value(sim.ep.states[s_expr[3]],bus_db)}if(bus_ab==L3DDR_ID){set_value(sim.ep.states[s_expr[5]],bus_db)}if(bus_ab==L3DCR_ID){set_value(sim.ep.states[s_expr[4]],bus_db);var x=(bus_db&4278190080)>>24;var y=(bus_db&16711680)>>16;var z=(bus_db&65280)>>8;var p=z*Math.pow(sim.ep.internal_states.l3d_dim,2)+y*sim.ep.internal_states.l3d_dim+x;var s=(bus_db&255)!=0;set_var(sim.ep.internal_states.l3d_state[p].active,s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab==L3DSR_ID)verbal="I/O device write at L3DSR with value "+bus_db+". ";if(bus_ab==L3DCR_ID)verbal="I/O device write at L3DCR with value "+bus_db+". ";if(bus_ab==L3DDR_ID)verbal="I/O device write at L3DDR with value "+bus_db+". ";return verbal}};sim.ep.behaviors.L3D_RESET={nparameters:1,operation:function(s_expr){sim.ep.events.l3d={};for(var i=0;i>>0;if(value!=0){vec.CPU["R"+i]={type:"register",default_value:0,id:"R"+i,op:"=",value:"0x"+value.toString(16)}}}for(var i=0;i>>0;if(value!=0){vec.CPU[internal_reg[i]]={type:"register",default_value:0,id:internal_reg[i],op:"=",value:"0x"+value.toString(16)}}}return vec},read_state:function(vec,check){if(typeof vec.CPU=="undefined")vec.CPU={};var key=check["id"].toUpperCase().trim();var val=parseInt(check["value"]).toString(16);if("REGISTER"==check["type"].toUpperCase().trim()){vec.CPU[key]={type:"register",default_value:0,id:key,op:check["condition"],value:"0x"+val};return true}return false},get_state:function(reg){var r_reg=reg.toUpperCase().trim();if(typeof sim.poc.states["REG_"+r_reg]!="undefined"){var value=get_value(sim.poc.states["REG_"+r_reg])>>>0;return"0x"+value.toString(16)}r_reg=r_reg.replace("R","");var index=parseInt(r_reg);if(typeof sim.poc.states.BR[index]!="undefined"){var value=get_value(sim.poc.states.BR[index])>>>0;return"0x"+value.toString(16)}return null},get_value:function(elto){if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index))return get_value(simhw_sim_state(elto))>>>0;return get_value(simhw_sim_states().BR[index])>>>0},set_value:function(elto,value){var pc_name=simhw_sim_ctrlStates_get().pc.state;if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index)){set_value(simhw_sim_state(elto),value);if(pc_name===elto){show_asmdbg_pc()}return value}return set_value(simhw_sim_states().BR[index],value)}};sim.poc.ctrl_states.pc={name:"PC",state:"REG_PC",is_pointer:true};sim.poc.ctrl_states.sp={name:"SP",state:"BR.29",is_pointer:true};sim.poc.ctrl_states.fp={name:"FP",state:"BR.30",is_pointer:true};sim.poc.ctrl_states.ir={name:"IR",state:"REG_IR",default_eltos:{co:{begin:0,end:5,length:6},cop:{begin:27,end:31,length:5}},is_pointer:false};sim.poc.ctrl_states.mpc={name:"mPC",state:"REG_MICROADDR",is_pointer:false};sim.poc.internal_states.MC={};sim.poc.internal_states.ROM={};sim.poc.internal_states.FIRMWARE={};sim.poc.internal_states.io_hash={};sim.poc.internal_states.fire_stack=[];sim.poc.internal_states.tri_state_names=["T1","T2","T3","T6","T8","T9","T10","T11"];sim.poc.internal_states.fire_visible={databus:false,internalbus:false};sim.poc.internal_states.filter_states=["REG_IR_DECO,col-12","REG_IR,col-auto","REG_PC,col-auto","REG_SR,col-auto","REG_RT1,col-auto","REG_MAR,col-auto","REG_MBR,col-auto","REG_MICROADDR,col-auto"];sim.poc.internal_states.filter_signals=["A0,0","B,0","C,0","SELA,5","SELB,5","SELC,2","SELCOP,0","MR,0","MC,0","C0,0","C1,0","C2,0","C3,0","C4,0","C7,0","T1,0","T2,0","T3,0","T6,0","T8,0","T9,0","T10,0","T11,0","M1,0","M7,0","MA,0","MB,0","LC,0","SE,0","SIZE,0","OFFSET,0","BW,0","R,0","W,0","TA,0","TD,0","IOR,0","IOW,0","TEST_I,0","TEST_U,0"];sim.poc.internal_states.alu_flags={flag_n:0,flag_z:0,flag_v:0,flag_c:0};sim.poc.states.BR=[];sim.poc.states.BR[0]={name:"R0",verbal:"Register 0",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[1]={name:"R1",verbal:"Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[2]={name:"R2",verbal:"Register 2",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[3]={name:"R3",verbal:"Register 3",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[4]={name:"R4",verbal:"Register 4",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[5]={name:"R5",verbal:"Register 5",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[6]={name:"R6",verbal:"Register 6",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[7]={name:"R7",verbal:"Register 7",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[8]={name:"R8",verbal:"Register 8",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[9]={name:"R9",verbal:"Register 9",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[10]={name:"R10",verbal:"Register 10",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[11]={name:"R11",verbal:"Register 11",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[12]={name:"R12",verbal:"Register 12",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[13]={name:"R13",verbal:"Register 13",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[14]={name:"R14",verbal:"Register 14",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[15]={name:"R15",verbal:"Register 15",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[16]={name:"R16",verbal:"Register 16",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[17]={name:"R17",verbal:"Register 17",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[18]={name:"R18",verbal:"Register 18",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[19]={name:"R19",verbal:"Register 19",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[20]={name:"R20",verbal:"Register 20",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[21]={name:"R21",verbal:"Register 21",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[22]={name:"R22",verbal:"Register 22",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[23]={name:"R23",verbal:"Register 23",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[24]={name:"R24",verbal:"Register 24",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[25]={name:"R25",verbal:"Register 25",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[26]={name:"R26",verbal:"Register 26",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[27]={name:"R27",verbal:"Register 27",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[28]={name:"R28",verbal:"Register 28",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[29]={name:"R29",verbal:"Register 29",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[30]={name:"R30",verbal:"Register 30",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[31]={name:"R31",verbal:"Register 31",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[32]={name:"R32",verbal:"Register 32",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[33]={name:"R33",verbal:"Register 33",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[34]={name:"R34",verbal:"Register 34",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[35]={name:"R35",verbal:"Register 35",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[36]={name:"R36",verbal:"Register 36",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[37]={name:"R37",verbal:"Register 37",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[38]={name:"R38",verbal:"Register 38",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[39]={name:"R39",verbal:"Register 39",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[40]={name:"R40",verbal:"Register 40",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[41]={name:"R41",verbal:"Register 41",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[42]={name:"R42",verbal:"Register 42",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[43]={name:"R43",verbal:"Register 43",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[44]={name:"R44",verbal:"Register 44",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[45]={name:"R45",verbal:"Register 45",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[46]={name:"R46",verbal:"Register 46",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[47]={name:"R47",verbal:"Register 47",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[48]={name:"R48",verbal:"Register 48",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[49]={name:"R49",verbal:"Register 49",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[50]={name:"R50",verbal:"Register 50",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[51]={name:"R51",verbal:"Register 51",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[52]={name:"R52",verbal:"Register 52",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[53]={name:"R53",verbal:"Register 53",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[54]={name:"R54",verbal:"Register 54",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[55]={name:"R55",verbal:"Register 55",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[56]={name:"R56",verbal:"Register 56",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[57]={name:"R57",verbal:"Register 57",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[58]={name:"R58",verbal:"Register 58",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[59]={name:"R59",verbal:"Register 59",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[60]={name:"R60",verbal:"Register 60",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[61]={name:"R61",verbal:"Register 61",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[62]={name:"R62",verbal:"Register 62",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[63]={name:"R63",verbal:"Register 63",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_PC"]={name:"PC",verbal:"Program Counter Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MAR"]={name:"MAR",verbal:"Memory Address Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MBR"]={name:"MBR",verbal:"Memory Data Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_IR"]={name:"IR",verbal:"Instruction Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_SR"]={name:"SR",verbal:"State Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_RT1"]={name:"RT1",verbal:"Temporal Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_IB"]={name:"I_BUS",verbal:"Internal Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_AB"]={name:"A_BUS",verbal:"Address Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_CB"]={name:"C_BUS",verbal:"Control Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_DB"]={name:"D_BUS",verbal:"Data Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["RA_T9"]={name:"RA_T9",verbal:"Input of T9 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["RB_T10"]={name:"RB_T10",verbal:"Input of T10 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["SELEC_T3"]={name:"SELEC_T3",verbal:"Input of T3 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["ALU_T6"]={name:"ALU_T6",verbal:"Input of T6 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["MA_ALU"]={name:"MA_ALU",verbal:"Input ALU via MA",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["MB_ALU"]={name:"MB_ALU",verbal:"Input ALU via MB",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_C"]={name:"FLAG_C",verbal:"Carry Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_V"]={name:"FLAG_V",verbal:"Overflow Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_N"]={name:"FLAG_N",verbal:"Negative Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_Z"]={name:"FLAG_Z",verbal:"Zero Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_I"]={name:"FLAG_I",verbal:"Interruption Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_U"]={name:"FLAG_U",verbal:"User Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MICROADDR"]={name:"µADDR",verbal:"Microaddress Register",visible:true,nbits:"12",value:0,default_value:0,draw_data:["svg_cu:text4667"]};sim.poc.states["REG_MICROINS"]={name:"µINS",verbal:"Microinstruction Register",visible:true,nbits:"77",value:{},default_value:{},draw_data:[]};sim.poc.states["FETCH"]={name:"FETCH",verbal:"Input Fetch",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["ROM_MUXA"]={name:"ROM_MUXA",verbal:"Input ROM",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["SUM_ONE"]={name:"SUM_ONE",verbal:"Input next microinstruction",visible:false,nbits:"12",value:1,default_value:1,draw_data:[]};sim.poc.states["MUXA_MICROADDR"]={name:"MUXA_MICROADDR",verbal:"Input microaddress",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["MUXC_MUXB"]={name:"MUXC_MUXB",verbal:"Output of MUX C",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["INEX"]={name:"INEX",verbal:"Illegal Instruction Exception",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["BS_M1"]={name:"BS_M1",verbal:"from Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BS_TD"]={name:"BS_TD",verbal:"Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["INTV"]={name:"INTV",verbal:"Interruption Vector",visible:false,nbits:"8",value:0,default_value:0,draw_data:[]};sim.poc.states["M1_C1"]={name:"M1_C1",verbal:"Input of Memory Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["M7_C7"]={name:"M7_C7",verbal:"Input of State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["VAL_ZERO"]={name:"VAL_ZERO",verbal:"Wired Zero",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["VAL_ONE"]={name:"VAL_ONE",verbal:"Wired One",visible:false,nbits:"32",value:1,default_value:1,draw_data:[]};sim.poc.states["VAL_FOUR"]={name:"VAL_FOUR",verbal:"Wired Four",visible:false,nbits:"32",value:4,default_value:4,draw_data:[]};sim.poc.states["REG_IR_DECO"]={name:"IR_DECO",verbal:"Instruction Decoded",visible:true,nbits:"0",value:0,default_value:0,draw_data:[]};sim.poc.states["DECO_INS"]={name:"DECO_INS",verbal:"Instruction decoded in binary",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["CLK"]={name:"CLK",verbal:"Clock",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["ACC_TIME"]={name:"ACC_TIME",verbal:"Accumulated CPU time",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals["C"]={name:"C",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["MV MUXC_MUXB VAL_ZERO; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB INT 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB IORDY 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB MRDY 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 1 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 28 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 29 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 30 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 31 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MV MUXC_MUXB INEX; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB"],fire_name:["svg_cu:text3410"],draw_data:[["svg_cu:path3108"],["svg_cu:path3062"],["svg_cu:path3060"],["svg_cu:path3136"],["svg_cu:path3482"],["svg_cu:path3480"],["svg_cu:path3488"],["svg_cu:path3486"],["svg_cu:path3484"],["svg_cu:path3484-9"],["svg_cu:path3108-3","svg_cu:path3260-3-8-6","svg_cu:path3260-3-8","svg_cu:path3260-3"]],draw_name:[["svg_cu:path3496","svg_cu:path3414","svg_cu:path3194-08"]]};sim.poc.signals["B"]={name:"B",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV A1 MUXC_MUXB; FIRE A1","NOT_ES A1 MUXC_MUXB; FIRE A1"],depends_on:["CLK"],fire_name:["svg_cu:text3408"],draw_data:[["svg_cu:path3094-7"],["svg_cu:path3392","svg_cu:path3372","svg_cu:path3390","svg_cu:path3384","svg_cu:path3108-1","svg_cu:path3100-8-7"]],draw_name:[[],["svg_cu:path3194-0","svg_cu:path3138-8","svg_cu:path3498-6"]]};sim.poc.signals["A0"]={name:"A0",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 1; FIRE A0A1","SBIT_SIGNAL A0A1 1 1; FIRE A0A1"],depends_on:["CLK"],fire_name:["svg_cu:text3406"],draw_data:[["svg_cu:path3096"],["svg_cu:path3096"]],draw_name:[[],["svg_cu:path3138-8-1","svg_cu:path3098-2","svg_cu:path3124-2-5"]]};sim.poc.signals["A1"]={name:"A1",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 0; FIRE A0A1","SBIT_SIGNAL A0A1 1 0; FIRE A0A1"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3094"],["svg_cu:path3094"]],draw_name:[[]]};sim.poc.signals["A0A1"]={name:"A0A1",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["PLUS1 MUXA_MICROADDR REG_MICROADDR","CP_FIELD MUXA_MICROADDR REG_MICROINS/MADDR","MV MUXA_MICROADDR ROM_MUXA","MV MUXA_MICROADDR FETCH"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3102","svg_cu:path3100","svg_cu:path3098","svg_cu:path3100-9","svg_cu:path3088"],["svg_cu:path3104","svg_cu:path3134","svg_cu:path3500","svg_cu:path3416"],["svg_cu:path3504","svg_cu:path3100-8","svg_cu:path3234-9"],["svg_cu:path3124"]],draw_name:[[]]};sim.poc.signals["C0"]={name:"C0",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_MAR BUS_IB"],fire_name:["svg_p:text3077"],draw_data:[["svg_p:path3081"]],draw_name:[["svg_p:path3075"]]};sim.poc.signals["C1"]={name:"C1",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_MBR M1_C1"],fire_name:["svg_p:text3079"],draw_data:[["svg_p:path3055"]],draw_name:[["svg_p:path3073"]]};sim.poc.signals["C2"]={name:"C2",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_PC BUS_IB; UPDATEDPC"],fire_name:["svg_p:text3179"],draw_data:[["svg_p:path3217"]],draw_name:[["svg_p:path3177"]]};sim.poc.signals["C3"]={name:"C3",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_IR BUS_IB; DECO; FIRE_IFSET C 10"],fire_name:["svg_p:text3439"],draw_data:[["svg_p:path3339","svg_p:path3913-4"]],draw_name:[["svg_p:path3337"]]};sim.poc.signals["C4"]={name:"C4",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_RT1 BUS_IB"],fire_name:["svg_p:tspan482"],draw_data:[["svg_p:path3339-4"]],draw_name:[["svg_p:path3337-0"]]};sim.poc.signals["C7"]={name:"C7",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_SR M7_C7; FIRE C"],fire_name:["svg_p:text3655"],draw_data:[["svg_p:path3651-9"]],draw_name:[["svg_p:path3681"]]};sim.poc.signals["TA"]={name:"TA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_AB REG_MAR"],fire_name:["svg_p:text3091"],draw_data:[["svg_p:path3089","svg_p:path3597","svg_p:path3513","svg_p:path3601","svg_p:path3601-2","svg_p:path3187","svg_p:path3087","svg_p:path2995","svg_p:path3535"]],draw_name:[["svg_p:path3085"]]};sim.poc.signals["TD"]={name:"TD",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_DB REG_MBR; FIRE R; FIRE W"],fire_name:["svg_p:text3103"],draw_data:[["svg_p:path3101","svg_p:path3587","svg_p:path3419-8","svg_p:path3071","svg_p:path3099","svg_p:path3097","svg_p:path3559-5","svg_p:path3419-1-0","svg_p:path3583","svg_p:path3419-1","svg_p:path3491","svg_p:path3641","svg_p:path3541"]],draw_name:[["svg_p:path3095"]]};sim.poc.signals["T1"]={name:"T1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_MBR; FIRE M7; FIRE M1"],fire_name:["svg_p:text3105"],draw_data:[["svg_p:path3071","svg_p:path3069","svg_p:path3049","svg_p:path3063-9","svg_p:path3071"]],draw_name:[["svg_p:path3067"]]};sim.poc.signals["T2"]={name:"T2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_PC; FIRE M7; FIRE M1"],fire_name:["svg_p:text3449"],draw_data:[["svg_p:path3199","svg_p:path3201","svg_p:path3049"]],draw_name:[["svg_p:path3329"]]};sim.poc.signals["T3"]={name:"T3",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB SELEC_T3; FIRE M7; FIRE M1"],fire_name:["svg_p:text3451"],draw_data:[["svg_p:path3349","svg_p:path3931","svg_p:path3345","svg_p:path3049"]],draw_name:[["svg_p:path3351"]]};sim.poc.signals["T6"]={name:"T6",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB ALU_T6; FIRE M7; FIRE M1"],fire_name:["svg_p:text3457"],draw_data:[["svg_p:path3589","svg_p:path3317","svg_p:path3163-2","svg_p:path3049","svg_p:path3317-9","svg_p:path3321","svg_p:path3261-8"]],draw_name:[["svg_p:path3319"]]};sim.poc.signals["T8"]={name:"T8",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_SR; FIRE M7; FIRE M1"],fire_name:["svg_p:text3657"],draw_data:[["svg_p:path3651","svg_p:path3647","svg_p:path3049"]],draw_name:[["svg_p:path3649"]]};sim.poc.signals["T9"]={name:"T9",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RA_T9; FIRE M7; FIRE M1"],fire_name:["svg_p:text3147"],draw_data:[["svg_p:path3143","svg_p:path3139","svg_p:path3049","svg_p:path3143-9"]],draw_name:[["svg_p:path3133"]]};sim.poc.signals["T10"]={name:"T10",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RB_T10; FIRE M7; FIRE M1"],fire_name:["svg_p:text3149"],draw_data:[["svg_p:path3145","svg_p:path3141","svg_p:path3049","svg_p:path3145-5"]],draw_name:[["svg_p:path3137"]]};sim.poc.signals["T11"]={name:"T11",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","CP_FIELD BUS_IB REG_MICROINS/EXCODE; FIRE M7; FIRE M1"],fire_name:["svg_p:text3147-5","svg_cu:tspan4426"],draw_data:[["svg_p:path3081-3","svg_p:path3139-7","svg_p:path3049","svg_cu:path3081-3","svg_cu:path3139-7","svg_cu:path3502"]],draw_name:[["svg_p:path3133-6","svg_cu:path3133-6"]]};sim.poc.signals["M1"]={name:"M1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M1_C1 BUS_IB","MV M1_C1 BUS_DB"],depends_on:["C1"],fire_name:["svg_p:text3469"],draw_data:[["svg_p:path3063","svg_p:path3061","svg_p:path3059"],["svg_p:path3057","svg_p:path3641","svg_p:path3419","svg_p:path3583"]],draw_name:[[],["svg_p:path3447"]]};sim.poc.signals["M7"]={name:"M7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M7_C7 BUS_IB","MV M7_C7 REG_SR; UPDATE_FLAG M7_C7 FLAG_C 31; UPDATE_FLAG M7_C7 FLAG_V 30; UPDATE_FLAG M7_C7 FLAG_N 29; UPDATE_FLAG M7_C7 FLAG_Z 28"],depends_on:["C7"],fire_name:["svg_p:text3673"],draw_data:[["svg_p:path3691","svg_p:path3693","svg_p:path3659"],["svg_p:path3695"]],draw_name:[[],["svg_p:path3667"]]};sim.poc.signals["MA"]={name:"MA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MA_ALU RA_T9; FIRE COP","MV MA_ALU BUS_IB; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3463"],draw_data:[["svg_p:path3249","svg_p:path3161","svg_p:path3165"],["svg_p:path3279"]],draw_name:[[],["svg_p:path3423"]]};sim.poc.signals["MB"]={name:"MB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MB_ALU RB_T10; FIRE COP","MV MB_ALU REG_PC; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3465"],draw_data:[["svg_p:path3281","svg_p:path3171","svg_p:path3169"],["svg_p:path3283"]],draw_name:[[],["svg_p:path3425","svg_p:path3427"]]};sim.poc.signals["COP"]={name:"COP",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["NOP_ALU; UPDATE_NZVC","AND ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","OR ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","NOT ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","XOR ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SRL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SRA ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","RR ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","RL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUB ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","MUL ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","DIV ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","MOD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","LUI ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADDFOUR ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADDONE ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUBFOUR ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUBONE ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FADD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FSUB ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FMUL ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FDIV ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FMOD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU"],depends_on:["SELCOP"],fire_name:["svg_p:text3303"],draw_data:[["svg_p:path3237","svg_p:path3239","svg_p:path3261-8","svg_p:path3321","svg_p:path3901-6","svg_p:path3317-9"]],draw_name:[["svg_p:path3009","svg_p:path3301"]]};sim.poc.signals["SELA"]={name:"SELA",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRA SELA; RESET_CHANGED SELA"],depends_on:["RA"],fire_name:["svg_cu:text3164"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELB"]={name:"SELB",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRB SELB; RESET_CHANGED SELB"],depends_on:["RB"],fire_name:["svg_cu:text3168"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELC"]={name:"SELC",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRC SELC; RESET_CHANGED SELC"],depends_on:["RC"],fire_name:["svg_cu:text3172"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELCOP"]={name:"SELCOP",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE_IFCHANGED MC SELCOP; RESET_CHANGED SELCOP"],depends_on:["COP"],fire_name:["svg_cu:text3312"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["EXCODE"]={name:"EXCODE",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE T11"],fire_name:["svg_cu:text3312-6"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["RA"]={name:"RA",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["GET RA_T9 BR RA; FIRE_IFSET T9 1; FIRE_IFSET MA 0"],depends_on:["SELA"],fire_name:["svg_p:text3107"],draw_data:[[]],draw_name:[["svg_p:path3109"]]};sim.poc.signals["RB"]={name:"RB",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["GET RB_T10 BR RB; FIRE_IFSET T10 1; FIRE_IFSET MB 0"],depends_on:["SELB"],fire_name:["svg_p:text3123"],draw_data:[[]],draw_name:[["svg_p:path3113"]]};sim.poc.signals["RC"]={name:"RC",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["FIRE LC"],depends_on:["SELC"],fire_name:["svg_p:text3125"],draw_data:[[]],draw_name:[["svg_p:path3117"]]};sim.poc.signals["LC"]={name:"LC",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","SET BR RC BUS_IB"],fire_name:["svg_p:text3127"],draw_data:[["svg_p:path3153","svg_p:path3151","svg_p:path3129"]],draw_name:[["svg_p:path3121"]]};sim.poc.signals["SE"]={name:"SE",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3","MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3593"],draw_data:[[]],draw_name:[["svg_p:path3591","svg_p:path3447-7-7"]]};sim.poc.signals["SIZE"]={name:"SIZE",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3363"],draw_data:[[]],draw_name:[["svg_p:path3355"]]};sim.poc.signals["OFFSET"]={name:"OFFSET",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3707"],draw_data:[[]],draw_name:[["svg_p:path3359"]]};sim.poc.signals["MC"]={name:"MC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT COP REG_IR 0 5; FIRE_IFCHANGED COP MC","CP_FIELD COP REG_MICROINS/SELCOP; FIRE_IFCHANGED COP MC"],depends_on:["SELCOP"],fire_name:["svg_cu:text3322","svg_cu:text3172-1-5"],draw_data:[["svg_cu:path3320","svg_cu:path3142"],["svg_cu:path3318","svg_cu:path3502-6","svg_cu:path3232-6"]],draw_name:[[],["svg_cu:path3306"]]};sim.poc.signals["MRA"]={name:"MRA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RA REG_IR REG_MICROINS/SELA 5; FIRE RA;","CP_FIELD RA REG_MICROINS/SELA; FIRE RA;"],depends_on:["SELA"],fire_name:["svg_cu:text3222"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3260"],["svg_cu:path3270","svg_cu:path3258","svg_cu:path3260","svg_cu:path3294","svg_cu:path3288","svg_cu:path3280"]],draw_name:[[],["svg_cu:path3220"]]};sim.poc.signals["MRB"]={name:"MRB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RB REG_IR REG_MICROINS/SELB 5; FIRE RB;","CP_FIELD RB REG_MICROINS/SELB; FIRE RB;"],depends_on:["SELB"],fire_name:["svg_cu:text3242"],draw_data:[["svg_cu:path3196","svg_cu:path3278","svg_cu:path3292"],["svg_cu:path3282","svg_cu:path3258-4","svg_cu:path3278","svg_cu:path3196"]],draw_name:[[],["svg_cu:path3240"]]};sim.poc.signals["MRC"]={name:"MRC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RC REG_IR REG_MICROINS/SELC 5; FIRE RC;","CP_FIELD RC REG_MICROINS/SELC; FIRE RC;"],depends_on:["SELC"],fire_name:["svg_cu:text3254"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3232","svg_cu:path3292"],["svg_cu:path3300","svg_cu:path3294","svg_cu:path3292","svg_cu:path3288","svg_cu:path3232"]],draw_name:[[],["svg_cu:path3252"]]};sim.poc.signals["IOR"]={name:"IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOR 0 1 IOR; FIRE SCR_IOR; MOVE_BITS IO_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE IO_IOR; MOVE_BITS KBD_IOR 0 1 IOR; FIRE KBD_IOR; FIRE L3D_IOR"],fire_name:[],draw_data:[[],["svg_p:path3733","svg_p:path3491","svg_p:text3715"]],draw_name:[[],[]]};sim.poc.signals["IOW"]={name:"IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW"],fire_name:[],draw_data:[[],["svg_p:path3735","svg_p:path3491","svg_p:text3717"]],draw_name:[[],[]]};sim.poc.signals["TEST_C"]={name:"TEST_C",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_C VAL_ZERO; FIRE M7","MV FLAG_C VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3"],draw_data:[["svg_p:text3701-3"]],draw_name:[[]]};sim.poc.signals["TEST_V"]={name:"TEST_V",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_V VAL_ZERO; FIRE M7","MV FLAG_V VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-1"],draw_data:[["svg_p:text3701-3-1"]],draw_name:[[]]};sim.poc.signals["TEST_N"]={name:"TEST_N",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_N VAL_ZERO; FIRE M7","MV FLAG_N VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-2"],draw_data:[["svg_p:text3701-3-2"]],draw_name:[[]]};sim.poc.signals["TEST_Z"]={name:"TEST_Z",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_Z VAL_ZERO; FIRE M7","MV FLAG_Z VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-5"],draw_data:[["svg_p:text3701-3-5"]],draw_name:[[]]};sim.poc.signals["TEST_I"]={name:"TEST_I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE M7","MV FLAG_I VAL_ONE; FIRE M7"],depends_on:["CLK"],fire_name:["svg_cu:text3440"],draw_data:[["svg_cu:text3440"]],draw_name:[[]]};sim.poc.signals["TEST_U"]={name:"TEST_U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE M7","MV FLAG_U VAL_ONE; FIRE M7"],depends_on:["CLK"],fire_name:["svg_cu:text3442"],draw_data:[["svg_cu:text3442"]],draw_name:[[]]};sim.poc.signals["TEST_INTV"]={name:"TEST_INTV",visible:true,type:"L",value:0,default_value:0,nbits:"8",forbidden:true,behavior:["MBIT INTV TEST_INTV 0 32"],depends_on:["INT"],fire_name:["svg_p:tspan4225"],draw_data:[["svg_p:path3749"]],draw_name:[[]]};sim.poc.behaviors["NOP"]={nparameters:1,operation:function(s_expr){},verbal:function(s_expr){return""}};sim.poc.behaviors["NOP_ALU"]={nparameters:1,operation:function(s_expr){sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){return"Reset ALU flags. "}};sim.poc.behaviors["MV"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="short"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.poc.behaviors["LOAD"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Load from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_value(newval)+" ( "+show_verbal(s_expr[2])+"). "}};sim.poc.behaviors["CP_FIELD"]={nparameters:3,types:["X","X"],operation:function(s_expr){r=s_expr[2].split("/");sim_elto_org=get_reference(r[0]);newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval!="undefined"){sim_elto_dst=get_reference(s_expr[1]);set_value(sim_elto_dst,newval)}},verbal:function(s_expr){var r=s_expr[2].split("/");var sim_elto_org=get_reference(r[0]);var newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval=="undefined")newval="<undefined>";else newval=show_value(newval);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return'Copy from "'+show_verbal(r[0])+'"['+r[1]+"] "+"to "+show_verbal(s_expr[1])+" (value "+newval+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(r[0])+"."+r[1]+" ("+newval+"). "}};sim.poc.behaviors["NOT_ES"]={nparameters:3,types:["S","E"],operation:function(s_expr){set_value(sim.poc.signals[s_expr[1]],Math.abs(get_value(sim.poc.states[s_expr[2]])-1))},verbal:function(s_expr){var value=Math.abs(get_value(sim.poc.states[s_expr[2]])-1);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Logical NOT of "+s_expr[2]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Logical NOT "+s_expr[2]+"). "}};sim.poc.behaviors["GET"]={nparameters:4,types:["E","E","S"],operation:function(s_expr){set_value(sim.poc.states[s_expr[1]],get_value(sim.poc.states[s_expr[2]][sim.poc.signals[s_expr[3]].value]))},verbal:function(s_expr){var value=get_value(sim.poc.states[s_expr[2]][sim.poc.signals[s_expr[3]].value]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Register File "+s_expr[3]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Register File "+s_expr[3]+"). "}};sim.poc.behaviors["SET"]={nparameters:4,types:["E","S","E"],operation:function(s_expr){set_value(sim.poc.states[s_expr[1]][sim.poc.signals[s_expr[2]].value],get_value(sim.poc.states[s_expr[3]]))},verbal:function(s_expr){var value=get_value(sim.poc.states[s_expr[3]]);var o_ref=sim.poc.states[s_expr[1]][sim.poc.signals[s_expr[2]].value];var o_verbal=o_ref.name;if(typeof o_ref.verbal!="undefined")o_verbal=o_ref.verbal;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+o_verbal+" the value "+show_value(value)+". "}return o_verbal+" = "+show_value(value)+". "}};sim.poc.behaviors["AND"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])&get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])&get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU AND with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (AND). "}};sim.poc.behaviors["OR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])|get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])|get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU OR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (OR). "}};sim.poc.behaviors["NOT"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=~get_value(sim.poc.states[s_expr[2]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=~get_value(sim.poc.states[s_expr[2]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU NOT with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (NOT). "}};sim.poc.behaviors["XOR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])^get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])^get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU XOR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (XOR). "}};sim.poc.behaviors["SRL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Logical with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRL). "}};sim.poc.behaviors["SRA"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Arithmetic with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRA). "}};sim.poc.behaviors["SL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Left with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SL). "}};sim.poc.behaviors["RR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1|(get_value(sim.poc.states[s_expr[2]])&1)<<31;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1|(get_value(sim.poc.states[s_expr[2]])&1)<<31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Right Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (RR). "}};sim.poc.behaviors["RL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1|(get_value(sim.poc.states[s_expr[2]])&2147483648)>>>31;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1|(get_value(sim.poc.states[s_expr[2]])&2147483648)>>>31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Left Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LR). "}};sim.poc.behaviors["ADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a+b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a+b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU ADD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (ADD). "}};sim.poc.behaviors["SUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a-b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a-b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU SUB with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SUB). "}};sim.poc.behaviors["MUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a*b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a*b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MUL with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MUL). "}};sim.poc.behaviors["DIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){return"ALU DIV zero by zero (oops!). "}var result=Math.floor(a/b);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU DIV with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (DIV). "}};sim.poc.behaviors["MOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=a%b;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){return"ALU MOD zero by zero (oops!). "}var result=a%b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MOD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MOD). "}};sim.poc.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Load Upper Immediate with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LUI). "}};sim.poc.behaviors["ADDFOUR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;return"ALU ADD 4 with result "+show_value(result)+". "}};sim.poc.behaviors["ADDONE"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;return"ALU ADD 1 with result "+show_value(result)+". "}};sim.poc.behaviors["SUBFOUR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-4;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-4;return"ALU SUB 4 with result "+show_value(result)+". "}};sim.poc.behaviors["SUBONE"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-1;return"ALU SUB 1 with result "+show_value(result)+". "}};sim.poc.behaviors["FADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)+b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)+b.toFixed(2);return"ALU Float ADD with result "+result+". "}};sim.poc.behaviors["FSUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)-b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)-b.toFixed(2);return"ALU Float SUB with result "+result+". "}};sim.poc.behaviors["FMUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)*b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)*b.toFixed(2);return"ALU Float MUL with result "+result+". "}};sim.poc.behaviors["FDIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)/b.toFixed(2);return"ALU Float DIV with result "+result+". "}};sim.poc.behaviors["FMOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=(get_value(sim.poc.states[s_expr[2]])<<0)%(get_value(sim.poc.states[s_expr[3]])<<0);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)%b.toFixed(2);return"ALU Float MOD with result "+result+". "}};sim.poc.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;return"ALU Load Upper Immediate with result "+show_value(result)+". "}};sim.poc.behaviors["PLUS1"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;set_value(sim.poc.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Add one to "+show_verbal(s_expr[2])+" and copy to "+show_verbal(s_expr[1])+" with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 1"+" ("+show_value(result)+"). "}};sim.poc.behaviors["PLUS4"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;set_value(sim.poc.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Add four to "+show_verbal(s_expr[2])+" and copy to "+show_verbal(s_expr[1])+" with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 4"+" ("+show_value(result)+"). "}};sim.poc.behaviors["MBIT"]={nparameters:5,types:["X","X","I","I"],operation:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);set_value(sim_elto_dst,parseInt(n2,2))},verbal:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3=parseInt(n2,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(n3)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(n3)+", "+size+" bits from bit "+offset+"). "}};sim.poc.behaviors["MBIT_SN"]={nparameters:5,types:["S","E","E","I"],operation:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.poc.states[s_expr[3]]);else if(typeof sim.poc.states[r[0]].value[r[1]]!="undefined")base=sim.poc.states[r[0]].value[r[1]];else if(typeof sim.poc.signals[r[1]].default_value!="undefined")base=sim.poc.signals[r[1]].default_value;else if(typeof sim.poc.states[r[1]].default_value!="undefined")base=sim.poc.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.poc.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.poc.states[s_expr[3]]);else if(typeof sim.poc.states[r[0]].value[r[1]]!="undefined")base=sim.poc.states[r[0]].value[r[1]];else if(typeof sim.poc.signals[r[1]].default_value!="undefined")base=sim.poc.signals[r[1]].default_value;else if(typeof sim.poc.states[r[1]].default_value!="undefined")base=sim.poc.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.poc.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);var from_elto="";if(1==r.length)from_elto=show_verbal(s_expr[3]);else from_elto='"'+show_verbal(s_expr[2])+'"['+r[1]+"] ";var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+from_elto+"into "+show_verbal(s_expr[1])+" "+"value "+parseInt(n3,2)+". "}return show_verbal(s_expr[1])+" = "+from_elto+" ("+parseInt(n3,2)+"). "}};sim.poc.behaviors["SBIT_SIGNAL"]={nparameters:4,types:["X","I","I"],operation:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)},verbal:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)}};sim.poc.behaviors["UPDATE_FLAG"]={nparameters:4,types:["X","X","I"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value&~(1<>>0)},verbal:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Update "+show_verbal(s_expr[2])+" to value "+sim_elto_org.value+". "}return show_verbal(s_expr[1])+"."+show_verbal(s_expr[3])+" = "+sim_elto_org.value+". "}};sim.poc.behaviors["MBITS"]={nparameters:8,types:["E","I","E","S","S","I","S"],operation:function(s_expr){var offset=parseInt(sim.poc.signals[s_expr[4]].value);var size=parseInt(sim.poc.signals[s_expr[5]].value);var n1=get_value(sim.poc.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.poc.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}set_value(sim.poc.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var offset=parseInt(sim.poc.signals[s_expr[4]].value);var size=parseInt(sim.poc.signals[s_expr[5]].value);var n1=get_value(sim.poc.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.poc.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}n1=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return" Copy from "+show_verbal(s_expr[3])+" to "+show_verbal(s_expr[1])+" value "+show_value(n1)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[3])+" ("+show_value(n1)+", "+size+" bits from bit "+offset+"). "}};sim.poc.behaviors["BSEL"]={nparameters:6,types:["E","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;set_value(sim.poc.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var posd=parseInt(s_expr[2]);var len=parseInt(s_expr[3]);var poso=parseInt(s_expr[5]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;var n5=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[4])+" to "+show_verbal(s_expr[1])+" value "+show_value(n5)+" (copied "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[4])+" ("+show_value(n5)+", "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}};sim.poc.behaviors["EXT_SIG"]={nparameters:3,types:["E","I"],operation:function(s_expr){var n1=get_value(sim.poc.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}set_value(sim.poc.states[s_expr[1]],parseInt(n4,2))},verbal:function(s_expr){var n1=get_value(sim.poc.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}var n5=parseInt(n4,2);return"Sign Extension with value "+show_value(n5)+". "}};sim.poc.behaviors["MOVE_BITS"]={nparameters:5,types:["S","I","I","S"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=0;var len=parseInt(s_expr[3]);var n1=sim.poc.signals[s_expr[4]].value.toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.poc.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.poc.behaviors["MOVE_BITSE"]={nparameters:6,types:["S","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.poc.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.poc.behaviors["DECO"]={nparameters:1,operation:function(s_expr){sim.poc.states["INEX"].value=0;var oi=decode_instruction(sim.poc.internal_states.FIRMWARE,sim.poc.ctrl_states.ir,get_value(sim.poc.states["REG_IR"]));if(null==oi.oinstruction){ws_alert("ERROR: undefined instruction code in IR ("+"co:"+oi.op_code.toString(2)+", "+"cop:"+oi.cop_code.toString(2)+")");sim.poc.states["ROM_MUXA"].value=0;sim.poc.states["INEX"].value=1;return-1}var rom_addr=oi.op_code<<6;if(typeof oi.oinstruction.cop!="undefined"){rom_addr=rom_addr+oi.cop_code}if(typeof sim.poc.internal_states["ROM"][rom_addr]=="undefined"){ws_alert("ERROR: undefined rom address "+rom_addr+" in firmware");sim.poc.states["ROM_MUXA"].value=0;return-1}sim.poc.states["ROM_MUXA"].value=sim.poc.internal_states["ROM"][rom_addr];var val=get_value(sim.poc.states["DECO_INS"]);set_value(sim.poc.states["DECO_INS"],val+1);var pc=get_value(sim.poc.states["REG_PC"])-4;var decins=get_deco_from_pc(pc);set_value(sim.poc.states["REG_IR_DECO"],decins);show_dbg_ir(get_value(sim.poc.states["REG_IR_DECO"]))},verbal:function(s_expr){return"Decode instruction. "}};sim.poc.behaviors["FIRE"]={nparameters:2,types:["S"],operation:function(s_expr){if(sim.poc.internal_states.fire_stack.indexOf(s_expr[1])!=-1){return}sim.poc.internal_states.fire_stack.push(s_expr[1]);update_draw(sim.poc.signals[s_expr[1]],sim.poc.signals[s_expr[1]].value);if("L"==sim.poc.signals[s_expr[1]].type){update_state(s_expr[1])}sim.poc.internal_states.fire_stack.pop(s_expr[1]);check_buses(s_expr[1])},verbal:function(s_expr){return""}};sim.poc.behaviors["FIRE_IFSET"]={nparameters:3,types:["S","I"],operation:function(s_expr){if(get_value(sim.poc.signals[s_expr[1]])!=parseInt(s_expr[2])){return}sim.poc.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.poc.behaviors["FIRE_IFCHANGED"]={nparameters:3,types:["S","X"],operation:function(s_expr){sim_elto=get_reference(s_expr[2]);if(sim_elto.changed==false)return;sim.poc.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.poc.behaviors["RESET_CHANGED"]={nparameters:2,types:["X"],operation:function(s_expr){sim_elto=get_reference(s_expr[1]);sim_elto.changed=false},verbal:function(s_expr){return""}};sim.poc.behaviors["CLOCK"]={nparameters:1,operation:function(s_expr){var new_maddr=null;var mcelto=null;var t0=performance.now();var val=get_value(sim.poc.states["CLK"]);set_value(sim.poc.states["CLK"],val+1);new_maddr=get_value(sim.poc.states["REG_MICROADDR"]);mcelto=sim.poc.internal_states["MC"][new_maddr];if(typeof mcelto!=="undefined"&&false==mcelto.is_native){for(var i=0;i>>0},set_value:function(elto,value){var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.poc.internal_states.MP,elto,melto);show_main_memory(sim.poc.internal_states.MP,elto,typeof valref==="undefined",true);return value}};sim.poc.internal_states.segments={};sim.poc.internal_states.MP={};sim.poc.internal_states.MP_wc=0;sim.poc.signals.MRDY={name:"MRDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED MRDY C","FIRE_IFCHANGED MRDY C"],fire_name:["svg_p:tspan3916"],draw_data:[[],["svg_p:path3895","svg_p:path3541"]],draw_name:[[],[]]};sim.poc.signals.R={name:"R",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_READ BUS_AB BUS_DB BW MRDY CLK; FIRE M1; FIRE MRDY"],fire_name:["svg_p:text3533-5-2"],draw_data:[[],["svg_p:path3557","svg_p:path3571"]],draw_name:[[],[]]};sim.poc.signals.W={name:"W",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_WRITE BUS_AB BUS_DB BW MRDY CLK; FIRE M1; FIRE MRDY"],fire_name:["svg_p:text3533-5-08"],draw_data:[[],["svg_p:path3559","svg_p:path3575","svg_p:path3447-7"]],draw_name:[[],[]]};sim.poc.signals.BW={name:"BW",verbal:["Access to one byte from memory. ","Access to two bytes from memory. ","Access to three bytes from memory. ","Access to a word from memory. "],visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["FIRE R; FIRE W","FIRE R; FIRE W","FIRE R; FIRE W","FIRE R; FIRE W"],fire_name:["svg_p:text3533-5-2-8"],draw_data:[["svg_p:path3557-0"]],draw_name:[[],[]]};sim.poc.behaviors.MEM_READ={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);sim.poc.signals[s_expr[4]].value=0;var remain=get_var(sim.poc.internal_states.MP_wc);if(typeof sim.poc.events.mem[clk-1]!="undefined"&&sim.poc.events.mem[clk-1]>0){remain=sim.poc.events.mem[clk-1]-1}sim.poc.events.mem[clk]=remain;if(remain>0){return}var wordress=address&4294967292;var value=main_memory_getvalue(sim.poc.internal_states.MP,wordress);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}dbvalue=main_memory_extractvalues(value,bw,address&3);sim.poc.states[s_expr[2]].value=dbvalue>>>0;sim.poc.signals[s_expr[4]].value=1;show_main_memory(sim.poc.internal_states.MP,wordress,full_redraw,false)},verbal:function(s_expr){var verbal="";var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);switch(bw){case 0:bw_type="byte";break;case 1:bw_type="half";break;case 2:bw_type="three bytes";break;case 3:bw_type="word";break}var value=main_memory_getvalue(sim.poc.internal_states.MP,address);if(typeof value==="undefined"){value=0}verbal="Try to read a "+bw_type+" from memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". ";return verbal}};sim.poc.behaviors.MEM_WRITE={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);sim.poc.signals[s_expr[4]].value=0;var remain=get_var(sim.poc.internal_states.MP_wc);if(typeof sim.poc.events.mem[clk-1]!="undefined"&&sim.poc.events.mem[clk-1]>0){remain=sim.poc.events.mem[clk-1]-1}sim.poc.events.mem[clk]=remain;if(remain>0){return}var wordress=address&4294967292;var value=main_memory_getvalue(sim.poc.internal_states.MP,wordress);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}value=main_memory_updatevalues(value,dbvalue,bw,address&3);var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var elto=main_memory_set(sim.poc.internal_states.MP,wordress,melto);sim.poc.signals[s_expr[4]].value=1;show_main_memory(sim.poc.internal_states.MP,wordress,full_redraw,true)},verbal:function(s_expr){var verbal="";var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);switch(bw){case 0:bw_type="byte";break;case 1:bw_type="half";break;case 2:bw_type="three bytes";break;case 3:bw_type="word";break}var value=main_memory_getvalue(sim.poc.internal_states.MP,address);if(typeof value==="undefined"){value=0}verbal="Try to write a "+bw_type+" to memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". ";return verbal}};sim.poc.behaviors.MEMORY_RESET={nparameters:1,operation:function(s_expr){sim.poc.events.mem={}},verbal:function(s_expr){return"Reset the memory (all values will be zeroes). "}};sim.poc.components.IO={name:"IO",version:"1",abilities:["IO_TIMER"],details_name:["IO_STATS","IO_CONFIG"],details_fire:[["svg_p:text3775"],[]],write_state:function(vec){return vec},read_state:function(o,check){return false},get_state:function(reg){return null},get_value:function(elto){var associated_state=simhw_internalState_get("io_hash",elto);var value=get_value(simhw_sim_state(associated_state))>>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.poc.internal_states.io_int_factory=[];sim.poc.internal_states.io_int_factory[0]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[1]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[2]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[3]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[4]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[5]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[6]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[7]={period:0,probability:.5,accumulated:0,active:false};var IOSR_ID=4352;var IOCR_ID=4356;var IODR_ID=4360;sim.poc.internal_states.io_hash[IOSR_ID]="IOSR";sim.poc.internal_states.io_hash[IOCR_ID]="IOCR";sim.poc.internal_states.io_hash[IODR_ID]="IODR";sim.poc.states.IOSR={name:"IOSR",verbal:"IO State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.IOCR={name:"IOCR",verbal:"IO Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.IODR={name:"IODR",verbal:"IO Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals.INT={name:"INT",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE C","FIRE C"],fire_name:["svg_p:tspan4199"],draw_data:[[],["svg_p:path3809"]],draw_name:[[],[]]};sim.poc.signals.IORDY={name:"IORDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED IORDY C","FIRE_IFCHANGED IORDY C"],fire_name:["svg_p:tspan4089","svg_p:path3793","svg_p:tspan4089"],draw_data:[[],["svg_p:path3897"]],draw_name:[[],[]]};sim.poc.signals.IO_IOR={name:"IO_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOR BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE M1"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.IO_IOW={name:"IO_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOW BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE M1"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.IO_IE={name:"IO_IE",visible:true,type:"L",value:1,default_value:1,nbits:"1",behavior:["NOP","IO_CHK_I CLK INT INTV; FIRE C"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.poc.signals.INTA={name:"INTA",visible:true,type:"L",value:1,default_value:0,nbits:"1",behavior:["NOP","INTA CLK INT INTA BUS_DB INTV; FIRE M1; FIRE C"],fire_name:["svg_p:text3785-0-6-0-5-5-1-1"],draw_data:[[],["svg_p:path3807","svg_p:path3737"]],draw_name:[[],[]]};sim.poc.behaviors.IO_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==IOSR_ID)set_value(sim.poc.states[s_expr[2]],iosr);if(bus_ab==IOCR_ID)set_value(sim.poc.states[s_expr[2]],iocr);if(bus_ab==IODR_ID)set_value(sim.poc.states[s_expr[2]],iodr)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==IOSR_ID)verbal="I/O device read at IOSR of value "+iosr+". ";if(bus_ab==IOCR_ID)verbal="I/O device read at IOCR of value "+iocr+". ";if(bus_ab==IODR_ID)verbal="I/O device read at IODR of value "+iodr+". ";return verbal}};sim.poc.behaviors.IO_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab!=IOSR_ID&&bus_ab!=IOCR_ID&&bus_ab!=IODR_ID){return}if(bus_ab==IOSR_ID)set_value(sim.poc.states[s_expr[3]],bus_db);if(bus_ab==IOCR_ID)set_value(sim.poc.states[s_expr[4]],bus_db);if(bus_ab==IODR_ID)set_value(sim.poc.states[s_expr[5]],bus_db);var iocr_id=get_value(sim.poc.states[s_expr[4]]);var iodr_id=get_value(sim.poc.states[s_expr[5]]);if(iocr_id<0||iocr_id>7)return;set_var(sim.poc.internal_states.io_int_factory[iocr_id].period,iodr_id);set_var(sim.poc.internal_states.io_int_factory[iocr_id].probability,1);if(0==iodr_id)set_var(sim.poc.internal_states.io_int_factory[iocr_id].probability,0)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab==IOSR_ID)verbal="I/O device write at IOSR with value "+bus_db+". ";if(bus_ab==IOCR_ID)verbal="I/O device write at IOCR with value "+bus_db+". ";if(bus_ab==IODR_ID)verbal="I/O device write at IODR with value "+bus_db+". ";return verbal}};sim.poc.behaviors.IO_CHK_I={nparameters:4,types:["E","S","E"],operation:function(s_expr){var clk=get_value(sim.poc.states[s_expr[1]]);for(var i=sim.poc.internal_states.io_int_factory.length-1;i>=0;i--){if(get_var(sim.poc.internal_states.io_int_factory[i].period)==0)continue;if(get_var(sim.poc.internal_states.io_int_factory[i].active)==true){set_value(sim.poc.signals[s_expr[2]],1);set_value(sim.poc.states[s_expr[3]],i)}if(clk%get_var(sim.poc.internal_states.io_int_factory[i].period)==0){if(Math.random()>get_var(sim.poc.internal_states.io_int_factory[i].probability))continue;set_var(sim.poc.internal_states.io_int_factory[i].accumulated,get_var(sim.poc.internal_states.io_int_factory[i].accumulated)+1);set_var(sim.poc.internal_states.io_int_factory[i].active,true);if(typeof sim.poc.events.io[clk]=="undefined")sim.poc.events.io[clk]=[];sim.poc.events.io[clk].push(i);set_value(sim.poc.signals[s_expr[2]],1);set_value(sim.poc.states[s_expr[3]],i)}}},verbal:function(s_expr){return"Check I/O Interruption. "}};sim.poc.behaviors.INTA={nparameters:6,types:["E","S","S","E","E"],operation:function(s_expr){var clk=get_value(sim.poc.states[s_expr[1]]);if(typeof sim.poc.events.io[clk]!="undefined"){set_value(sim.poc.states[s_expr[4]],sim.poc.events.io[clk][0]);return}set_value(sim.poc.signals[s_expr[2]],0);set_value(sim.poc.states[s_expr[5]],0);for(var i=0;i>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("L3DR"),1);compute_behavior("FIRE L3DR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("L3DW"),1);compute_behavior("FIRE L3DW");return value}};sim.poc.internal_states.l3d_dim=4;sim.poc.internal_states.l3d_neltos=Math.pow(sim.poc.internal_states.l3d_dim,3);sim.poc.internal_states.l3d_state=Array.from({length:sim.poc.internal_states.l3d_neltos},(()=>({active:false})));sim.poc.internal_states.l3d_frame="0".repeat(sim.poc.internal_states.l3d_neltos);var L3DSR_ID=8448;var L3DCR_ID=8452;var L3DDR_ID=8456;sim.poc.internal_states.io_hash[L3DSR_ID]="L3DSR";sim.poc.internal_states.io_hash[L3DCR_ID]="L3DCR";sim.poc.internal_states.io_hash[L3DDR_ID]="L3DDR";sim.poc.states.L3DSR={name:"L3DSR",verbal:"L3D State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.L3DCR={name:"L3DCR",verbal:"L3D Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.L3DDR={name:"L3DDR",verbal:"L3D Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals.L3D_IOR={name:"L3D_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOR BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE M1"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.L3D_IOW={name:"L3D_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOW BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE M1; L3D_SYNC"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.behaviors.L3D_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==L3DCR_ID){set_value(sim.poc.states[s_expr[2]],iocr)}if(bus_ab==L3DDR_ID){set_value(sim.poc.states[s_expr[2]],iodr)}if(bus_ab==L3DCR_ID){var x=(iodr&4278190080)>>24;var y=(iodr&16711680)>>16;var z=(iodr&65280)>>8;var p=z*Math.pow(sim.poc.internal_states.l3d_dim,2)+y*sim.poc.internal_states.l3d_dim+x;var s=get_var(sim.poc.internal_states.l3d_state[p].active);set_value(sim.poc.states[s_expr[2]],s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==L3DSR_ID)verbal="I/O device read at L3DSR of value "+iosr+". ";if(bus_ab==L3DCR_ID)verbal="I/O device read at L3DCR of value "+iocr+". ";if(bus_ab==L3DDR_ID)verbal="I/O device read at L3DDR of value "+iodr+". ";return verbal}};sim.poc.behaviors.L3D_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab!=L3DSR_ID&&bus_ab!=L3DCR_ID&&bus_ab!=L3DDR_ID){return}if(bus_ab==L3DSR_ID){set_value(sim.poc.states[s_expr[3]],bus_db)}if(bus_ab==L3DDR_ID){set_value(sim.poc.states[s_expr[5]],bus_db)}if(bus_ab==L3DCR_ID){set_value(sim.poc.states[s_expr[4]],bus_db);var x=(bus_db&4278190080)>>24;var y=(bus_db&16711680)>>16;var z=(bus_db&65280)>>8;var p=z*Math.pow(sim.poc.internal_states.l3d_dim,2)+y*sim.poc.internal_states.l3d_dim+x;var s=(bus_db&255)!=0;var l3dstates=sim.poc.internal_states.l3d_state;set_var(l3dstates[p].active,s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab==L3DSR_ID)verbal="I/O device write at L3DSR with value "+bus_db+". ";if(bus_ab==L3DCR_ID)verbal="I/O device write at L3DCR with value "+bus_db+". ";if(bus_ab==L3DDR_ID)verbal="I/O device write at L3DDR with value "+bus_db+". ";return verbal}};sim.poc.behaviors.L3D_RESET={nparameters:1,operation:function(s_expr){sim.poc.events.l3d={};for(var i=0;i0)line2=context.newlines[context.newlines.length-1]+1;var line1=0;if(context.newlines.length>1)line1=context.newlines[context.newlines.length-2]+1;var lowI=line1;var highI=Math.min(context.t-1,line2+32);for(;typeof context.text[highI+1]!="undefined"&&context.text[highI+1]!="\n";highI++);var line3=highI+2;highI++;for(;typeof context.text[highI+1]!="undefined"&&context.text[highI+1]!="\n";highI++);highI++;context.error="
"+"

"+"...\n";for(var i=lowI;i"+"(*) "+i18n_get_TagFor("compiler","PROBLEM AROUND LINE")+" "+context.line+": 
"+msgError+".
";if(typeof ga!=="undefined"){ga("send","event","compile","compile.error","compile.error."+msgError)}return context}function getLabelContext(context){return{t:context.t,line:context.line,newlines:context.newlines.slice()}}function setLabelContext(context,labelContext){context.t=labelContext.t;context.line=labelContext.line;context.newlines=labelContext.newlines}function getComments(context){return context.comments.join("\n")}function resetComments(context){context.comments=[]}function nextNative(context){var first=context.t;var last=context.t;var braces=1;while(context.t",""":'"',"'":"'"};function treatHTMLSequences(text_with_html){var re=null;var key=null;for(key in html_sequences){re=new RegExp(key,"gi");text_with_html=text_with_html.replace(re,html_sequences[key])}return text_with_html}function read_microprg(context){var microprograma=[];var microcomments=[];resetComments(context);if(!isToken(context,"{")){return langError(context,i18n_get_TagFor("compiler","OPEN BRACE NOT FOUND"))}nextToken(context);while(!isToken(context,"}")){var microInstruccionAux={};if(!isToken(context,"(")){var newLabelName=getToken(context);newLabelName=newLabelName.substring(0,newLabelName.length-1);if("TAG"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","LABEL NOT FOUND")+"'"+newLabelName+"'")}for(var contadorMCAux in context.etiquetas){if(context.etiquetas[contadorMCAux]==newLabelName){return langError(context,i18n_get_TagFor("compiler","REPEATED LABEL")+"'"+getToken(context)+"'")}}context.etiquetas[context.contadorMC]=newLabelName;if(newLabelName.match("[a-zA-Z_0-9]*")[0]!=newLabelName){return langError(context,i18n_get_TagFor("compiler","INVALID LABEL FORMAT")+"'"+getToken(context)+"'")}nextToken(context)}if(!isToken(context,"(")){return langError(context,i18n_get_TagFor("compiler","OPEN PAREN. NOT FOUND"))}nextToken(context);while(!isToken(context,")")){var nombre_tok=getToken(context).toUpperCase();if(nombre_tok=="MADDR"){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);var labelsNotFoundAux={};labelsNotFoundAux.nombre=getToken(context);labelsNotFoundAux.cycle=microprograma.length;labelsNotFoundAux.index=context.i;labelsNotFoundAux.instruction=context.instrucciones.length;var etiquetaFounded=0;for(var k in context.etiquetas){if(isToken(context,context.etiquetas[k])){microInstruccionAux[nombre_tok]=k.toString();etiquetaFounded=1}}if(etiquetaFounded==0){context.labelsNotFound.push(labelsNotFoundAux)}nextToken(context);if(isToken(context,","))nextToken(context);continue}if(typeof simhw_sim_signal(nombre_tok)=="undefined"){return langError(context,i18n_get_TagFor("compiler","SIGNAL NOT EXISTS")+"'"+nombre_tok+"'")}if(typeof simhw_sim_signal(nombre_tok).forbidden!="undefined"){return langError(context,nombre_tok+" "+i18n_get_TagFor("compiler","SIGNAL NO DIRECTLY"))}microInstruccionAux[nombre_tok]=1;nextToken(context);if(isToken(context,"=")){nextToken(context);microInstruccionAux[nombre_tok]=parseInt(getToken(context),2);if(getToken(context).match("[01]*")[0]!=getToken(context)){return langError(context,i18n_get_TagFor("compiler","INCORRECT BIN. FORMAT")+"'"+getToken(context)+"'")}if(microInstruccionAux[nombre_tok]>=Math.pow(2,simhw_sim_signal(nombre_tok).nbits)){return langError(context,i18n_get_TagFor("compiler","OUT OF RANGE")+"'"+getToken(context)+"'")}nextToken(context)}if(isToken(context,",")){nextToken(context)}}var acc_cmt=getComments(context);microcomments.push(acc_cmt);resetComments(context);microprograma.push(microInstruccionAux);context.contadorMC++;nextToken(context);if(isToken(context,","))nextToken(context)}if(microprograma.length===0){return langError(context,i18n_get_TagFor("compiler","EMPTY MICROCODE"))}nextToken(context);return{NATIVE:"",microprograma:microprograma,microcomments:microcomments}}function read_native(context){var microprograma=[];var microcomments=[];if(!isToken(context,"{")){return langError(context,i18n_get_TagFor("compiler","OPEN BRACE NOT FOUND"))}nextNative(context);var native_code=getToken(context);microprograma.push({});microcomments.push("");nextToken(context);return{NATIVE:native_code,microprograma:microprograma,microcomments:microcomments}}function find_first_cocop(context,curr_instruction,first_co,last_co){var k=0;var m=0;var ret={};ret.label_co="";ret.label_cop="";var cop_overlaps=false;for(m=0;m100){return langError(context,i18n_get_TagFor("compiler","MORE 100 FIELDS"))}if(auxValue=="co"){return langError(context,i18n_get_TagFor("compiler","CO AS FIELD NAME"))}if(auxValue=="nwords"){return langError(context,i18n_get_TagFor("compiler","NW AS FIELD NAME"))}}if(isToken(context,"(")){firma=firma+",(";if(plus_found)firmaUsuario=firmaUsuario+"+(";else firmaUsuario=firmaUsuario+" (";nextToken(context);if(!isToken(context,",")&&!isToken(context,"(")&&!isToken(context,")")){var campoAux={};campoAux.name=getToken(context);campos.push(campoAux);numeroCampos++;firma=firma+getToken(context);firmaUsuario=firmaUsuario+getToken(context);nextToken(context)}else{return langError(context,i18n_get_TagFor("compiler","MISSING TOKEN ON")+"'"+context.co_cop[instruccionAux.co].signature+"'")}if(isToken(context,")")){firma=firma+")";firmaUsuario=firmaUsuario+")";nextToken(context)}else{return langError(context,i18n_get_TagFor("compiler","MISSING ) ON")+"'"+context.co_cop[instruccionAux.co].signature+"'")}}firma=firma+",";firmaUsuario=firmaUsuario+" "}firma=firma.substr(0,firma.length-1);firma=firma.replace(/,,/g,",");firmaUsuario=firmaUsuario.substr(0,firmaUsuario.length-1);firmaUsuario=firmaUsuario.replace(/ /g," ");instruccionAux.signature=firma;instruccionAux.signatureGlobal=firma;instruccionAux.signatureUser=firmaUsuario;instruccionAux.signatureRaw=firmaUsuario;nextToken(context);if(!isToken(context,"co")){return langError(context,i18n_get_TagFor("compiler","NO CO FIELD"))}nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.co=getToken(context);if(getToken(context).match("[01]*")[0]!=getToken(context)||getToken(context).length!==xr_info.ir.default_eltos.co.length){return langError(context,i18n_get_TagFor("compiler","INCORRECT CO BIN.")+"'"+getToken(context)+"'")}if(instruccionAux.co!=all_ones_co){if(typeof context.co_cop[instruccionAux.co]!=="undefined"&&context.co_cop[instruccionAux.co].cop===null){return langError(context,i18n_get_TagFor("compiler","CO ALREADY USED")+context.co_cop[instruccionAux.co].signature)}if(typeof context.co_cop[instruccionAux.co]=="undefined"){context.co_cop[instruccionAux.co]={};context.co_cop[instruccionAux.co].signature=instruccionAux.signature;context.co_cop[instruccionAux.co].cop=null}}nextToken(context);if(isToken(context,","))nextToken(context);if(isToken(context,"cop")){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.cop=getToken(context);if(getToken(context).match("[01]*")[0]!=getToken(context)){return langError(context,i18n_get_TagFor("compiler","INCORRECT COP BIN.")+"'"+getToken(context)+"'")}if(context.co_cop[instruccionAux.co].cop!=null&&typeof context.co_cop[instruccionAux.co].cop[instruccionAux.cop]!="undefined"){return langError(context,i18n_get_TagFor("compiler","CO+COP ALREADY USED")+"'"+context.co_cop[instruccionAux.co].cop[instruccionAux.cop]+"'")}if(context.co_cop[instruccionAux.co].cop==null)context.co_cop[instruccionAux.co].cop={};context.co_cop[instruccionAux.co].cop[instruccionAux.cop]=instruccionAux.signature;nextToken(context);if(isToken(context,",")){nextToken(context)}}if(!isToken(context,"nwords")){return langError(context,i18n_get_TagFor("compiler","NO NWORDS"))}nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.nwords=getToken(context);nextToken(context);if(isToken(context,","))nextToken(context);var camposInsertados=0;var overlapping={};while(camposInsertados32*parseInt(instruccionAux.nwords)-1){return langError(context,i18n_get_TagFor("compiler","STARTBIT OoR")+"'"+getToken(context)+"'")}nextToken(context);if(!isToken(context,",")){return langError(context,i18n_get_TagFor("compiler","COMMA NOT FOUND"))}nextToken(context);campos[camposInsertados].stopbit=getToken(context);var stop=parseInt(campos[camposInsertados].stopbit);if(stop>32*parseInt(instruccionAux.nwords)){return langError(context,i18n_get_TagFor("compiler","STOPBIT OoR")+"'"+getToken(context)+"'")}for(i=stop;i<=start;i++){if(typeof overlapping[i]!="undefined"){return langError(context,i18n_get_TagFor("compiler","OVERLAPPING FIELD")+campos[camposInsertados].name)}overlapping[i]=1}nextToken(context);if(!isToken(context,")")){return langError(context,i18n_get_TagFor("compiler","CLOSE PAREN. NOT FOUND"))}nextToken(context);if(campos[camposInsertados].type=="address"){if(getToken(context)!="abs"&&getToken(context)!="rel"){return langError(context,i18n_get_TagFor("compiler","INCORRECT ADDRESSING"))}campos[camposInsertados].address_type=getToken(context);nextToken(context)}if(isToken(context,",")){nextToken(context)}camposInsertados++}instruccionAux.fields=campos;instruccionAux.help="";if(isToken(context,"help")){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.help=getToken(context);if("STRING"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","UNKNOWN ESCAPE CHAR")+"'"+getToken(context)+"'")}nextToken(context);if(isToken(context,",")){nextToken(context)}}instruccionAux.is_native=false;if(isToken(context,"native")){instruccionAux["is_native"]=true;nextToken(context);if(isToken(context,","))nextToken(context)}if(instruccionAux["is_native"]===false&&typeof instruccionAux.cop!=="undefined"&&instruccionAux.cop.length!==xr_info.ir.default_eltos.cop.length){return langError(context,i18n_get_TagFor("compiler","BAD COP BIN. LEN.")+"'"+getToken(context)+"'")}ret={};if(true==instruccionAux.is_native)ret=read_native(context);else ret=read_microprg(context);if(typeof ret.error!="undefined")return ret;instruccionAux.NATIVE=ret.NATIVE;instruccionAux.microcode=ret.microprograma;instruccionAux.microcomments=ret.microcomments;context.instrucciones.push(instruccionAux);context.contadorMC=context.contadorMC+9;if(!isToken(context,"}")){return langError(context,i18n_get_TagFor("compiler","CLOSE BRACE NOT FOUND"))}nextToken(context)}if(context.stackRegister==null){return langError(context,i18n_get_TagFor("compiler","SP NOT DEFINED"))}var found=false;for(i=0;i=last_co){return langError(context,i18n_get_TagFor("compiler","NO CO CODES"))}first_co=parseInt(r.label_co,2);curr_instruction.co=r.label_co;context.co_cop[r.label_co].signature=curr_instruction.signature;if(r.label_cop!==""){curr_instruction.cop=r.label_cop;context.co_cop[r.label_co].cop[r.label_cop]=curr_instruction.signature;context.co_cop[r.label_co].withcop=true}}var labelsFounded=0;if(context.labelsNotFound.length>0){for(i=0;i0){for(var j=0;j0){file+="registers"+"\n{\n";for(i=0;i1&&n[0]=="0"){return ret}if(typeof n==="string"&&n.includes(".")){return ret}if(!isNaN(parseFloat(n))&&isFinite(n)){ret.isDecimal=true;ret.number=parseInt(n);return ret}return ret}function isOctal(n){var ret={number:0,isDecimal:false};if(n.substring(0,1)=="0"){var octal=n.substring(1).replace(/\b0+/g,"");ret.number=parseInt(octal,8);ret.isDecimal=ret.number.toString(8)===octal;return ret}return ret}function isHex(n){var ret={number:0,isDecimal:false};if(n.substring(0,2).toLowerCase()=="0x"){var hex=n.substring(2).toLowerCase().replace(/\b0+/g,"");if(hex==""){hex="0"}ret.number=parseInt(hex,16);ret.isDecimal=ret.number.toString(16)===hex;return ret}return ret}function isChar(n){var ret={number:0,isDecimal:false};var ret1=treatControlSequences(n);if(true==ret1.error){return ret}var possible_value=ret1.string;if(possible_value[0]=="'"&&possible_value[2]=="'"||possible_value[0]=='"'&&possible_value[2]=='"'){ret.number=possible_value.charCodeAt(1);ret.isDecimal=true;return ret}return ret}function isFloat(n){var ret={number:0,isFloat:false};var non_float=/[a-df-zA-DF-Z]+/;if(non_float.test(n)===true){return ret}ret.number=parseFloat(n);ret.isFloat=!isNaN(ret.number);return ret}function get_decimal_value(possible_value){var ret={number:0,isDecimal:true};ret=isOctal(possible_value);if(ret.isDecimal===false){ret=isHex(possible_value)}if(ret.isDecimal===false){ret=isDecimal(possible_value)}if(ret.isDecimal===false){ret=isChar(possible_value)}return ret}function decimal2binary(number,size){var num_bits=number.toString(2);if(num_bits.length>WORD_LENGTH){return[num_bits,size-num_bits.length]}num_bits=(number>>>0).toString(2);if(number>=0){return[num_bits,size-num_bits.length]}num_bits="1"+num_bits.replace(/^[1]+/g,"");if(num_bits.length>size){return[num_bits,size-num_bits.length]}num_bits="1".repeat(size-num_bits.length)+num_bits;return[num_bits,size-num_bits.length]}function float2binary(f,size){var buf=new ArrayBuffer(8);var float=new Float32Array(buf);var uint=new Uint32Array(buf);float[0]=f;return decimal2binary(uint[0],size)}function get_inm_value(value){var ret1={};var ret={number:0,isDecimal:false,isFloat:false};ret1=get_decimal_value(value);if(ret1.isDecimal==true){ret1.isFloat=false;return ret1}ret1=isFloat(value);if(ret1.isFloat==true){ret1.isDecimal=false;return ret1}return ret}function isValidTag(tag){if(tag.trim()==""){return false}var ret=isDecimal(tag[0]);if(ret.isDecimal==true){return false}var myRegEx=/[^a-z,_\d]/i;return!myRegEx.test(tag)}function sum_array(a){return a.reduce((function(a,b){return a+b}),0)}function get_candidate(advance,instruction){var candidate=false;var candidates={};var signatures={};for(i=0;icandidates[i]){min=candidates[i];candidate=i}}}return candidate?parseInt(candidate):candidate}function reset_assembly(nwords){return"0".repeat(WORD_LENGTH*nwords)}function assembly_replacement(machineCode,num_bits,startbit,stopbit,free_space){var machineCodeAux=machineCode.substring(0,machineCode.length-startbit+free_space);machineCode=machineCodeAux+num_bits+machineCode.substring(machineCode.length-stopbit);return machineCode}function assembly_co_cop(machineCode,co,cop){var xr_info=simhw_sim_ctrlStates_get();if(co!==false)machineCode=assembly_replacement(machineCode,co,WORD_LENGTH,WORD_LENGTH-6,0);if(cop!==false)machineCode=assembly_replacement(machineCode,cop,xr_info.ir.default_eltos.cop.length,0,0);return machineCode}function writememory_and_reset(mp,gen,nwords){if(gen.byteWord>=WORD_BYTES){var melto={value:gen.machineCode,source_tracking:gen.track_source,comments:gen.comments};main_memory_set(mp,"0x"+gen.seg_ptr.toString(16),melto);gen.seg_ptr=gen.seg_ptr+WORD_BYTES;gen.byteWord=0;gen.track_source=[];gen.comments=[];gen.machineCode=reset_assembly(nwords)}}function is_end_of_file(context){return""===getToken(context)&&context.t>=context.text.length}function read_data(context,datosCU,ret){var seg_name=getToken(context);var gen={};gen.byteWord=0;gen.track_source=[];gen.comments=[];gen.machineCode=reset_assembly(1);gen.seg_ptr=ret.seg[seg_name].begin;nextToken(context);while(!is_directive_segment(getToken(context))&&!is_end_of_file(context)){var possible_tag="";while(!is_directive_datatype(getToken(context))&&!is_end_of_file(context)){possible_tag=getToken(context);if("TAG"!=getTokenType(context)){if(""==possible_tag){possible_tag="[empty]"}return langError(context,i18n_get_TagFor("compiler","NO TAG OR DIRECTIVE")+"'"+possible_tag+"'")}var tag=possible_tag.substring(0,possible_tag.length-1);if(!isValidTag(tag)){return langError(context,i18n_get_TagFor("compiler","INVALID TAG FORMAT")+"'"+tag+"'")}if(context.firmware[tag]){return langError(context,i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+tag+"'")}if(ret.labels2[tag]){return langError(context,i18n_get_TagFor("compiler","REPEATED TAG")+"'"+tag+"'")}ret.labels2[tag]="0x"+(gen.seg_ptr+gen.byteWord).toString(16);nextToken(context)}if(is_end_of_file(context)){break}var possible_datatype=getToken(context);if(".word"==possible_datatype||".half"==possible_datatype||".byte"==possible_datatype||".float"==possible_datatype||".double"==possible_datatype){var size=get_datatype_size(possible_datatype);nextToken(context);var possible_value=getToken(context);while(!is_directive(getToken(context))&&!is_end_of_file(context)){var label_found=false;var ret1=get_inm_value(possible_value);var number=ret1.number;if(ret1.isDecimal==false&&ret1.isFloat==false){if(".word"!==possible_datatype){return langError(context,i18n_get_TagFor("compiler","NO NUMERIC DATATYPE")+"'"+possible_value+"'")}if(!isValidTag(possible_value)){return langError(context,i18n_get_TagFor("compiler","INVALID TAG FORMAT")+"'"+possible_value+"'")}if(context.firmware[possible_value]){return langError(context,i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+possible_value+"'")}number=0;label_found=true}if(ret1.isDecimal==true)a=decimal2binary(number,size*BYTE_LENGTH);else a=float2binary(number,size*BYTE_LENGTH);num_bits=a[0];free_space=a[1];if(free_space<0){return langError(context,i18n_get_TagFor("compiler","EXPECTED VALUE")+possible_datatype+"' ("+size*BYTE_LENGTH+" bits), "+i18n_get_TagFor("compiler","BUT INSERTED")+possible_value+"' ("+num_bits.length+" bits) "+i18n_get_TagFor("compiler","INSTEAD"))}writememory_and_reset(ret.mp,gen,1);while((gen.seg_ptr+gen.byteWord)%size!=0){gen.byteWord++;writememory_and_reset(ret.mp,gen,1)}if(""!=possible_tag){ret.labels2[possible_tag.substring(0,possible_tag.length-1)]="0x"+(gen.seg_ptr+gen.byteWord).toString(16);possible_tag=""}if(label_found){ret.labels["0x"+gen.seg_ptr.toString(16)]={name:possible_value,addr:gen.seg_ptr,startbit:31,stopbit:0,rel:undefined,nwords:1,labelContext:getLabelContext(context)}}gen.machineCode=assembly_replacement(gen.machineCode,num_bits,BYTE_LENGTH*(size+gen.byteWord),BYTE_LENGTH*gen.byteWord,free_space);gen.byteWord+=size;gen.track_source.push(possible_value);nextToken(context);if(","==getToken(context)){nextToken(context)}if(is_directive(getToken(context))||"TAG"==getTokenType(context)||"."==getToken(context)[0]){break}possible_value=getToken(context)}}else if(".space"==possible_datatype){nextToken(context);var possible_value=getToken(context);var ret1=isDecimal(possible_value);possible_value=ret1.number;if(ret1.isDecimal==false){return langError(context,i18n_get_TagFor("compiler","NO NUMBER OF BYTES")+"'"+possible_value+"'")}if(possible_value<0){return langError(context,i18n_get_TagFor("compiler","NO POSITIVE NUMBER")+"'"+possible_value+"'")}for(i=0;i=0){return langError(context,i18n_get_TagFor("compiler","INVALID ALIGN VALUE")+"'"+possible_value+"'. "+i18n_get_TagFor("compiler","REMEMBER ALIGN VAL"))}writememory_and_reset(ret.mp,gen,1);var align_offset=Math.pow(2,parseInt(possible_value));switch(align_offset){case 1:break;case 2:if(gen.byteWord&1==1)gen.byteWord++;break;default:writememory_and_reset(ret.mp,gen,1);while(gen.seg_ptr%align_offset!=0||gen.byteWord!=0){gen.byteWord++;writememory_and_reset(ret.mp,gen,1)}}nextToken(context)}else if(".ascii"==possible_datatype||".asciiz"==possible_datatype){nextToken(context);var possible_value=getToken(context);var ret1=treatControlSequences(possible_value);if(true==ret1.error){return langError(context,ret1.string)}possible_value=ret1.string;while(!is_directive(getToken(context))&&!is_end_of_file(context)){writememory_and_reset(ret.mp,gen,1);if('"'!==possible_value[0]){return langError(context,i18n_get_TagFor("compiler","NO QUOTATION MARKS")+"'"+possible_value+"'")}if('"'!==possible_value[possible_value.length-1]){return langError(context,i18n_get_TagFor("compiler","NOT CLOSED STRING"))}if(""==possible_value){return langError(context,i18n_get_TagFor("compiler","NOT CLOSED STRING"))}if("STRING"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","NO QUOTATION MARKS")+"'"+possible_value+"'")}for(i=0;i0){var melto={value:gen.machineCode,source_tracking:gen.track_source,comments:gen.comments};main_memory_set(ret.mp,"0x"+gen.seg_ptr.toString(16),melto);gen.seg_ptr=gen.seg_ptr+WORD_BYTES}ret.seg[seg_name].end=gen.seg_ptr}function read_text(context,datosCU,ret){var seg_name=getToken(context);var seg_ptr=ret.seg[seg_name].begin;var firmware=context.firmware;var pseudoInstructions=context.pseudoInstructions;var finish=[];var isPseudo=false;var pfinish=[];var npseudoInstructions=0;var pseudo_fields={};var counter=-1;var candidate;var error="";var registers={};for(i=0;i=signature_fields[j].length){if("TAG"!=getTokenType(context)&&!firmware[value]&&!is_end_of_file(context)){advance[j]=0}continue}var field=firmware[instruction][j].fields[i];var size=field.startbit-field.stopbit+1;var label_found=false;var sel_found=false;switch(field.type){case"address":case"inm":if(isPseudo&&"sel"==value){counter++;var start=pfinish[counter++];var stop=pfinish[counter++];var value=pseudo_fields[pfinish[counter++]];counter++;sel_found=true}var ret1=get_inm_value(value);converted=ret1.number;if(ret1.isDecimal==false&&ret1.isFloat==false){error=i18n_get_TagFor("compiler","NO NUMERIC DATATYPE")+"'"+value+"'";if(value[0]=="'"){advance[j]=0;break}if(!isValidTag(value)){advance[j]=0;break}if(firmware[value]){error=i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+value+"'";advance[j]=0;break}label_found=true}if(sel_found){if(ret1.isDecimal==true)res=decimal2binary(converted,WORD_LENGTH);else res=float2binary(converted,WORD_LENGTH);if(res[1]<0){return langError(context,"'"+value+"' "+i18n_get_TagFor("compiler","BIGGER THAN")+WORD_LENGTH+" "+i18n_get_TagFor("compiler","BITS"))}converted="0".repeat(res[1])+res[0];converted=converted.substring(WORD_LENGTH-start-1,WORD_LENGTH-stop);converted=parseInt(converted,2);s[i+1]="0x"+converted.toString(16)}if(!label_found){if(ret1.isDecimal==true)var res=decimal2binary(converted,size);else var res=float2binary(converted,size);if(field.type=="address"&&"rel"==field.address_type){res=decimal2binary(converted-seg_ptr-WORD_BYTES,size)}}break;case"reg":if(typeof value==="undefined"){error=i18n_get_TagFor("compiler","INS. MISSING FIELD");advance[j]=0;break}var aux=false;if(value.startsWith("(")){if("(reg)"!=signature_fields[j][i]){error=i18n_get_TagFor("compiler","UNEXPECTED (REG)");advance[j]=0;break}if(counter==-1){nextToken(context);value=getToken(context)}else{value=pseudo_fields[pfinish[counter++]]}aux=true}else{if("(reg)"==signature_fields[j][i]){error=i18n_get_TagFor("compiler","EXPECTED (REG)")+"'"+value+"'";advance[j]=0;break}}if(typeof registers[value]==="undefined"){error=i18n_get_TagFor("compiler","EXPECTED REG")+"'"+value+"'";advance[j]=0;break}if(aux){s[i+1]="("+value+")";if(counter==-1){nextToken(context);aux=getToken(context)}else{aux=pfinish[counter++]}if(")"!=aux){error=i18n_get_TagFor("compiler","CLOSE PAREN. NOT FOUND");advance[j]=0;break}}var ret1=isDecimal(registers[value]);converted=ret1.number;var res=decimal2binary(converted,size);value=s[i+1];break;default:return langError(context,i18n_get_TagFor("compiler","UNKNOWN 1")+"'"+field.type+"'")}if(advance[j]==1&&!label_found){if(res[1]<0){if(field.type=="address"&&"rel"==field.address_type){error="Relative value ("+(converted-seg_ptr-WORD_BYTES)+" in decimal)"+i18n_get_TagFor("compiler","NEEDS")+res[0].length+i18n_get_TagFor("compiler","SPACE FOR # BITS")+size+" "+i18n_get_TagFor("compiler","BITS")}else{error="'"+value+"'"+i18n_get_TagFor("compiler","NEEDS")+res[0].length+i18n_get_TagFor("compiler","SPACE FOR # BITS")+size+" "+i18n_get_TagFor("compiler","BITS")}advance[j]=0}}if(advance[j]==1&&!(isPseudo&&counter==-1)){binaryAux[j][i]={num_bits:label_found?false:res[0],free_space:label_found?false:res[1],startbit:field.startbit,stopbit:field.stopbit,rel:label_found?field.address_type:false,islabel:label_found,field_name:value}}}if(sum_array(advance)==0){break}if("TAG"==getTokenType(context)||firmware[value]){break}}for(i=0;i0&&i0&&i==firmware[instruction].length-1){format+=" or "}format+="'"+firmware[instruction][i].signatureUser+"'"}if(format==""){format="'"+instruction+"' "+i18n_get_TagFor("compiler","UNKNOWN MC FORMAT")}var sum_res=sum_array(advance);if(sum_res==0){if(advance.length===1){return langError(context,error+".
"+i18n_get_TagFor("compiler","REMEMBER I. FORMAT")+format)}return langError(context,i18n_get_TagFor("compiler","NOT MATCH MICRO")+"
"+i18n_get_TagFor("compiler","REMEMBER I. FORMAT")+format+". "+i18n_get_TagFor("compiler","CHECK MICROCODE"))}if(sum_res>1){candidate=get_candidate(advance,firmware[instruction]);if(candidate===false){return langError(context,i18n_get_TagFor("compiler","SEVERAL CANDIDATES")+format)}}if(isPseudo){if(counter==-1){var s_ori=s.join(" ");s_ori=s_ori.trim();var key="";var val="";pseudo_fields={};for(i=0;i1){s_ori=" "}if(pfinish[counter]=="\n"){counter++}}var machineCode=reset_assembly(firmware[instruction][candidate].nwords);machineCode=assembly_co_cop(machineCode,firmware[instruction][candidate].co,firmware[instruction][candidate].cop);for(i=0;i=0;i--){if(icontext.text.length){break}}ret.seg[seg_name].end=seg_ptr}function simlang_compile(text,datosCU){var context={};context.line=1;context.error=null;context.i=0;context.contadorMC=0;context.etiquetas={};context.labelsNotFound=[];context.instrucciones=[];context.co_cop={};context.registers=[];context.text=text;context.tokens=[];context.token_types=[];context.t=0;context.newlines=[];context.pseudoInstructions=[];context.stackRegister=null;context.firmware={};context.comments=[];for(i=0;i=0;j--){var melto={value:machineCode.substring(j*WORD_LENGTH,(j+1)*WORD_LENGTH),source_tracking:null,comments:null};main_memory_set(ret.mp,"0x"+auxAddr.toString(16),melto);auxAddr+=WORD_BYTES}}if(text_found){if(typeof ret.labels2["main"]==="undefined"&&typeof ret.labels2["kmain"]==="undefined"){return langError(context,i18n_get_TagFor("compiler","NO MAIN OR KMAIN"))}}for(var key in ret.labels2){ret.revlabels2[ret.labels2[key]]=key}for(var skey in ret.seg){ret.revseg.push({begin:parseInt(ret.seg[skey].begin),name:skey})}return ret}var WSCFG={};function get_cfg(field){return WSCFG[field].value}function set_cfg(field,value){WSCFG[field].value=value}function update_cfg(field,value){WSCFG[field].value=value;simcore_record_append_new("Set configuration option "+field+" to "+value,'update_cfg("'+field+'","'+value+'");\n');ga("send","event","config","config."+WSCFG.version.value,"config."+WSCFG.version.value+"."+field+"."+value);save_cfg()}function is_cfg_empty(){return Object.keys(WSCFG).length===0}function save_cfg(){try{for(var item in WSCFG){localStorage.setItem("wepsim_"+item,get_cfg(item))}}catch(err){console.log("WepSIM can not save the configuration in a persistent way on this web browser,\n"+"found following error: \n"+err.message)}set_secondary_cfg()}function restore_cfg(){WSCFG=get_primary_cfg();set_secondary_cfg();if(localStorage===null){return}var default_value=null;var saved_value=null;for(var item in WSCFG){if(item==="version"){continue}default_value=get_cfg(item);set_cfg(item,localStorage.getItem("wepsim_"+item));if(WSCFG[item].type!="string"){try{saved_value=JSON.parse(get_cfg(item));set_cfg(item,saved_value)}catch(e){saved_value=null}}if(saved_value===null){set_cfg(item,default_value)}}set_secondary_cfg()}function reset_cfg(){WSCFG=get_primary_cfg();set_secondary_cfg();save_cfg()}function reset_cfg_values(){WSCFG=get_primary_cfg();set_secondary_cfg()}function upgrade_cfg(){var wscfg=get_primary_cfg();var item=null;for(item in wscfg){if(typeof WSCFG[item]==="undefined"){WSCFG[item]=wscfg[item]}if(WSCFG[item].value===null||WSCFG[item].value==="null"){WSCFG[item].value=wscfg[item].value}}if(wscfg.build.value!=WSCFG.build.value){for(item in wscfg){if(wscfg[item].upgrade){WSCFG[item]=wscfg[item]}}}set_secondary_cfg();save_cfg()}function is_mobile(){if(typeof navigator==="undefined"){return false}return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function is_cordova(){return document.URL.indexOf("http://")===-1&&document.URL.indexOf("https://")===-1}function get_primary_cfg(){var wscfg={version:{upgrade:false,type:"string",value:"2.1.5"},build:{upgrade:true,type:"string",value:"2.1.5.20201220A"},color_data_active:{upgrade:false,type:"string",value:"#0066FF"},color_data_inactive:{upgrade:false,type:"string",value:"rgb(0, 0, 0)"},color_name_active:{upgrade:false,type:"string",value:"red"},color_name_inactive:{upgrade:false,type:"string",value:"rgb(0, 0, 0)"},size_active:{upgrade:false,type:"float",value:1.25},size_inactive:{upgrade:false,type:"float",value:.02},is_byvalue:{upgrade:false,type:"boolean",value:false},RF_display_format:{upgrade:false,type:"string",value:"unsigned_16_fill"},RF_display_name:{upgrade:false,type:"string",value:"numerical"},MEM_display_format:{upgrade:true,type:"string",value:"unsigned_16_nofill"},MEM_show_segments:{upgrade:true,type:"boolean",value:false},MEM_show_source:{upgrade:true,type:"boolean",value:false},MEM_display_direction:{upgrade:true,type:"string",value:"h2l"},is_editable:{upgrade:false,type:"boolean",value:true},DBG_delay:{upgrade:false,type:"int",value:5},DBG_level:{upgrade:false,type:"string",value:"microinstruction"},DBG_limitins:{upgrade:false,type:"int",value:1e4},DBG_limitick:{upgrade:false,type:"int",value:1e3},ICON_theme:{upgrade:false,type:"string",value:"classic"},AS_enable:{upgrade:true,type:"boolean",value:true},AS_delay:{upgrade:true,type:"int",value:500},NOTIF_delay:{upgrade:false,type:"int",value:1e3},CPUCU_size:{upgrade:true,type:"int",value:7},C1C2_size:{upgrade:true,type:"int",value:8},SHOWCODE_label:{upgrade:false,type:"boolean",value:true},SHOWCODE_addr:{upgrade:false,type:"boolean",value:true},SHOWCODE_hex:{upgrade:false,type:"boolean",value:true},SHOWCODE_ins:{upgrade:false,type:"boolean",value:true},SHOWCODE_pins:{upgrade:false,type:"boolean",value:true},ws_mode:{upgrade:false,type:"string",value:"newbie"},ws_action:{upgrade:false,type:"string",value:"checkpoint"},is_interactive:{upgrade:false,type:"boolean",value:true},is_quick_interactive:{upgrade:false,type:"boolean",value:false},ws_idiom:{upgrade:false,type:"string",value:"en"},use_voice:{upgrade:false,type:"boolean",value:false},ws_skin_ui:{upgrade:false,type:"string",value:"classic"},ws_skin_user:{upgrade:false,type:"string",value:"only_asm:of:only_frequent:of"},ws_skin_dark_mode:{upgrade:false,type:"boolean",value:false},editor_theme:{upgrade:false,type:"string",value:"default"},editor_mode:{upgrade:false,type:"string",value:"default"},base_url:{upgrade:true,type:"string",value:"https://acaldero.github.io/wepsim/ws_dist/"},cfg_url:{upgrade:true,type:"string",value:"examples/configuration/default.json"},example_url:{upgrade:true,type:"string",value:"examples/examples_set/default.json"},hw_url:{upgrade:true,type:"string",value:"examples/hardware/hw.json"},max_json_size:{upgrade:true,type:"int",value:1*1024*1024},verbal_verbose:{upgrade:false,type:"string",value:"math"}};if(is_mobile()){wscfg.NOTIF_delay.value=2e3;wscfg.ICON_theme.value="cat1";wscfg.CPUCU_size.value=7;wscfg.C1C2_size.value=14;wscfg.ws_skin_ui.value="compact"}return wscfg}function set_secondary_cfg(){var dbg_delay=get_cfg("DBG_delay");if(dbg_delay<5){cfg_show_rf_delay=350;cfg_show_eltos_delay=350;cfg_show_main_memory_delay=450;cfg_show_control_memory_delay=360;cfg_show_dbg_ir_delay=300;cfg_show_rf_refresh_delay=120}else{cfg_show_rf_delay=100;cfg_show_eltos_delay=100;cfg_show_main_memory_delay=150;cfg_show_control_memory_delay=120;cfg_show_dbg_ir_delay=100;cfg_show_rf_refresh_delay=30}cfg_show_asmdbg_pc_delay=50;if(dbg_delay<3)cfg_show_asmdbg_pc_delay=150}var ws_cfg_hash={};var ws_cfg_set=[];function cfgset_init(){var url_list=get_cfg("cfg_url");ws_cfg_set=wepsim_url_getJSON(url_list);for(var i=0;i"+index+"/"+ws_records.length+" "+msg)}if(ws_record_pb_obj!==null){var next_pbval=100*index/ws_records.length;ws_record_pb_obj.css("width",next_pbval+"%").attr("aria-valuenow",next_pbval)}}function simcore_record_playAt(index_current,index_last){if(ws_is_playing===false){simcore_record_showMsg(ws_last_played,"Stopped by user.");return}ws_last_played=index_current;if(index_current>=index_last){simcore_record_showMsg(index_last,"Done.");return}if(ws_records[index_current].description==="_pending event_"){simcore_record_playAt(index_current+1,index_last);return}eval(ws_records[index_current].element);var index_next=index_current+1;simcore_record_showMsg(index_next,ws_records[index_current].description);var wait_time=500;if(index_next0&&ws_records[ws_records.length-1].description==="_pending event_"){distance=ws_glowing_time}simcore_record_pushElto("_pending event_",";",distance)}}function simcore_record_resolve_pending(description,elto){if(ws_is_recording===true){var last_pending=ws_records.length;while(last_pending>0){last_pending--;if(ws_records[last_pending].description==="_pending event_"){break}}if(last_pending===0){simcore_record_setTimeBeforeNow(0);simcore_record_append_new(description,elto);return}ws_records[last_pending].description=description;ws_records[last_pending].element=elto;simcore_record_showMsg(0,"Recording...")}}function simcore_record_setTimeBeforeNow(distance){ws_last_time=Date.now()-distance}function simcore_record_addTimeAfterLast(distance){ws_last_time=ws_last_time+distance}function get_simware(){var cf=simhw_internalState("FIRMWARE");if(typeof cf["firmware"]=="undefined")cf["firmware"]=[];if(typeof cf["mp"]=="undefined")cf["mp"]={};if(typeof cf["seg"]=="undefined")cf["seg"]={};if(typeof cf["labels"]=="undefined")cf["labels"]={};if(typeof cf["labels2"]=="undefined")cf["labels2"]={};if(typeof cf["labels_firm"]=="undefined")cf["labels_firm"]={};if(typeof cf["registers"]=="undefined")cf["registers"]={};if(typeof cf["pseudoInstructions"]=="undefined")cf["pseudoInstructions"]=[];if(typeof cf["stackRegister"]=="undefined")cf["stackRegister"]=null;if(typeof cf["cihash"]=="undefined")cf["cihash"]={};if(typeof cf["cocop_hash"]=="undefined")cf["cocop_hash"]={};if(typeof cf["revlabels"]=="undefined")cf["revlabels"]={};if(typeof cf["revlabels2"]=="undefined")cf["revlabels2"]={};if(typeof cf["revseg"]=="undefined")cf["revseg"]=[];return cf}function set_simware(preWARE){var cf=simhw_internalState("FIRMWARE");if(typeof preWARE["firmware"]!="undefined")cf["firmware"]=preWARE["firmware"];if(typeof preWARE["mp"]!="undefined")cf["mp"]=preWARE["mp"];if(typeof preWARE["registers"]!="undefined")cf["registers"]=preWARE["registers"];if(typeof preWARE["pseudoInstructions"]!="undefined")cf["pseudoInstructions"]=preWARE["pseudoInstructions"];if(typeof preWARE["seg"]!="undefined")cf["seg"]=preWARE["seg"];if(typeof preWARE["labels"]!="undefined")cf["labels"]=preWARE["labels"];if(typeof preWARE["revlabels"]!="undefined")cf["revlabels"]=preWARE["revlabels"];if(typeof preWARE["revlabels2"]!="undefined")cf["revlabels2"]=preWARE["revlabels2"];if(typeof preWARE["labels_firm"]!="undefined")cf["labels_firm"]=preWARE["labels_firm"];if(typeof preWARE["stackRegister"]!="undefined")cf["stackRegister"]=preWARE["stackRegister"];if(typeof preWARE["cihash"]!="undefined")cf["cihash"]=preWARE["cihash"];if(typeof preWARE["cocop_hash"]!="undefined")cf["cocop_hash"]=preWARE["cocop_hash"];if(typeof preWARE["labels2"]!="undefined")cf["labels2"]=preWARE["labels2"];if(typeof preWARE["revseg"]!="undefined")cf["revseg"]=preWARE["revseg"]}function array_includes(arr,val){if(typeof arr.includes!="undefined"){return arr.includes(val)}for(var i=0;i0)tri_name=tri_activated_name;if(tri_activated>1)break}if(tri_activated>0){update_draw(simhw_sim_signal(tri_name),1)}if(simhw_internalState_get("fire_visible","internalbus")==true){update_bus_visibility("internalbus_fire","hidden");simhw_internalState_set("fire_visible","internalbus",false)}if(tri_activated>1){update_bus_visibility("internalbus_fire","visible");simhw_internalState_set("fire_visible","internalbus",true);simhw_sim_state("BUS_IB").value=4294967295}}function fn_updateE_now(key){if("E"==simhw_sim_signal(key).type){update_state(key)}}function fn_updateE_future(key){if(jit_fire_ndep[key]<1)fn_updateE_now(key);else return new Promise((function(resolve,reject){fn_updateE_now(key)}))}function fn_updateL_now(key){update_draw(simhw_sim_signal(key),simhw_sim_signal(key).value);if("L"==simhw_sim_signal(key).type){update_state(key)}}function fn_updateL_future(key){if(jit_fire_ndep[key]<1)fn_updateL_now(key);else return new Promise((function(resolve,reject){fn_updateL_now(key)}))}function update_state(key){var index_behavior=0;switch(simhw_sim_signal(key).behavior.length){case 0:return;break;case 1:index_behavior=0;break;default:index_behavior=simhw_sim_signal(key).value;if(simhw_sim_signal(key).behavior.lengthreg_maddr){break}assoc_i=i}if(-1==assoc_i){ws_alert("A new 'unknown' instruction is inserted,\n"+"please edit it (co, nwords, etc.) in the firmware textarea.");var new_ins=new Object;new_ins["name"]="unknown";new_ins["signature"]="unknown";new_ins["signatureGlobal"]="unknown";new_ins["co"]=0;new_ins["nwords"]=0;new_ins["mc-start"]=0;new_ins["fields"]=new Array;new_ins["microcode"]=new Array;new_ins["microcomments"]=new Array;SIMWARE["firmware"].push(new_ins);assoc_i=SIMWARE["firmware"].length-1}var pos=reg_maddr-parseInt(SIMWARE["firmware"][assoc_i]["mc-start"]);if(typeof SIMWARE["firmware"][assoc_i]["microcode"][pos]=="undefined"){SIMWARE["firmware"][assoc_i]["microcode"][pos]=new Object;SIMWARE["firmware"][assoc_i]["microcomments"][pos]=""}SIMWARE["firmware"][assoc_i]["microcode"][pos][key]=simhw_sim_signal(key).value;if(simhw_sim_signal(key).default_value==simhw_sim_signal(key).value){delete SIMWARE["firmware"][assoc_i]["microcode"][pos][key]}var bits=get_value(simhw_sim_state("REG_IR")).toString(2);bits="00000000000000000000000000000000".substring(0,32-bits.length)+bits;show_memories_values()}function propage_signal_update(key){if(true===get_cfg("is_interactive")){if(simhw_sim_signal(key).value!=simhw_sim_signal(key).default_value)simhw_sim_state("REG_MICROINS").value[key]=simhw_sim_signal(key).value;else delete simhw_sim_state("REG_MICROINS").value[key];var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var curr_maddr=get_value(simhw_sim_state(maddr_name));var mc_obj=simhw_internalState("MC");var mcelto=control_memory_get(mc_obj,curr_maddr);if(typeof mcelto==="undefined"){mcelto={}}mcelto.value[key]=simhw_sim_signal(key).value;mcelto.comments=[];control_memory_set(mc_obj,curr_maddr,mcelto);update_signal_firmware(key);var SIMWARE=get_simware();document.getElementById("inputFirmware").value=saveFirmware(SIMWARE)}compute_behavior("FIRE "+key)}function update_memories(preSIMWARE){var i=0;set_simware(preSIMWARE);var SIMWARE=get_simware();simhw_internalState_reset("MC",{});var mc_obj=simhw_internalState("MC");var mcelto=null;for(i=0;i>23&255)-127;var mantissa=1+(hexvalue&8388607)/8388608;var valuef=sign*mantissa*Math.pow(2,exponent);if(-127===exponent)if(1===mantissa)valuef=sign===1?"+0":"-0";else valuef=sign*((hexvalue&8388607)/8388607)*Math.pow(2,-126);if(128===exponent)if(1===mantissa)valuef=sign===1?"+Inf":"-Inf";else valuef="NaN";return valuef}function hex2char8(hexvalue){var valuec=[];valuec[0]=String.fromCharCode((hexvalue&4278190080)>>24);valuec[1]=String.fromCharCode((hexvalue&16711680)>>16);valuec[2]=String.fromCharCode((hexvalue&65280)>>8);valuec[3]=String.fromCharCode((hexvalue&255)>>0);return valuec}function simcoreui_pack(val,pack_size){var base_str="0".repeat(pack_size);return base_str.substring(0,pack_size-val.length)+val}function hex2bin(hexvalue){var valuebin=hexvalue.toString(2);valuebin=simcoreui_pack(valuebin,32);valuebin=valuebin.substring(0,4)+" "+valuebin.substring(4,8)+" "+valuebin.substring(8,12)+" "+valuebin.substring(12,16)+"
"+valuebin.substring(16,20)+" "+valuebin.substring(20,24)+" "+valuebin.substring(24,28)+" "+valuebin.substring(28,32);return valuebin}function value2string(format,value){var fmt_value="";var fmt=format.split("_");switch(fmt[0]){case"unsigned":fmt_value=value.toString(fmt[1]).toUpperCase();break;case"float":fmt_value=hex2float(value);break;case"char":fmt_value="'"+String.fromCharCode(value)+"'";break;default:fmt_value=value.toString()}if(fmt[2]==="fill"){fmt_value=simcoreui_pack(fmt_value,8)}return fmt_value}function get_deco_from_pc(pc){var mp_obj=simhw_internalState("MP");if(typeof mp_obj==="undefined"||typeof mp_obj[pc]==="undefined"||typeof mp_obj[pc].source==="undefined"){return""}return mp_obj[pc].source}function get_verbal_from_current_mpc(){var active_signals="";var active_verbal="";var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var curr_maddr=get_value(simhw_sim_state(maddr_name));var mcelto=simhw_internalState_get("MC",curr_maddr);var mins=get_value(mcelto);for(var key in mins){if("MADDR"===key){active_verbal=active_verbal+"MADDR is "+mins[key]+". ";continue}active_signals=active_signals+key+" ";active_verbal=active_verbal+compute_signal_verbals(key,mins[key])}active_signals=active_signals.trim();if(active_signals==="")active_signals="";if(active_verbal.trim()==="")active_verbal="";return"Activated signals are: "+active_signals+". Associated actions are: "+active_verbal}function get_verbal_from_current_pc(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=get_value(simhw_sim_state(pc_name));var pc=parseInt(reg_pc)-4;var decins=get_deco_from_pc(pc);if(""==decins.trim()){decins="not jet defined"}return"Current instruction is: "+decins+" and PC points to "+show_value(pc)+". "}function ko_observable(initial_value){if(typeof ko==="undefined"){return initial_value}if(typeof cfg_show_rf_refresh_delay==="undefined"){cfg_show_rf_refresh_delay=120}return ko.observable(initial_value).extend({rateLimit:cfg_show_rf_refresh_delay})}function ko_rebind_state(state,id_elto){if(typeof ko==="undefined"){return}if(typeof cfg_show_rf_refresh_delay==="undefined"){cfg_show_rf_refresh_delay=120}var state_obj=simhw_sim_state(state);if(typeof state_obj.value!=="function"){state_obj.value=ko.observable(state_obj.value).extend({rateLimit:cfg_show_rf_refresh_delay})}var ko_context=document.getElementById(id_elto);ko.cleanNode(ko_context);ko.applyBindings(simhw_sim_state(state),ko_context)}function show_rf_names(){return simcore_action_ui("CPU",0,"show_rf_names")()}function get_screen_content(){return simcore_action_ui("SCREEN",0,"get_screen_content")()}function set_screen_content(screen){simcore_action_ui("SCREEN",0,"set_screen_content")(screen)}function get_keyboard_content(){return simcore_action_ui("KBD",0,"get_keyboard_content")()}function set_keyboard_content(keystrokes){simcore_action_ui("KBD",0,"set_keyboard_content")(keystrokes)}function show_main_memory(memory,index,redraw,updates){return simcore_action_ui("MEMORY",0,"show_main_memory")(memory,index,redraw,updates)}function show_control_memory(memory,index,redraw){return simcore_action_ui("MEMORY",0,"show_control_memory")(memory,index,redraw)}function show_memories_values(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=get_value(simhw_sim_state(pc_name));show_main_memory(simhw_internalState("MP"),reg_pc,true,true);var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var reg_maddr=get_value(simhw_sim_state(maddr_name));show_control_memory(simhw_internalState("MC"),reg_maddr,true)}function update_draw(obj,value){return simcore_action_ui("CPU",1,"update_draw")(obj,value)}function update_bus_visibility(bus_name,value){return simcore_action_ui("CPU",1,"update_bus_visibility")(bus_name,value)}function refresh(){for(var key in simhw_sim_signals()){update_draw(simhw_sim_signals()[key],simhw_sim_signals()[key].value);check_buses(key)}show_dbg_ir(get_value(simhw_sim_state("REG_IR_DECO")))}function show_dbg_ir(value){return simcore_action_ui("MEMORY",0,"show_dbg_ir")(value)}function show_dbg_mpc(){return simcore_action_ui("MEMORY",0,"show_dbg_mpc")()}function show_asmdbg_pc(){return simcore_action_ui("MEMORY",0,"show_asmdbg_pc")()}function ws_alert(msg){if(typeof document==="undefined"){console.log(msg);return true}alert(msg);return true}function element_scroll_get(list_id){var offset=0;var obj_byid=$(list_id);if(obj_byid.length>0){offset=obj_byid[0].scrollTop}return offset}function element_scroll_set(list_id,offset){var obj_byid=$(list_id);if(obj_byid.length>0){obj_byid[0].scrollTop=offset}}function element_scroll_setRelative(list_id,obj_id,offset){var obj_byid=$(obj_id);if(obj_byid.length>0){var topPos=obj_byid[0].offsetTop;element_scroll_set(list_id,topPos+offset)}}function simcore_init(with_ui){var ret={};ret.msg="";ret.ok=true;if(with_ui){restore_cfg()}else{reset_cfg_values()}return ret}function simcore_init_hw(simhw_name){var ret={};ret.msg="";ret.ok=true;var hwid=simhw_getIdByName(simhw_name);if(hwid<0){ret.msg="ERROR: unknown hardware: "+simhw_name+".
\n";ret.ok=false;return ret}simhw_setActive(hwid);var ret1=simcore_init_ui({});if(false===ret1.ok){ret.msg=ret.msg;ret.ok=false;return ret}return ret}function simcore_welcome(){var ret={};ret.msg="";ret.ok=true;console.log("");console.log("██╗ ██╗███████╗██████╗ ███████╗██╗███╗ ███╗");console.log("██║ ██║██╔════╝██╔══██╗██╔════╝██║████╗ ████║");console.log("██║ █╗ ██║█████╗ ██████╔╝███████╗██║██╔████╔██║");console.log("██║███╗██║██╔══╝ ██╔═══╝ ╚════██║██║██║╚██╔╝██║");console.log("╚███╔███╔╝███████╗██║ ███████║██║██║ ╚═╝ ██║");console.log(" ╚══╝╚══╝ ╚══════╝╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝");console.log("");console.log("Stable: https://github.com/wepsim/wepsim");console.log("Beta: https://github.com/acaldero/wepsim");console.log("");return ret}function simcore_init_ui(hash_detail2init){var ret={};ret.msg="";ret.ok=true;var detail_id=0;var sim_components=simhw_sim_components();for(var elto in sim_components){sim_components[elto].details_ui=[];for(var index in sim_components[elto].details_name){sim_components[elto].details_ui[index]={};detail_id=sim_components[elto].details_name[index];if(typeof hash_detail2init[detail_id]!=="undefined"){sim_components[elto].details_ui[index]=hash_detail2init[detail_id];sim_components[elto].details_ui[index].init()}}}return ret}function simcore_action_ui(component_name,detail_id,action_name){var sim_components=simhw_sim_components();if(typeof sim_components[component_name].details_ui[detail_id][action_name]==="undefined"){return simcore_do_nothing_handler}return sim_components[component_name].details_ui[detail_id][action_name]}function simcore_init_eventlistener(context,hash_detail2action,hash_signal2action){var context_obj=null;var r=[];var o=null;context_obj=document.getElementById(context).contentDocument;if(null==context_obj){console.log('warning: unreferenced graphic element context named "'+r[0]+'".');return}var sim_signals=simhw_sim_signals();for(var key in sim_signals){if(typeof hash_signal2action[key+"click"]==="undefined"){hash_signal2action[key+"click"]=function(key_value){return function(){hash_signal2action[""](key_value,"click")}}(key)}if(typeof hash_signal2action[key+"dblclick"]==="undefined"){hash_signal2action[key+"dblclick"]=function(key_value){return function(){hash_signal2action[""](key_value,"dblclick")}}(key)}for(var j=0;j\n"+"Please load some assembly code.
";ret.ok=false;return ret}var SIMWARE=get_simware();if(!(typeof curr_segments[".ktext"]!="undefined"&&SIMWARE.labels2.kmain)&&!(typeof curr_segments[".text"]!="undefined"&&SIMWARE.labels2.main)){ret.msg="labels 'kmain' (in .ktext) or 'main' (in .text) do not exist!";ret.ok=false;return ret}return ret}function simcore_check_if_can_continue2(reg_maddr,reg_pc){var ret={};ret.ok=true;ret.msg="";var curr_MC=simhw_internalState("MC");var mcelto=control_memory_get(curr_MC,reg_maddr);if(typeof mcelto==="undefined"){var hex_maddr="0x"+parseInt(reg_maddr).toString(16);ret.ok=false;ret.msg="Error: undefined microinstruction at "+hex_maddr+".";return ret}var curr_segments=simhw_internalState("segments");if(reg_pc=curr_segments[".ktext"].begin){return ret}if(reg_pc=curr_segments[".text"].begin){return ret}if(mcelto.is_native&&0===reg_maddr){return ret}if(0!==reg_maddr){if(reg_pc==curr_segments[".ktext"].end||reg_pc==curr_segments[".text"].end){return ret}}ret.ok=false;ret.msg="The program has finished because the PC register points outside .ktext/.text code segments";return ret}function simcore_check_if_can_continue(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=parseInt(get_value(simhw_sim_state(pc_name)));var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var reg_maddr=get_value(simhw_sim_state(maddr_name));return simcore_check_if_can_continue2(reg_maddr,reg_pc)}function simcore_reset(){var ret={};ret.msg="";ret.ok=true;var SIMWARE=get_simware();var curr_firm=simhw_internalState("FIRMWARE");var curr_segments=simhw_internalState("segments");var curr_MC=simhw_internalState("MC");var sim_components=simhw_sim_components();var ctrl_states=simhw_sim_ctrlStates_get();var pc_name=ctrl_states.pc.state;var pc_state=simhw_sim_state(pc_name);var sp_name=ctrl_states.sp.state;var sp_state=simhw_sim_state(sp_name);if(curr_firm.stackRegister!=null){sp_name=curr_firm.stackRegister;sp_state=simhw_sim_states().BR[sp_name];ctrl_states.sp.state="BR."+curr_firm.stackRegister}for(var elto in sim_components){var reset_signal_name=sim_components[elto].name+"_RESET";compute_general_behavior(reset_signal_name)}if(typeof curr_segments[".ktext"]!=="undefined"&&SIMWARE.labels2.kmain){set_value(pc_state,parseInt(SIMWARE.labels2.kmain));show_asmdbg_pc()}else if(typeof curr_segments[".text"]!=="undefined"&&SIMWARE.labels2.main){set_value(pc_state,parseInt(SIMWARE.labels2.main));show_asmdbg_pc()}if(typeof curr_segments[".stack"]!=="undefined"&&typeof sp_state!=="undefined"){set_value(sp_state,parseInt(curr_segments[".stack"].end)&4294967292)}var new_maddr=get_value(simhw_sim_state("MUXA_MICROADDR"));var mcelto=control_memory_get(curr_MC,new_maddr);if(typeof mcelto==="undefined"){mcelto={value:simhw_sim_state("REG_MICROINS").default_value,is_native:false}}var new_mins=get_value(mcelto);if(false==mcelto.is_native){compute_general_behavior("CLOCK")}show_dbg_ir(get_value(simhw_sim_state("REG_IR_DECO")));for(elto in sim_components){for(var index in sim_components[elto].details_name){if(typeof sim_components[elto].details_ui[index].reset!=="undefined"){sim_components[elto].details_ui[index].reset()}}}return ret}function simcore_execute_microinstruction(){var ret=simcore_check_if_can_continue();if(false===ret.ok){return ret}compute_general_behavior("CLOCK");show_dbg_mpc();return ret}function simcore_execute_microinstruction2(reg_maddr,reg_pc){var ret=simcore_check_if_can_continue2(reg_maddr,reg_pc);if(false===ret.ok){return ret}compute_general_behavior("CLOCK");show_dbg_mpc();return ret}function simcore_execute_microprogram(options){var ret=simcore_check_if_can_continue();if(false===ret.ok){return ret}var before_state=null;var after_state=null;var curr_mpc="";var curr_MC=simhw_internalState("MC");var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var maddr_state=simhw_sim_state(maddr_name);if(typeof options.before_microinstruction==="undefined"){options.before_microinstruction=simcore_do_nothing_handler}if(typeof options.after_microinstruction==="undefined"){options.after_microinstruction=simcore_do_nothing_handler}var i_clks=0;var limitless=options.cycles_limit<0;var cur_addr=0;var mcelto=null;do{options.before_microinstruction(curr_MC,cur_addr);compute_general_behavior("CLOCK");i_clks++;options.after_microinstruction(curr_MC,cur_addr);if(limitless===false&&i_clks>=options.cycles_limit){ret.msg="Warning: clock cycles limit reached in a single instruction.";ret.ok=false;break}cur_addr=get_value(maddr_state);mcelto=control_memory_get(curr_MC,cur_addr);if(typeof mcelto==="undefined"){ret.msg="Error: undefined microinstruction at "+cur_addr+".";ret.ok=false;break}}while(i_clks=code_begin||reg_pc=kcode_begin){options.before_instruction(SIMWARE,reg_pc);ret1=simcore_execute_microprogram(options);if(false===ret1.ok){return ret1}options.after_instruction(SIMWARE,reg_pc);ins_executed++;if(ins_executed>options.instruction_limit){ret.ok=false;ret.msg="more than "+options.instruction_limit+" instructions executed before application ends.";return ret}reg_pc_before=reg_pc;reg_pc=get_value(pc_state)}return ret}function simcore_do_nothing_handler(){return null}function simcore_compile_firmware(textToMCompile){var ret={};ret.msg="";ret.ok=true;if(""==textToMCompile){ret.msg="Empty Firmware";ret.ok=false;return ret}var preSM=null;try{preSM=loadFirmware(textToMCompile);ret.simware=preSM}catch(e){ret.msg="ERROR: at line: "+e.lineNumber+" and column: "+e.columnNumber;ret.ok=false;return ret}if(preSM.error!=null){ret.msg=preSM.error;ret.ok=false;return ret}update_memories(preSM);simcore_reset();return ret}function simcore_compile_assembly(textToCompile){var ret={};ret.msg="";ret.ok=true;var SIMWARE=get_simware();if(SIMWARE.firmware.length===0){ret.msg="Empty microcode, please load the microcode first.";ret.ok=false;return ret}var SIMWAREaddon=simlang_compile(textToCompile,SIMWARE);ret.simware=SIMWAREaddon;if(SIMWAREaddon.error!=null){ret.msg=SIMWAREaddon.error;ret.ok=false;return ret}set_simware(SIMWAREaddon);update_memories(SIMWARE);simcore_reset();return ret}function simcore_hardware_export(hw_name){var ret={};ret.msg="{}";ret.ok=false;var hw_obj=simhw_getObjByName(hw_name);if(null===hw_obj){return ret}ret.ok=true;ret.msg=JSON.stringify(hw_obj,(function(key,value){if(typeof value==="function"){return"/Function("+value.toString()+")/"}return value}));return ret}function simcore_hardware_import(hw_json){var ret={};ret.msg="";ret.ok=true;hw_obj=JSON.parse(hw_json,(function(key,value){if(typeof value==="string"&&value.startsWith("/Function(")&&value.endsWith(")/")){value=value.substring(10,value.length-2);return eval("("+value+")")}return value}));simhw_add(hw_obj);return ret}function simcore_native_get_signal(elto){return get_value(simhw_sim_signal(elto))>>>0}function simcore_native_set_signal(elto,value){set_value(simhw_sim_signal(elto),value);compute_behavior("FIRE "+elto);return value}function simcore_native_get_value(component,elto){var index=0;var sim_components=simhw_sim_components();var compo_index=component;if("BR"===component)compo_index="CPU";if("DEVICE"===component)compo_index="IO";if(typeof sim_components[compo_index].get_value!=="undefined"){return sim_components[compo_index].get_value(elto)}return false}function simcore_native_set_value(component,elto,value){var index=0;var sim_components=simhw_sim_components();var compo_index=component;if("BR"===component)compo_index="CPU";if("DEVICE"===component)compo_index="IO";if(typeof sim_components[compo_index].set_value!=="undefined"){return sim_components[compo_index].set_value(elto,value)}return false}function simcore_native_get_fields(signature_raw){var SIMWARE=get_simware();for(var key in SIMWARE.firmware){if(SIMWARE.firmware[key].signatureRaw===signature_raw){return SIMWARE.firmware[key].fields}}}function simcore_native_get_field_from_ir(fields,index){if(typeof fields[index]==="undefined"){ws_alert("simcore_native_get_field_from_ir: index ("+index+") out of range.");return false}var value=get_value(simhw_sim_state("REG_IR"));var left_shift=31-parseInt(fields[index].startbit);var right_shift=parseInt(fields[index].stopbit);value=value<>>left_shift;value=value>>>right_shift;return value}function simcore_native_deco(){compute_behavior("DECO")}function simcore_native_go_maddr(maddr){set_value(simhw_sim_state("MUXA_MICROADDR"),maddr)}function simcore_native_go_opcode(){var maddr=get_value(simhw_sim_state("ROM_MUXA"));set_value(simhw_sim_state("MUXA_MICROADDR"),maddr)}function simcore_native_go_instruction(signature_raw){var SIMWARE=get_simware();for(var key in SIMWARE.firmware){if(SIMWARE.firmware[key].signatureRaw===signature_raw){var maddr=SIMWARE.firmware[key]["mc-start"];set_value(simhw_sim_state("MUXA_MICROADDR"),maddr);return}}}function simcore_simstate_checklist2state(checklist){var o={};var ret=false;checklist=checklist.replace(/;|==|!=|>=|<=|=|>|v!=""));for(var i=0;i"===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)>parseInt(diff.expected);else if("<"===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)="===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)>=parseInt(diff.expected);else if("<="===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)<=parseInt(diff.expected);else if("=="===expected_result[compo][elto].op)diff.fulfill=diff.expected==diff.obtained;else if("!="===expected_result[compo][elto].op)diff.fulfill=diff.expected!=diff.obtained;d.result.push(diff);if(diff.fulfill===false)d.errors++}}if(newones_too&&typeof obtained_result[compo]!="undefined"){for(elto in obtained_result[compo]){d.neltos_obtained++;if(typeof expected_result[compo]!="undefined"&&typeof expected_result[compo][elto]!="undefined"){continue}diff={};diff.expected=obtained_result[compo][elto].default_value;diff.obtained=obtained_result[compo][elto].value;diff.fulfill=diff.expected===diff.obtained;diff.elto_type=compo.toLowerCase();diff.elto_id=obtained_result[compo][elto].id;diff.elto_op="=";d.result.push(diff);if(diff.fulfill===false)d.errors++}}}return d}function simcore_simstate_diff_results(expected_result,obtained_result){return simcore_simstate_check_results(expected_result,obtained_result,true)}function simcore_simstate_diff_states(before_state_obj,after_state_obj){var before_arr=simcore_simstate_state2checklist(before_state_obj,"").split(";");var after_arr=simcore_simstate_state2checklist(after_state_obj,"").split(";");return after_arr.filter((function(elto){return!before_arr.includes(elto)})).join(";").trim()}function simcore_simstate_checkreport2txt(checklist){var o="";for(var i=0;i"+""+""+"Type"+"IdentificationId."+"Values in the clipboard state"+"Values in the selected state"+""+""+"";for(var i=0;i"+""+checklist[i].elto_type+""+""+checklist[i].elto_id+""+""+checklist[i].elto_op+" "+checklist[i].expected+""+""+checklist[i].obtained+""+""}o+=""+"";return o}function simcore_voice_canSpeak(){if(typeof window.speechSynthesis=="undefined"){return false}if(false===get_cfg("use_voice")){return false}return true}function simcore_voice_speak(msg){var ssu=null;if(simcore_voice_canSpeak()){ssu=new SpeechSynthesisUtterance(msg);ssu.lang="es-ES";if("en"==get_cfg("ws_idiom"))ssu.lang="en-US";if("es"==get_cfg("ws_idiom"))ssu.lang="es-EN";window.speechSynthesis.speak(ssu)}}function simcore_voice_stopSpeak(){if(simcore_voice_canSpeak()){window.speechSynthesis.cancel()}}var simcore_rest={};function simcore_rest_reset(){simcore_rest={}}function simcore_rest_add(name,description){simcore_rest[name]={endpoint:description.endpoint,user:description.user,pass:description.pass,last_request:null}}function simcore_rest_list(){return simcore_rest}function simcore_rest_get(name){return simcore_rest[name]}function simcore_rest_call(name,method,uri,data){var rest_info=simcore_rest[name];if(typeof rest_info==="undefined"){return false}var api_endpoint=rest_info.endpoint;if(typeof api_endpoint=="function"){api_endpoint=api_endpoint()}if(api_endpoint.trim()===""){return false}var basic_auth="Basic "+btoa(rest_info.user+":"+rest_info.pass);var enc_data=JSON.stringify(data);var request={url:api_endpoint+uri,type:method,contentType:"application/json",accepts:"application/json",cache:false,dataType:"json",data:enc_data,beforeSend:function(xhr){if(rest_info.user.trim()!==""){xhr.setRequestHeader("Authorization",basic_auth)}},error:function(jqXHR){console.log("ajax error "+jqXHR.status)}};rest_info.last_request=$.ajax(request);return true}var simcore_notifications=[];function simcore_notifications_get(){return simcore_notifications}function simcore_notifications_reset(){simcore_notifications=[]}function simcore_notifications_add2(ntf){simcore_notifications.push({title:ntf.title,message:ntf.message,type:ntf.type,date:ntf.date})}function simcore_notifications_add(ntf_title,ntf_message,ntf_type,ntf_delay){simcore_notifications.push({title:$("

").html(ntf_title).text(),message:$("

").html(ntf_message).text(),type:ntf_type,date:(new Date).getTime()})}function get_value(sim_obj){if(typeof sim_obj.value=="function"){return sim_obj.value()}return sim_obj.value}function set_value(sim_obj,value){if(typeof sim_obj.value=="function"){if(sim_obj.value()!=value)sim_obj.changed=true;sim_obj.value(value)}else{if(sim_obj.value!=value)sim_obj.changed=true;sim_obj.value=value}}function reset_value(sim_obj){if(typeof sim_obj.value=="function"){if(sim_obj.value()!=sim_obj.default_value)sim_obj.changed=true;set_value(sim_obj,sim_obj.default_value)}else if(typeof sim_obj.default_value=="object"){sim_obj.changed=true;sim_obj.value=Object.create(sim_obj.default_value)}else if(sim_obj instanceof Array){sim_obj.changed=true;for(var i=0;i1;melto.breakpoint=melto.breakpoint||comments_str.trim().split("break:").length>1;melto.notify=comments_str.trim().split("notify:");for(var k=0;k1;melto.breakpoint=melto.breakpoint||comments_str.trim().split("break:").length>1;melto.notify=comments_str.trim().split("notify:");for(var k=0;k>8;if(2==filter_elto)dbvalue=(value&16711680)>>16;if(3==filter_elto)dbvalue=(value&4278190080)>>24;break;case 1:if(0==filter_elto)dbvalue=value&65535;if(1==filter_elto)dbvalue=value&65535;if(2==filter_elto)dbvalue=(value&4294901760)>>16;if(3==filter_elto)dbvalue=(value&4294901760)>>16;break;case 2:if(0==filter_elto)dbvalue=value&16777215;if(1==filter_elto)dbvalue=value&4294967040;break;case 3:dbvalue=value;break}return dbvalue}function main_memory_updatevalues(value,dbvalue,filter_size,filter_elto){switch(filter_size){case 0:if(0==filter_elto)value=value&4294967040|dbvalue&255;if(1==filter_elto)value=value&4294902015|(dbvalue&255)<<8;if(2==filter_elto)value=value&4278255615|(dbvalue&255)<<16;if(3==filter_elto)value=value&16777215|(dbvalue&255)<<24;break;case 1:if(0==filter_elto)value=value&4294901760|dbvalue&65535;if(1==filter_elto)value=value&4294901760|dbvalue&65535;if(2==filter_elto)value=value&65535|(dbvalue&65535)<<16;if(3==filter_elto)value=value&65535|(dbvalue&65535)<<16;break;case 2:if(0==filter_elto)value=value&4278190080|dbvalue&16777215;if(1==filter_elto)value=value&255|dbvalue&4294967040;break;case 3:value=dbvalue;break}return value}function main_memory_get_program_counter(){var r_ref=simhw_sim_ctrlStates_get().pc;var r_value=null;if(typeof r_ref!=="undefined"){r_ref=simhw_sim_state(r_ref.state)}if(typeof r_ref!=="undefined"){r_value=get_value(r_ref)}return r_value}function main_memory_get_baseaddr(){var r_ref=simhw_sim_ctrlStates_get();if(typeof r_ref==="undefined"){return null}var parts=null;var r_value=0;var r_ref2=null;var all_baseaddr={};for(var elto in r_ref){if(r_ref[elto].is_pointer==false){continue}parts=r_ref[elto].state.split(".");if(parts[0]=="BR"){r_value=4294967292;r_ref2=simhw_sim_states().BR[parts[1]]}else{r_value=0;r_ref2=simhw_sim_state(r_ref[elto].state)}if(typeof r_ref2!=="undefined"){r_value=get_value(r_ref2)}all_baseaddr[elto]=r_value}return all_baseaddr} \ No newline at end of file diff --git a/ws_dist/min.wepsim_core.js b/ws_dist/min.wepsim_core.js index 1124398f8..826060e5f 100644 --- a/ws_dist/min.wepsim_core.js +++ b/ws_dist/min.wepsim_core.js @@ -1 +1 @@ -function wepsim_file_saveTo(textToWrite,fileNameToSaveAs){window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem;if(typeof window.requestFileSystem==="undefined"){return false}var koHandler=function(error){wepsim_notify_error("ERROR: failed file write","Failed file write. "+"Error found "+error.toString())};var okHandler=function(msg){wepsim_notify_success("INFO","Successful file write request: "+fileNameToSaveAs)};var onWriteFile=function(fileWriter){var textFileAsBlob=new Blob([textToWrite],{type:"text/plain"});fileWriter.onerror=koHandler;fileWriter.onwriteend=okHandler;fileWriter.write(textFileAsBlob)};var onCreatFile=function(fileEntry){fileEntry.createWriter(onWriteFile)};var onInitFs=function(fs){fs.root.getFile(fileNameToSaveAs,{create:true,exclusive:false},onCreatFile,koHandler)};var grandedBytes=2*1024*1024;var onQuotaFs=function(grantedBytes){window.requestFileSystem(PERSISTENT,grandedBytes,onInitFs,koHandler)};navigator.webkitPersistentStorage.requestQuota(grandedBytes,onQuotaFs,koHandler);return true}function wepsim_file_loadFrom(fileToLoad,functionOnLoad){var fileReader=new FileReader;if(fileReader===null){return false}fileReader.onload=function(fileLoadedEvent){var textFromFileLoaded=fileLoadedEvent.target.result;if(null!==functionOnLoad){functionOnLoad(textFromFileLoaded)}};fileReader.onerror=function(e){wepsim_notify_error("ERROR","File could not be read. "+"Error code "+e.target.error.code)};fileReader.readAsText(fileToLoad,"UTF-8");return true}function wepsim_file_downloadTo(textToWrite,fileNameToSaveAs){var windowURL=window.webkitURL||window.URL;var textFileAsBlob=new Blob([textToWrite],{type:"text/plain"});var downloadLink=document.createElement("a");downloadLink.innerHTML="Download File";downloadLink.style.display="none";downloadLink.download=fileNameToSaveAs;downloadLink.href=windowURL.createObjectURL(textFileAsBlob);downloadLink.onclick=function(event){document.body.removeChild(event.target)};document.body.appendChild(downloadLink);downloadLink.click();wepsim_notify_success("INFO","Successful opportunity for downloading: "+fileNameToSaveAs)}function getURLTimeStamp(){var dateObj=new Date;var year=dateObj.getUTCFullYear();var month=dateObj.getUTCMonth()+1;var day=dateObj.getUTCDate();var hour=dateObj.getUTCHours();var minutes=dateObj.getUTCMinutes();return year+month+day+hour+minutes}function fetchURL(f_url){if(navigator.onLine){return fetch(f_url+"?time="+getURLTimeStamp())}return caches.match(f_url)}function wepsim_save_to_file(textToWrite,fileNameToSaveAs){var ret=false;if(is_cordova())ret=wepsim_file_saveTo(textToWrite,fileNameToSaveAs);else ret=wepsim_file_downloadTo(textToWrite,fileNameToSaveAs);return ret}function wepsim_load_from_url(url,do_next){if(false===is_mobile()){fetchURL(url).then((function(response){if(typeof response=="undefined"){wepsim_notify_error("ERROR","File "+url+" could not be fetched:
\n"+" * Please check that you are on-line.");return}if(response.ok){response.text().then((function(text){do_next(text)}))}}))}else{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&(xmlhttp.status==200||xmlhttp.status==0)){var textFromFileLoaded=xmlhttp.responseText;if(null!==do_next)do_next(textFromFileLoaded)}};xmlhttp.open("GET",url,true);xmlhttp.send()}}function wepsim_url_getJSON(url_json){var jstr={};var jobj=[];try{jstr=$.getJSON({url:url_json,async:false});jobj=JSON.parse(jstr.responseText)}catch(e){ws_alert("Unable to load '"+url_json+"': "+e+".\n");jobj=[]}return jobj}function wepsim_url_json(json_url,do_after){var xhr=new XMLHttpRequest;xhr.open("HEAD",json_url,true);xhr.onreadystatechange=function(){if(this.readyState==this.DONE){var size=0;var content_length=xhr.getResponseHeader("Content-Length");if(content_length!==null){size=parseInt(content_length)}var max_json_size=get_cfg("max_json_size");if(sizeINFO","Copied "+msg+"!.")}function wepsim_clipboard_CopyFromTextarea(element_name){var msg="successful";try{var copyTextarea=document.getElementById(element_name);copyTextarea.select();document.execCommand("copy");clipboard_copy=$("#"+element_name).val()}catch(err){msg="unsuccessful"}wepsim_notify_success("INFO","Copied "+msg+"!.")}var ws_preload_tasks=[{name:"mode",action:function(hash){var ws_mode=get_cfg("ws_mode");if(hash.mode!==ws_mode)wsweb_select_main(hash.mode);return"

  • Mode set to "+hash.mode+".
  • "}},{name:"config_set",action:function(hash){cfgset_load(hash.config_set);wepsim_uicfg_restore();return"
  • Configuration set titled "+hash.config_set+" loaded.
  • "}},{name:"examples_set",action:function(hash){var url_examples_set=get_cfg("example_url");var ret=wepsim_example_loadSet(url_examples_set);wepsim_example_reset();wepsim_example_load(hash.examples_set);var result_txt=" has been loaded";if(null==ret){result_txt=" could not be loaded"}return"
  • Examples set titled "+hash.examples_set+""+result_txt+".
  • "}},{name:"example",action:function(hash){var example_obj=null;var example_index=parseInt(hash.example);if(isNaN(example_index)==false){example_obj=ws_examples[example_index]}else{for(var i=0;iExample titled "+example_obj.title+" has been loaded. "}},{name:"simulator",action:function(hash){var panels=hash.simulator.split(":");if(typeof panels[0]!=="undefined"){if(panels[0]==="microcode"){wsweb_change_show_processor()}if(panels[0]==="assembly"){wsweb_change_show_asmdbg()}}if(typeof panels[1]!=="undefined"){wsweb_set_details(panels[1].toUpperCase())}if(typeof panels[2]!=="undefined"){wsweb_do_action(panels[2].toLowerCase())}return"
  • User interface has been adapted.
  • "}},{name:"checkpoint",action:function(hash){uri_obj=new URL(hash.checkpoint);wepsim_checkpoint_loadURI(uri_obj)}},{name:"notify",action:function(hash){return""}},{name:"preload",action:function(hash){return""}}];function wepsim_preload_fromHash(hash){var key="";var act=function(){};var o="";for(var i=0;iState: restored into the state history.";wsweb_select_main(checkpointObj.mode);inputfirm.setValue(checkpointObj.firmware);inputasm.setValue(checkpointObj.assembly);o+="
  • Firmware and Assembly: Loaded";u="";if(checkpointObj.firmware.trim()!==""){wepsim_compile_firmware(checkpointObj.firmware);u+="Firmware"}if(checkpointObj.assembly.trim()!==""){wepsim_compile_assembly(checkpointObj.assembly);u+=" + Assembly"}if(u!==""){o+=" + Compiled"}o+=".
  • ";simcore_record_set(checkpointObj.record);if(o!==""){o="WepSIM has been instructed to restore a checkpoint:
    "+"
      "+o+"
    "+"To close this notification please press in the "+'X mark.
    '}if(checkpointObj.notify===true){wepsim_notify_do_notify("Restored Checkpoint",o,"info",get_cfg("NOTIF_delay"))}return o}function wepsim_checkpoint_Obj2NB(elements){var val="";var typ="";var cells=[];for(var key in elements){val=elements[key];typ=typeof val;if(typ!=="string"){val=JSON.stringify(val,null,2)}cells.push({cell_type:"markdown",source:"## "+key,metadata:{}});cells.push({cell_type:"code",source:val,outputs:[],execution_count:1,metadata:{name:key,type:typ,collapsed:false,deletable:false,editable:false}})}var nbObj={metadata:{kernelspec:{name:"node_nteract",language:"javascript",display_name:"Node.js (nteract)"},kernel_info:{name:"node_nteract"},language_info:{name:"javascript",version:"8.2.1",mimetype:"application/javascript",file_extension:".js"},title:"WepSIM ",nteract:{version:"nteract-on-jupyter@2.0.0"}},nbformat:4,nbformat_minor:0,cells:cells};return nbObj}function wepsim_checkpoint_NB2Obj(nbObj){var elements={};if(typeof nbObj.cells==="undefined")return elements;if(typeof nbObj.cells.length==="undefined")return elements;var key="";var type="";var value="";for(var i=0;i'+' '+obj_wsbackup[i].tag+""}o+="";$("#"+id_listdiv+"").html(o);return true}function wepsim_checkpoint_loadFromCache(id_backupname){var ret={error:true,msg:""};var browserCacheElto=$("input[name="+id_backupname+"]:checked");if(typeof browserCacheElto[0]==="undefined"){ret.msg="Invalid arguments";return ret}var id_backupcache=browserCacheElto[0].id;var obj_wsbackup=wepsim_checkpoint_backup_load();obj_wsbackup=obj_wsbackup.reverse();var current_checkpoint=obj_wsbackup[id_backupcache];if(typeof current_checkpoint==="undefined"){ret.msg="Backup id is not valid";return ret}var obj_fileToLoad={name:""};wepsim_checkpoint_loadFromObj(current_checkpoint,obj_fileToLoad);ret.error=false;ret.msg="Processing load request...";return ret}function wepsim_checkpoint_addCurrentToCache(){var obj_wsbackup=wepsim_checkpoint_backup_load();var current_date=Date().toString();var current_checkpoint=wepsim_checkpoint_get(current_date);if(current_checkpoint.firmware.trim()!==""&¤t_checkpoint.assembly.trim()!==""){obj_wsbackup.push(current_checkpoint)}wepsim_checkpoint_backup_save(obj_wsbackup);return true}function wepsim_checkpoint_clearCache(){var obj_wsbackup=[];wepsim_checkpoint_backup_save(obj_wsbackup);return true}function wepsim_update_signal_dialog_title(key){var b_btns=key+": "+"'+"';return wepsim_config_dialog_dropdown("success",b_btns,"var shval = $('#ask_shard').val(); "+"var shkey = $('#ask_skey').val(); "+"update_signal_loadhelp('#help2', shval, shkey);\"")}function wepsim_update_signal_dialog_body(key,signal_obj){var checkvalue=signal_obj.value>>>0;var str_bolded="";var str_checked="";var input_help="";var behav_raw="";var behav_str="";var n=0;var nvalues=Math.pow(2,signal_obj.nbits);if(signal_obj.behavior.length==nvalues){input_help='
      ';for(var k=0;kdefault value'}behav_raw=signal_obj.behavior[k];behav_str=compute_signal_verbals(key,k);if(""==behav_str.trim()){behav_str="<without main effect>"}n=k.toString(10);input_help+='
    1. '+'"+"
    2. "}input_help+="
    "}else{input_help+='
      '+"
      \n"+"
    "}var curr_hw=simhw_short_name();if(""==curr_hw){curr_hw="ep"}return'"}function wepsim_update_signal_dialog(key){var signal_obj=simhw_sim_signal(key);if(typeof signal_obj==="undefined"){return null}var dlg_obj={id:"dlg_updatesignal",title:function(){return wepsim_update_signal_dialog_title(key)},body:function(){return wepsim_update_signal_dialog_body(key,signal_obj)},value:signal_obj.value,buttons:{success:{label:' '+'Save',className:"btn-info btn-sm col col-md-3 float-right",callback:function(){key=$("#ask_skey").val();user_input=$("input[name='ask_svalue']:checked").val();if(typeof user_input=="undefined"){user_input=$("input[name='ask_svalue']").val()}wepsim_update_signal_with_value(key,user_input);wsweb_dialogbox_close_updatesignal()}},close:{label:''+'Close',className:"btn-primary btn-sm col col-md-3 float-right",callback:function(){wsweb_dialogbox_close_updatesignal()}}},onshow:function(){if(typeof $(".dial").knob!=="undefined"){var nvalues=Math.pow(2,signal_obj.nbits);$(".dial").knob({min:0,max:nvalues-1}).val(signal_obj.value).trigger("change")}var bb=$("#dlg_updatesignal");bb.find(".modal-title").addClass("mx-auto");bb.find(".bootbox-close-button").addClass("mx-1");bb.modal("handleUpdate");wsweb_scroll_record("#scroller-signal");simcore_record_captureInit()},size:"large"};return wsweb_dlg_open(dlg_obj)}function wepsim_update_signal_quick(key){var signal_obj=simhw_sim_signal(key);if(typeof signal_obj==="undefined"){return}var nvalues=Math.pow(2,simhw_sim_signal(key).nbits);var user_input=simhw_sim_signal(key).value;user_input=(user_input+1)%nvalues;wepsim_update_signal_with_value(key,user_input)}function wepsim_update_signal_with_value(key,value){simhw_sim_signal(key).value=value;propage_signal_update(key);simcore_record_append_new("Update signal "+key+" with value "+value,'wepsim_update_signal_with_value("'+key+'", '+value+");\n")}function show_visgraph(jit_fire_dep,jit_fire_order){var sig={};var tmp_hash={};var tmp_nodes=[];var tmp_id=0;for(sig in simhw_sim_signals()){tmp_hash[sig]=tmp_id;tmp_nodes.push({id:tmp_id,label:sig,title:sig});tmp_id++}for(var i=0;iµadd "+reg_maddr}}var state_history=[];function wepsim_state_history_get(){return state_history}function wepsim_state_history_reset(){$("[data-toggle=popover4]").popover("hide");state_history=[]}function wepsim_state_history_add(){var ret=wepsim_state_get_clk();var state_obj=simcore_simstate_current2state();ret.content=simcore_simstate_state2checklist(state_obj,"");state_history.push(ret)}function wepsim_state_results_empty(){var empty_results=''+"<Empty (only modified values are shown)>"+"";$("#check_results1").html(empty_results);$("#s_clip").html("clipboard");$("#s_ref").html("reference")}function wepsim_state_history_empty(){var empty_history='
    '+''+'<Empty history>'+"";$("#history1").html(empty_history)}function wepsim_state_history_list(){if(0==state_history.length){wepsim_state_history_empty();wepsim_state_results_empty();return}$("[data-toggle=popover4]").popover("hide");var t=0;var it="";var tt="";var vr="";var o="";for(var i=state_history.length-1;i>=0;i--){t=new Date(state_history[i].time);it=t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+"-"+t.getHours()+"-"+t.getMinutes()+"-"+t.getSeconds()+"-"+t.getMilliseconds();tt='
    '+state_history[i].title+"
    "+"was inserted at:
    "+"Date: "+t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+"
    "+"Hour: "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+"-"+t.getMilliseconds()+"
    "+'"+"
    ";vrow="";if(i!=0)vrow='
     
     
    ';o+='
    '+'
    '+' '+' '+' \t\t '+state_history[i].title_short+""+" "+" "+vrow+"
    "+'
    '+'
    '+' '+' '+' '+"
    "+tt+'
    '+'
    '+state_history[i].content+"
    "+' "+"
    "+"
    "+"
    "}$("#history1").html(o);wepsim_state_results_empty();$("[data-toggle=popover4]").popover({html:true,placement:"auto",trigger:"click",container:"body",animation:false,content:function(){var id=$(this).attr("id");return $("#popover-content-"+id).html()},sanitizeFn:function(content){return content}})}function wepsim_dialog_current_state(){var ret=wepsim_state_get_clk();$("#curr_clk_maddr").html(ret.title_short);var state_obj=simcore_simstate_current2state();var txt_checklist=simcore_simstate_state2checklist(state_obj,"");$("#end_state1").tokenfield("setTokens",txt_checklist);wepsim_notify_success("INFO","Current state loaded !");var neltos=0;var nceltos=0;var ga_str="";for(var component in state_obj){nceltos=0;for(var eltos in state_obj[component]){nceltos++}ga_str=ga_str+","+component+"="+nceltos;neltos=neltos+nceltos}ga("send","event","state","state.dump","state.dump"+".ci="+get_value(simhw_sim_state("REG_IR_DECO"))+",neltos="+neltos+ga_str)}function wepsim_dialog_check_state(obj_chklst_expected,obj_chklst_current){var obj_result=simcore_simstate_diff_results(obj_chklst_expected,obj_chklst_current);var msg="";if(0==obj_result.errors)msg=" 
    "+"Meets the specified requirements"+"
    ";else msg=simcore_simstate_checkreport2html(obj_result.result,true);$("#check_results1").html(msg);ga("send","event","state","state.check","state.check"+",ci="+get_value(simhw_sim_state("REG_IR_DECO"))+".a="+obj_result.neltos_expected+",b="+obj_result.neltos_obtained+",sd="+obj_result.errors);return true}function wepsim_dialog_check_reset(){$("#end_state1").val("");$("#end_state1").tokenfield("setTokens",[]);$("#check_results1").html("");return true}function wepsim_execute_reset(reset_cpu,reset_memory){wepsim_state_history_reset();if(true===reset_memory){var SIMWARE=get_simware();if(SIMWARE.firmware.length!==0){update_memories(SIMWARE)}}if(true===reset_cpu){simcore_reset()}}function wepsim_execute_instruction(){var ret=simcore_check_if_can_execute();if(false===ret.ok){wsweb_dlg_alert(ret.msg);return false}var options={verbosity:0,cycles_limit:get_cfg("DBG_limitick")};ret=simcore_execute_microprogram(options);if(false===ret.ok){wepsim_show_stopbyevent("Info",ret.msg);return false}return true}function wepsim_execute_microinstruction(){var ret=simcore_check_if_can_execute();if(false===ret.ok){wsweb_dlg_alert(ret.msg);return false}ret=simcore_execute_microinstruction();if(false===ret.ok){wepsim_show_stopbyevent("Info",ret.msg);return false}return true}function wepsim_execute_set_breakpoint(hexaddr,is_set){var SIMWARE=get_simware();var curr_mp=simhw_internalState("MP");var curr_addr=parseInt(hexaddr,16);if(typeof curr_mp[curr_addr]!=="undefined"){curr_mp[curr_addr].breakpoint=is_set}if(typeof SIMWARE.mp[hexaddr]!=="undefined"){SIMWARE.mp[hexaddr].breakpoint=is_set}return true}function wepsim_execute_toggle_breakpoint(hexaddr){var SIMWARE=get_simware();var curr_mp=simhw_internalState("MP");var curr_addr=parseInt(hexaddr,16);var is_set=false;if(typeof curr_mp[curr_addr]!=="undefined"){is_set=curr_mp[curr_addr].breakpoint;curr_mp[curr_addr].breakpoint=!is_set}if(typeof SIMWARE.mp[hexaddr]!=="undefined"){is_set=SIMWARE.mp[hexaddr].breakpoint;SIMWARE.mp[hexaddr].breakpoint=!is_set}return is_set}function wepsim_execute_toggle_microbreakpoint(hexaddr){var curr_mc=simhw_internalState("MC");var curr_addr=parseInt(hexaddr,16);var is_set=false;if(typeof curr_mc[curr_addr]!=="undefined"){is_set=curr_mc[curr_addr].breakpoint;curr_mc[curr_addr].breakpoint=!is_set}return is_set}var DBG_stop=true;var DBG_limit_instruction=0;function wepsim_execute_stop(){DBG_stop=true;DBG_limit_instruction=0;webui_button_set_stop("exebar1");var o="CLK-"+Math.trunc(get_value(simhw_sim_state("CLK")))+"+"+"DECO_INS-"+Math.trunc(get_value(simhw_sim_state("DECO_INS")))+"+"+"ACC_TIME-"+Math.trunc(get_value(simhw_sim_state("ACC_TIME")));ga("send","event","execution","execution."+"cpu","execution."+"cpu"+"."+o);return true}function wepsim_execute_play(wepsim_execute_stop){var ret=simcore_check_if_can_execute();if(false===ret.ok){wsweb_dlg_alert(ret.msg);return false}DBG_stop=false;DBG_limit_instruction=0;webui_button_set_start("exebar1");wepsim_execute_chainplay(wepsim_execute_stop);return true}function wepsim_execute_toggle_play(wepsim_execute_stop){if(DBG_stop===false){DBG_stop=true}else{wepsim_execute_play(wepsim_execute_stop)}return DBG_stop}function wepsim_check_stopbybreakpoint(dash_memaddr){if(typeof dash_memaddr==="undefined"){return false}return dash_memaddr.breakpoint}function wepsim_show_stopbyevent(msg1,msg2){var dlg_obj={id:"current_state2",title:function(){var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var reg_maddr=get_value(simhw_sim_state(maddr_name));var curr_maddr="0x"+reg_maddr.toString(16);var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=get_value(simhw_sim_state(pc_name));var curr_addr="0x"+reg_pc.toString(16);var dialog_title=msg1+" @ pc="+curr_addr+"+mpc="+curr_maddr;return''+dialog_title+""},body:function(){return'
    '+'
    '+'
    '+'\t
    '+'\t '+"\t
    "+'\t
    '+'\t
    '+msg2+"
    "+"\t
    "+"
    "+"
    "+"
    "},buttons:{states:{label:"States",className:"btn btn-secondary col float-left shadow-none mr-auto",callback:function(){wsweb_dlg_close(dlg_obj);wsweb_dialog_open("state");return true}},close:{label:"Close",className:"btn-primary col float-right shadow-none"}},size:"",onshow:function(){}};wsweb_dlg_open(dlg_obj);return true}function wepsim_check_memdashboard(ref_mdash,notif_origin){if(typeof ref_mdash==="undefined"){return true}if(ref_mdash.state){wepsim_state_history_add();wepsim_state_history_list()}var notifications=ref_mdash.notify.length;if(notifications>1){var dialog_title="Notify @ 0x"+parseInt(notif_origin).toString(16)+": "+ref_mdash.notify[1];var dialog_msg='
    ';for(var k=1;k"}dialog_msg+="
    ";bootbox.confirm({title:dialog_title,message:dialog_msg,buttons:{cancel:{label:"Stop",className:"btn-danger btn-sm"},confirm:{label:"Continue",className:"btn-primary btn-sm"}},callback:function(result){if(result)setTimeout(wepsim_execute_chainplay,get_cfg("DBG_delay"),wepsim_execute_stop);else wepsim_execute_stop()}});return false}return true}function pack_ret2(p_ok,p_level,p_msg){var ret2={ok:p_ok,msg_level:p_level,msg:p_msg};return ret2}function wepsim_execute_chunk(options,chunk){var ret=false;var ret2={};var curr_mp=simhw_internalState("MP");var curr_firm=simhw_internalState("FIRMWARE");var pc_name=simhw_sim_ctrlStates_get().pc.state;var ref_pc=simhw_sim_state(pc_name);var reg_pc=get_value(ref_pc);var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var ref_maddr=simhw_sim_state(maddr_name);var reg_maddr=get_value(ref_maddr);var ref_mdash=null;var i_clks=0;var i=0;while(i0&&i_clks>=options.cycles_limit){return pack_ret2(false,"Info","WARNING: clock cycles limit reached in a single instruction.")}reg_maddr=get_value(ref_maddr);reg_pc=get_value(ref_pc);ref_mdash=simhw_internalState_get("MC",reg_maddr);ret=wepsim_check_memdashboard(ref_mdash,reg_maddr);if(false===ret){return pack_ret2(false,"","")}ret=wepsim_check_stopbybreakpoint(ref_mdash);if(true===ret){return pack_ret2(false,"Breakpoint","INFO: Microinstruction is going to be issue.")}if(0==reg_maddr&&false==ref_mdash.is_native||0!=reg_maddr&&true==ref_mdash.is_native){ref_mdash=simhw_internalState_get("MP",reg_pc);ret=wepsim_check_memdashboard(ref_mdash,reg_pc);if(false===ret){return pack_ret2(false,"","")}ret=wepsim_check_stopbybreakpoint(ref_mdash);if(true===ret){return pack_ret2(false,"Breakpoint","INFO: Instruction is going to be fetched.")}i++;i_clks=0}}return pack_ret2(true,"","INFO: number of instruction executed: "+i+" (limited to "+options.instruction_limit+")")}function wepsim_execute_chunk_atlevel(chunk,wepsim_execute_stop){var options={};var ret=false;var playlevel=get_cfg("DBG_level");if(playlevel!=="instruction"){options={verbosity:0,cycles_limit:get_cfg("DBG_limitick")};ret=wepsim_execute_chunk(options,chunk);if(ret.ok==false&&ret.msg_level.trim()!=""){wepsim_show_stopbyevent(ret.msg_level,ret.msg)}return ret.ok}var curr_firm=simhw_internalState("FIRMWARE");var pc_name=simhw_sim_ctrlStates_get().pc.state;var ref_pc=simhw_sim_state(pc_name);var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var ref_maddr=simhw_sim_state(maddr_name);var ref_mdash=0;options={verbosity:0,cycles_limit:get_cfg("DBG_limitick")};ret=false;var reg_pc=0;for(var i=0;iget_cfg("DBG_limitins")){wepsim_show_stopbyevent("Limit","Number of executed instructions limit reached.
    "+"
    "+"See related configuration options about limits:
    "+"");wepsim_execute_stop();return}setTimeout(wepsim_execute_chainplay,get_cfg("DBG_delay"),wepsim_execute_stop)}function wepsim_notify_show_notify(ntf_title,ntf_message,ntf_type,ntf_delay){var ac=$("#alerts-container");if(ac.length===0){ac=$('
    ');$("body").append(ac)}var btn1=$('
    ";return o}function wepsim_show_breakpoint_icon_list(){var o="
    "+"
    ";var prev_type="";for(var elto in breakpoint_icon_list){if(breakpoint_icon_list[elto].type!=prev_type){o=o+"
    "+"
    "+"
    "+breakpoint_icon_list[elto].type+"
    "+"
    "+"
    ";prev_type=breakpoint_icon_list[elto].type}o=o+""+elto+" icon'}o=o+"
    "+"
    ";return o}function wepsim_show_breakpoint_icon_template(){var o='";return o}function wepsim_config_dialog_title(name,color,str_onchange){return""}function wepsim_config_dialog_dropdown(color,base_buttons,str_onchange){return""}var ws_config=[];ws_config.push({id:"select7",type:"General",u_class:"",code_cfg:"
    "+i18n_get_selectcfg()+"
    ",code_init:function(){$("#select7").val(get_cfg("ws_idiom"))},description:"Idiom for help, examples, etc."});ws_config.push({id:"slider3",type:"General",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label8-"+get_cfg("NOTIF_delay")).button("toggle")},description:"Notification speed: time before disapear"});ws_config.push({id:"radio15",type:"General",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){var optValue=get_cfg("ws_skin_dark_mode");$("#label15-"+optValue).button("toggle");wepsim_restore_darkmode(optValue)},description:"Dark Mode"});ws_config.push({id:"radio12",type:"Execution",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label12-"+get_cfg("DBG_delay")).button("toggle")},description:"Running speed: execution speed"});ws_config.push({id:"select1",type:"Execution",u_class:"",code_cfg:""+" \t\tstop icon"+"",code_init:function(){var elto=get_cfg("ICON_theme");$("#img_select1").attr("src","images/stop/stop_"+elto+".gif");$("#img_select1").attr("class",breakpoint_icon_list[elto].addclass);$("#breakpointicon1").popover({html:true,content:wepsim_show_breakpoint_icon_list,template:wepsim_show_breakpoint_icon_template(),sanitizeFn:function(content){return content}}).on("shown.bs.popover",(function(shownEvent){wepsim_uicfg_apply()}))},description:"Breakpoint icon: icon to be used for breakpoints"});ws_config.push({id:"select6",type:"Execution",u_class:"",code_cfg:"
    "+"\t "+"\t
    ",code_init:function(){$("#select6").val(get_cfg("DBG_limitins"))},description:"Limit instructions: number of instructions to be executed"});ws_config.push({id:"select3",type:"Execution",u_class:"",code_cfg:"
    "+"\t "+"\t
    ",code_init:function(){$("#select3").val(get_cfg("DBG_limitick"))},description:"Limit instruction ticks: to limit clock ticks"});ws_config.push({id:"radio7",type:"Editor",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label7-"+get_cfg("editor_theme")).button("toggle")},description:"Editor theme: light or dark"});ws_config.push({id:"select2",type:"Editor",u_class:"",code_cfg:"
    "+" "+"
    ",code_init:function(){$("#select2").val(get_cfg("editor_mode"))},description:"Editor mode: vim, emacs, etc."});ws_config.push({id:"radio2",type:"Register file",u_class:"user_archived",code_cfg:"
    "+"
    "+"\t "+"\t "+"\t "+"
    "+"
    "+"\t "+"\t "+"\t "+"
    "+"\t
    ",code_init:function(){$("#label2-"+get_cfg("RF_display_format")).button("toggle")},description:"Display format "+"\'>(example)'});ws_config.push({id:"radio3",type:"Register file",u_class:"user_archived",code_cfg:"
    "+"\t "+"\t "+"
    ",code_init:function(){$("#label3-"+get_cfg("RF_display_name")).button("toggle")},description:"Register file names"});ws_config.push({id:"radio9",type:"Register file",u_class:"user_archived",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label9-"+get_cfg("is_editable")).button("toggle")},description:"Editable registers: edit register file values"});ws_config.push({id:"colorpicker1",type:"Circuitry simulation",u_class:"user_microcode",code_cfg:"
    "+"\t "+"
    ",code_init:function(){$("#colorpicker1").spectrum({preferredFormat:"hex",color:get_cfg("color_data_active")})},description:"Data-path color (example)"});ws_config.push({id:"colorpicker2",type:"Circuitry simulation",u_class:"user_microcode",code_cfg:"
    "+"\t "+"\t
    ",code_init:function(){$("#colorpicker2").spectrum({preferredFormat:"hex",color:get_cfg("color_name_active")})},description:"Signal color"});ws_config.push({id:"radio10",type:"Circuitry simulation",u_class:"user_archived user_microcode",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label10-"+get_cfg("is_byvalue")).button("toggle")},description:"Show by value or by activation"});ws_config.push({id:"radio5",type:"Circuitry simulation",u_class:"user_microcode",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label5-"+get_cfg("is_interactive")).button("toggle")},description:"Interactive mode: signal value can be updated"});ws_config.push({id:"radio6",type:"Circuitry simulation",u_class:"user_microcode",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label6-"+get_cfg("is_quick_interactive")).button("toggle")},description:"Quick interactive mode: quick update of signal value"});ws_config.push({id:"radio11",type:"Accesibility",u_class:"user_archived",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label11-"+get_cfg("use_voice")).button("toggle")},description:"Active voice: external voice control"});ws_config.push({id:"radio13",type:"Accesibility",u_class:"user_archived",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label13-"+get_cfg("verbal_verbose")).button("toggle")},description:"Verbalization: textual or mathematical"});ws_config.push({id:"select8",type:"Accesibility",u_class:"",code_cfg:"
    "+" "+"
    ",code_init:function(){$("#select8").val(get_cfg("ws_skin_ui"))},description:"WepSIM User Interface skin"});ws_config.push({id:"radio14",type:"Accesibility",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){var optValue=get_cfg("ws_skin_user");$("#label14-"+optValue.replace(/:/g,"__")).button("toggle")},description:"Beginner view"});ws_config.push({id:"radio16",type:"Accesibility",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){var optValue=get_cfg("AS_enable");$("#label16-"+optValue).button("toggle")},description:"Auto-scroll while executing"});var ws_examples=[];var ws_examples_set=[{name:"Empty",url:"",url_base_asm:"",url_base_mc:""}];var ws_examples_active=-1;function wepsim_example_reset(){ws_examples=[];ws_examples_active=-1;webui_toolbar_updateExampleSet()}function wepsim_example_load(e_name){var jobj=null;for(var i=0;i0)sample_hw=sid[0];else console.log("warning: example without hardware id");var sample_mc="";if(sid.length>1)sample_mc=sid[1];else console.log("warning: example without microcode id");var sample_asm="";if(sid.length>2)sample_asm=sid[2];else console.log("warning: example without assembly id");var url=ws_examples_set[ws_examples_active].url_base_asm+"asm-"+sample_asm+".txt";var do_next=function(mcode){inputasm.setValue(mcode);inputasm.refresh();var ok=false;var SIMWARE=get_simware();if(SIMWARE.firmware.length!==0){ok=wepsim_compile_assembly(mcode);inputasm.is_compiled=ok}if(false===ok){wsweb_change_workspace_assembly();return}if(true===chain_next_step){setTimeout((function(){wsweb_change_workspace_simulator()}),50)}setTimeout((function(){show_memories_values()}),500);wepsim_notify_success("INFO","Example ready to be used.")};wepsim_load_from_url(url,do_next);simcore_record_append_new("Load assembly from example "+example_id,'load_from_example_assembly("'+example_id+'", '+chain_next_step+");\n");ga("send","event","example","example.assembly","example.assembly."+sample_hw+"."+sample_asm)}function load_from_example_firmware(example_id,chain_next_step){if(-1==ws_examples_active){ws_alert("warning: no active example set");return}inputfirm.setValue("Please wait...");inputfirm.refresh();var sid=example_id.split(":");var sample_hw="";if(sid.length>0)sample_hw=sid[0];else console.log("warning: example without hardware id");var sample_mc="";if(sid.length>1)sample_mc=sid[1];else console.log("warning: example without microcode id");var sample_asm="";if(sid.length>2)sample_asm=sid[2];else console.log("warning: example without assembly id");var url=ws_examples_set[ws_examples_active].url_base_mc+"mc-"+sample_mc+".txt";inputfirm.setOption("readOnly",false);var do_next=function(mcode){inputfirm.setValue(mcode);inputfirm.refresh();var ok=wepsim_compile_firmware(mcode);inputfirm.is_compiled=ok;if(false===ok){wsweb_change_workspace_microcode();return}if(true===chain_next_step){setTimeout((function(){load_from_example_assembly(example_id,chain_next_step)}),50)}else{setTimeout((function(){show_memories_values();asmdbg_update_assembly()}),50);wepsim_notify_success("INFO","Example ready to be used.")}};wepsim_load_from_url(url,do_next);simcore_record_append_new("Load firmware from example "+example_id,'load_from_example_firmware("'+example_id+'", false);\n');ga("send","event","example","example.firmware","example.firmware."+sample_hw+"."+sample_mc)}function share_example(m,base_url){var e_description=ws_examples[m].description;e_description=e_description.replace(/<[^>]+>/g,"");var e_id=ws_examples[m].id;var e_hw=ws_examples[m].hardware;var share_title="WepSIM example "+e_id+"...";var share_text="This is a link to the WepSIM example "+e_id+" ("+e_description+"):\n";var share_url=""+base_url+"?mode="+e_hw+"&examples_set="+ws_examples_set[ws_examples_active].name+"&example="+m;return share_information("example_"+m,share_title,share_text,share_url)}function table_examples_html(examples){var ahw="ep";var ep_modes=wepsim_mode_getAvailableModes();var mode=get_cfg("ws_mode");if(mode!=="null"&&!ep_modes.includes(mode)){ahw=mode}var base_url=get_cfg("base_url");var fmt_toggle="";var w100_toggle="";var toggle_cls="";var t_hwmcasm="";var t_index="";var e_title="";var e_type="";var e_level="";var e_hw="";var e_mc="";var e_asm="";var e_description="";var e_id="";var u="";var examples_groupby_type={};for(var m=0;m'+' '+t_index+""+""+'
    '+' '+e_title+""+''+base_url+"?mode="+mode+"&examples_set="+ws_examples_set[ws_examples_active].name+"&example="+m+""+'
    '+' "+' "+"
    "+"
    "+'
    '+" "+e_description+""+"
    "+'
    ';if(typeof examples_groupby_type[e_type]==="undefined"){examples_groupby_type[e_type]=[]}examples_groupby_type[e_type].push({row:u,level:e_level})}var o="";u="";var l="";for(m in examples_groupby_type){u='
    ';l=examples_groupby_type[m][0].level;for(var n=0;n";o=o+"
    "+ahw.toUpperCase()+": "+m+"
    "+u}if(o.trim()===""){o='<No examples are available for the selected hardware>'}o='
    '+o+"
    ";return o}function table_helps_html(helps){var o="";var fmt_toggle="";var w100_toggle="";var toggle_cls="";var fmt_header="";var e_title="";var e_itype="";var e_utype="";var e_reference="";var e_description="";var e_id="";var t_index="";var utypes=[];for(var m=0;m'+'
    ';for(m=0;m"+helps[m].u_type+"
    "}e_title=helps[m].title;e_itype=helps[m].i_type;e_utype=helps[m].u_type;e_uclass=helps[m].u_class;e_reference=helps[m].reference;e_description=helps[m].description;e_id=helps[m].id;var onclick_code="";if("relative"===e_itype)onclick_code="wepsim_help_set_relative('"+e_reference+"');"+"wepsim_help_refresh();";if("absolute"===e_itype)onclick_code="wepsim_help_set_absolute('"+e_reference+"');"+"wepsim_help_refresh();";if("code"===e_itype)onclick_code=e_reference;if(fmt_toggle==="")fmt_toggle="bg-light";else fmt_toggle="";if(m%2==0)w100_toggle="collapse7 show";else w100_toggle="";toggle_cls=fmt_toggle+" "+e_uclass+" "+e_utype;t_index=(m+1).toString().padStart(2," ").replace(/ /g," ");o=o+fmt_header+'
    '+' '+t_index+""+"
    "+'
    '+' '+e_title+""+"
    "+'
    '+" "+e_description+""+"
    "+'
    '}o=o+"
    ";return o}function wepsim_help_refresh(){simcore_record_append_new("Refresh help content","wepsim_help_refresh();\n");var helpdiv="#scroller-help1";var scrolltothetop=function(){var helpdiv_container="scroller-help1";var elto=document.getElementById(helpdiv_container);if(elto!=null)elto.scrollTop=0};var helpurl="";var seg_idiom=get_cfg("ws_idiom");var seg_hardw=simhw_active().sim_short_name;var rel=$("#help1_ref").data("relative");if(typeof rel!="undefined"&&rel!=""){var r=rel.split("#");helpurl="help/"+r[0]+"-"+seg_idiom+".html";resolve_html_url(helpdiv,helpurl,"#"+r[1],scrolltothetop);ga("send","event","help","help.simulator","help.simulator."+rel);return}var ab1=$("#help1_ref").data("absolute");if(typeof ab1!="undefined"&&ab1!=""){helpurl="examples/hardware/"+seg_hardw+"/help/"+ab1+"-"+seg_idiom+".html";resolve_html_url(helpdiv,helpurl,"",scrolltothetop);ga("send","event","help","help."+ab1,"help."+ab1+".*");return}var cod1=$("#help1_ref").data("code");if(typeof cod1!="undefined"&&cod1==="true"){ga("send","event","help","help.code","help.code.*");return}if(typeof rel!="undefined"&&rel==""){var html_index=table_helps_html(ws_help);$(helpdiv).html(html_index);ga("send","event","help","help.index","help.index");return}}function wepsim_help_set_relative(rel){$("#help1_ref").data("relative",rel);$("#help1_ref").data("absolute","");$("#help1_ref").data("code","false");simcore_record_append_new("Update help content",'wepsim_help_set_relative("'+rel+'");\n')}function wepsim_help_set_absolute(ab1){$("#help1_ref").data("relative","");$("#help1_ref").data("absolute",ab1);$("#help1_ref").data("code","false");simcore_record_append_new("Update help content",'wepsim_help_set_absolute("'+ab1+'");\n')}function wepsim_open_help_content(content){$("#scroller-help1").html(content);$("#help1_ref").data("relative","");$("#help1_ref").data("absolute","");$("#help1_ref").data("code","true")}function wepsim_open_help_hardware_summary(){var ahw2=simhw_active().sim_short_name;var img2="examples/hardware/"+ahw2+"/images/cpu.svg?time=20190102";var lyr2=""+"Your browser does not support SVG"+"";wepsim_open_help_content(lyr2);simcore_record_append_new("Open hardware summary","wepsim_open_help_hardware_summary();\n")}function request_html_url(r_url){var robj=null;if(false===is_mobile()){if(navigator.onLine)robj=fetch(r_url);else robj=caches.match(r_url).then()}else{robj=$.ajax(r_url,{type:"GET",dataType:"html"})}return robj}function update_div_frompartialhtml(helpdiv,key,data){var default_content="
    Sorry, No more details available for this element.

    \n";if(""===data)$(helpdiv).html(default_content);else $(helpdiv).html(data);if(""===data||""===key||"#"===key){return}var help_content=$(helpdiv).filter(key).html();if(typeof help_content==="undefined"){help_content=$(helpdiv).find(key).html()}if(typeof help_content==="undefined"){help_content=default_content}$(helpdiv).html(help_content)}function resolve_html_url(helpdiv,r_url,key,update_div){return request_html_url(r_url).then((function(data){if(typeof data=="object"){data.text().then((function(res){update_div_frompartialhtml(helpdiv,key,res);update_div()}))}else{update_div_frompartialhtml(helpdiv,key,data);update_div()}}))}function update_signal_loadhelp(helpdiv,simhw,key){var curr_idiom=get_cfg("ws_idiom");var help_base="examples/hardware/"+simhw+"/help/signals-"+curr_idiom+".html";resolve_html_url(helpdiv,help_base,"#"+key,(function(){$(helpdiv).trigger("create")}));ga("send","event","help","help.signal","help.signal."+simhw+"."+key)}function update_checker_loadhelp(helpdiv,key){var curr_idiom=get_cfg("ws_idiom");var help_base="help/simulator-"+curr_idiom+".html";resolve_html_url(helpdiv,help_base,"#"+key,(function(){$(helpdiv).trigger("create")}));ga("send","event","help","help.checker","help.checker."+key)}var ws_help=[];ws_help.push({id:"simulator",title:"Execute example",i_type:"code",u_type:"tutorial",u_class:"",reference:"wsweb_dialog_close('help'); "+"wsweb_recordbar_show(); "+"wepsim_checkpoint_loadExample('tutorial_2.txt') ; "+"setTimeout(wsweb_record_play, 1000);",description:"Play the execute example tutorial.
    "});ws_help.push({id:"simulator",title:"Welcome tutorial",i_type:"code",u_type:"tutorial",u_class:"",reference:"wsweb_dialog_close('help'); "+"sim_tutorial_showframe('welcome', 0);",description:"Open the welcome tutorial.
    "});ws_help.push({id:"simulator",title:"Simple usage tutorial",i_type:"code",u_type:"tutorial",u_class:"",reference:"wsweb_dialog_close('help'); "+"sim_tutorial_showframe('simpleusage', 0);",description:"Open the simple usage tutorial, for microprogramming and assembly programming.
    "});ws_help.push({id:"simulator",title:"Simulator: firmware",i_type:"relative",u_type:"simulator",u_class:"user_microcode",reference:"simulator#help_simulator_firmware",description:"How to work with the firmware to be loaded into the control memory.
    "});ws_help.push({id:"microcode",title:"Microcode format",i_type:"relative",u_type:"simulator",u_class:"user_microcode",reference:"simulator#help_firmware_format",description:"Syntax of the microcode used.
    "});ws_help.push({id:"simulator",title:"Simulator: assembly",i_type:"relative",u_type:"simulator",u_class:"",reference:"simulator#help_simulator_assembly",description:"How to work with the assembly that use the aforementioned firmware.
    "});ws_help.push({id:"assembly",title:"Assembly format",i_type:"relative",u_type:"simulator",u_class:"",reference:"simulator#help_assembly_format",description:"Syntax of the assembly elements.
    "});ws_help.push({id:"simulator",title:"Simulator: execution",i_type:"relative",u_type:"simulator",u_class:"",reference:"simulator#help_simulator_execution",description:"How the simulator can execute the assembly and firmware.
    "});ws_help.push({id:"simulator",title:"Simulator: states",i_type:"relative",u_type:"simulator",u_class:"",reference:"simulator#help_dumper",description:"How the simulator can show the current state, and the difference between two states.
    "});ws_help.push({id:"architecture",title:"Simulated architecture",i_type:"absolute",u_type:"simulated processor",u_class:"",reference:"hardware",description:"Description of the simulated processor architecture.
    "});ws_help.push({id:"architecture",title:"Simulated signals",i_type:"absolute",u_type:"simulated processor",u_class:"user_microcode",reference:"signals",description:"Main signals summary of the simulated elemental processor.
    "});ws_help.push({id:"architecture",title:"Hardware summary",i_type:"code",u_type:"simulated processor",u_class:"user_microcode",reference:"wepsim_open_help_hardware_summary();"+"simcore_record_append_new('Show hardware summary', "+" 'wepsim_open_help_hardware_summary();\\\n');",description:"Reference card for the simulated elemental processor hardware.
    "});ws_help.push({id:"about",title:"License, platforms, etc.",i_type:"relative",u_type:"info",u_class:"",reference:"about#help_about",description:"WepSIM license, supported platforms, technologies used.
    "});ws_help.push({id:"authors",title:"Authors",i_type:"code",u_type:"info",u_class:"",reference:"wsweb_dialog_close('help'); "+"wsweb_dialog_open('about');",description:"Authors of WepSIM.
    "});tutorials={};function sim_tutorial_goframe(tutorial_name,from_step,to_step){var tutorial=tutorials[tutorial_name];if(typeof tutorial==="undefined"){return}tutorial[from_step].code_post();if(typeof tutbox!=="undefined"){tutbox.modal("hide")}setTimeout((function(){sim_tutorial_showframe(tutorial_name,to_step)}),tutorial[from_step].wait_next);if(simcore_voice_canSpeak()){window.speechSynthesis.cancel()}}function sim_tutorial_cancelframe(){var ws_mode=get_cfg("ws_mode");wsweb_select_main(ws_mode);tutbox.modal("hide");if(simcore_voice_canSpeak()){window.speechSynthesis.cancel()}}function sim_tutorial_showframe(tutorial_name,step){var tutorial=tutorials[tutorial_name];if(typeof tutorials=="undefined"){return}if(step==tutorial.length){return}if(step<0){return}ga("send","event","help","help.tutorial","help.tutorial.name="+tutorial_name+",step="+step);tutorial[step].code_pre();var wsi=get_cfg("ws_idiom");var bbbt={};bbbt.cancel={label:i18n_get("gui",wsi,"Disable tutorial mode"),className:"btn-danger col float-right",callback:function(){sim_tutorial_cancelframe()}};if(step!=0)bbbt.prev={label:i18n_get("gui",wsi,"Prev."),className:"btn-success col float-right",callback:function(){sim_tutorial_goframe(tutorial_name,step,step-1)}};if(step!=tutorial.length-1)bbbt.next={label:i18n_get("gui",wsi,"Next"),className:"btn-success col float-right",callback:function(){sim_tutorial_goframe(tutorial_name,step,step+1)}};else bbbt.end={label:i18n_get("gui",wsi,"End"),className:"btn-success col float-right",callback:function(){sim_tutorial_goframe(tutorial_name,step,step+1)}};tutbox=bootbox.dialog({title:tutorial[step].title,message:tutorial[step].message,buttons:bbbt,size:"large",animate:false});simcore_voice_speak(tutorial[step].title.replace(/<[^>]*>/g,"")+". "+tutorial[step].message.replace(/<[^>]*>/g,""));i18n_update_tags("tutorial_"+tutorial_name)}tutorials.welcome=[];tutorials.welcome.push({id:"welcome",title:"title 0",message:"message 0",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 1",message:"message 1",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 2",message:"message 2",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 3",message:"message 3",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 4",message:"message 4",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 5",message:"message 5",code_pre:function(){},code_post:function(){load_from_example_firmware("ep:ep_mips_base:ep_s1_e1",true)},wait_next:100});tutorials.simpleusage=[];tutorials.simpleusage.push({id:"simpleusage",title:"title 0",message:"message 0",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 1",message:"message 1",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 2",message:"message 2",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 3",message:"message 3",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 4",message:"message 4",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 5",message:"message 5",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});var tour=null;function wepsim_newbie_tour(){var ws_idiom=get_cfg("ws_idiom");wepsim_newbie_tour_setLang(ws_idiom);if(null==tour){tour=introJs()}tour.setOptions({steps:ws_tour,keyboardNavigation:true,tooltipClass:"tooltip-large",showProgress:true,showStepNumbers:true,scrollToElement:true,nextLabel:i18n_get("gui",ws_idiom,"Next"),prevLabel:i18n_get("gui",ws_idiom,"Prev."),overlayOpacity:"0.2"});tour.onbeforechange((function(){ws_tour[this._currentStep].do_before()}));tour.onexit((function(){$("#help1").modal("hide");wsweb_dialog_close("examples");wsweb_dialog_close("config");if(get_cfg("ws_mode")!="ep"){wsweb_select_main("ep")}return true}));tour.start();ga("send","event","ui","ui.tour","ui.tour.newbie")}function wepsim_newbie_tour_setLang(lang){var step="";for(var i=0;iStep 1",step:"step1",position:"auto",do_before:function(){tour.refresh();return true}});ws_tour.push({title:"WepSIM",element:"#select4",intro:"Step 2",step:"step2",position:"auto",do_before:function(){wsweb_select_main("ep");tour.refresh();return true}});ws_tour.push({title:"WepSIM",element:"#btn_help1",intro:"Step 3",step:"step3",position:"auto",do_before:function(){tour.refresh();return true}});ws_tour.push({title:"WepSIM",element:"#btn_example1",intro:"Step 4",step:"step4",position:"auto",do_before:function(){tour.refresh();return true}});ws_tour.push({title:"WepSIM",element:"#btn_cfg1",intro:"Step 5",step:"step5",position:"auto",do_before:function(){tour.refresh();return true}});ws_tour.push({title:"WepSIM",intro:"Step 6",step:"step6",position:"auto",do_before:function(){tour.refresh();return true}});function wepsim_voice_init(){if(!annyang){return false}annyang.addCommands(wepsim_voice_commands);annyang.addCallback("errorNetwork",(function(){annyang.abort();alert("Sorry but some network connection is needed in order to use the voice recognition engine.")}));SpeechKITT.annyang();SpeechKITT.setStylesheet("external/speechkitt/themes/flat.css");SpeechKITT.setInstructionsText("What can I help you with? (list)");SpeechKITT.vroom();return true}function wepsim_voice_start(){if(!annyang){wepsim_notify_error("

    Warning:
    "+"annyang not available"+"

    ","Voice support is not available in this platform.");return false}SpeechKITT.show();return true}function wepsim_voice_stop(){if(!annyang){return false}SpeechKITT.hide();return true}var wepsim_voice_commands={};var wepsim_voice_dialog=null;wepsim_voice_commands["hello"]=function(){var msg="Hello, I am WepSIM, nice to meet you. ";simcore_voice_speak(msg)};wepsim_voice_commands["(show) configuration"]=function(){wsweb_dialog_open("config")};wepsim_voice_commands["(show) examples"]=function(){wsweb_dialog_open("examples")};wepsim_voice_commands["load example :id (from) :level"]=function(id,level){var ex_id=parseInt(id);var ex_lv=parseInt(level);load_from_example_firmware("ep:s"+ex_lv+"_e"+ex_lv,true)};wepsim_voice_commands["(show) help"]=function(){wsweb_dialog_open("help");wepsim_help_refresh()};wepsim_voice_commands["close"]=function(){wsweb_dialog_close("help");wsweb_dialog_close("config");wsweb_dialog_close("examples");if(null!==wepsim_voice_dialog){wepsim_voice_dialog.modal("hide")}};wepsim_voice_commands["reset"]=function(){wepsim_execute_reset(true,true);var msg="Current processor has been reset.";simcore_voice_speak(msg)};wepsim_voice_commands["next"]=function(){wepsim_execute_instruction();var msg="Next executed.";simcore_voice_speak(msg)};wepsim_voice_commands["next micro(instruction)"]=function(){wepsim_execute_microinstruction();var msg="Next microinstruction executed. ";simcore_voice_speak(msg)};wepsim_voice_commands["play"]=function(){wepsim_execute_play()};wepsim_voice_commands["stop"]=function(){wepsim_execute_stop()};wepsim_voice_commands["describe micro(instruction)"]=function(){var msg=get_verbal_from_current_mpc();simcore_voice_speak(msg)};wepsim_voice_commands["describe instruction"]=function(){var msg=get_verbal_from_current_pc();simcore_voice_speak(msg)};wepsim_voice_commands["list"]=function(){var vc_list="available commands:
    ";for(var vc in wepsim_voice_commands){vc_list=vc_list+" * '"+vc+"'
    "}wepsim_voice_dialog=bootbox.alert(vc_list);wepsim_voice_dialog.modal("show");var msg=$("

    ").html(vc_list).text();simcore_voice_speak(msg)};wepsim_voice_commands["silence"]=function(){simcore_voice_stopSpeak()};var breakpoint_icon_list={classic:{type:"classic",addclass:"no-dark-mode",origin:"https://www.optikunde.de/farbe/rot.php"},pushpin:{type:"classic",addclass:"no-dark-mode",origin:"http://clipart-library.com/red-push-pin.html"},cat1:{type:"pets",addclass:"no-dark-mode",origin:""},dog1:{type:"pets",addclass:"no-dark-mode",origin:""},halloween1:{type:"halloween",addclass:"no-dark-mode",origin:"https://es.vexels.com/svg-png/halloween/"},halloween2:{type:"halloween",addclass:"no-dark-mode",origin:"https://es.vexels.com/png-svg/vista-previa/153871/casa-de-halloween-de-miedo"},xmas1:{type:"christmas",addclass:"",origin:"https://week-of-icons-2018.netlify.com/data/5/animations/1.gif"},xmas2:{type:"christmas",addclass:"",origin:"https://week-of-icons-2018.netlify.com/data/5/animations/3.gif"},xmas3:{type:"christmas",addclass:"",origin:"https://peaceartsite.com/images/stained-glass-snowy-peace-t.gif"},r2d2:{type:"star wars",addclass:"",origin:"https://imgur.com/gallery/gKSmy"},sw:{type:"star wars",addclass:"",origin:"https://i2.wp.com/icons.iconarchive.com/icons/sensibleworld/starwars/1024/Death-Star-icon.png"},bb8:{type:"star wars",addclass:"no-dark-mode",origin:""},vader1:{type:"star wars",addclass:"",origin:""},ds1:{type:"star wars",addclass:"",origin:"https://media0.giphy.com/media/SVhnmDDdOzrZC/source.gif"},lotr4:{type:"lotr",addclass:"no-dark-mode",origin:"http://www.cinecollectibles.com/gentle-giant-c-1_62.html"},lotr2:{type:"lotr",addclass:"no-dark-mode",origin:"https://www.forbes.com/sites/adrianbridgwater/2016/01/15/microsoft-r-one-big-data-tool-to-rule-them-all/"},lotr6:{type:"lotr",addclass:"no-dark-mode",origin:"https://pm1.narvii.com/5903/f831ee80d012b8a8ba7156c39505cc4824889901_128.jpg"},hp1:{type:"harry potter",addclass:"no-dark-mode",origin:"http://www.logosclicks.com/logos/harry-potter-name-logo-46a93c.html"},hp2:{type:"harry potter",addclass:"no-dark-mode",origin:"https://www.flaticon.com/free-icon/harry-potter_86485"},hp3:{type:"harry potter",addclass:"no-dark-mode",origin:"https://lafrikileria.com/es/cosas-de-harry-potter-regalos/20569-funko-pop-patronus-harry-potter-889698469944.html"},super:{type:"films",addclass:"no-dark-mode",origin:"https://worldvectorlogo.com/logo/superman-3"},batman:{type:"films",addclass:"",origin:"http://getwallpapers.com/collection/black-and-white-batman-wallpaper"},grail:{type:"films",addclass:"no-dark-mode",origin:"http://3png.com/a-31243892.html"},despicable:{type:"films",addclass:"no-dark-mode",origin:"https://www.helloforos.com/t/cerrado/350821/81"},t800b:{type:"films",addclass:"no-dark-mode",origin:"https://www.pngegg.com/en/png-buhsk"},t1000a:{type:"films",addclass:"no-dark-mode",origin:"https://i0.pngocean.com/files/328/174/569/the-terminator-sticker-t-1000-telegram-world-of-tanks-suren-mnatsakanyan-street.jpg"}};function sim_core_breakpointicon_get(icon_name){var icon_obj=null;icon_obj=breakpoint_icon_list[icon_name];if(typeof icon_obj==="undefined"){icon_name="classic";icon_obj=breakpoint_icon_list[icon_name]}return"stop icon"} \ No newline at end of file +function wepsim_file_saveTo(textToWrite,fileNameToSaveAs){window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem;if(typeof window.requestFileSystem==="undefined"){return false}var koHandler=function(error){wepsim_notify_error("ERROR: failed file write","Failed file write. "+"Error found "+error.toString())};var okHandler=function(msg){wepsim_notify_success("INFO","Successful file write request: "+fileNameToSaveAs)};var onWriteFile=function(fileWriter){var textFileAsBlob=new Blob([textToWrite],{type:"text/plain"});fileWriter.onerror=koHandler;fileWriter.onwriteend=okHandler;fileWriter.write(textFileAsBlob)};var onCreatFile=function(fileEntry){fileEntry.createWriter(onWriteFile)};var onInitFs=function(fs){fs.root.getFile(fileNameToSaveAs,{create:true,exclusive:false},onCreatFile,koHandler)};var grandedBytes=2*1024*1024;var onQuotaFs=function(grantedBytes){window.requestFileSystem(PERSISTENT,grandedBytes,onInitFs,koHandler)};navigator.webkitPersistentStorage.requestQuota(grandedBytes,onQuotaFs,koHandler);return true}function wepsim_file_loadFrom(fileToLoad,functionOnLoad){var fileReader=new FileReader;if(fileReader===null){return false}fileReader.onload=function(fileLoadedEvent){var textFromFileLoaded=fileLoadedEvent.target.result;if(null!==functionOnLoad){functionOnLoad(textFromFileLoaded)}};fileReader.onerror=function(e){wepsim_notify_error("ERROR","File could not be read. "+"Error code "+e.target.error.code)};fileReader.readAsText(fileToLoad,"UTF-8");return true}function wepsim_file_downloadTo(textToWrite,fileNameToSaveAs){var windowURL=window.webkitURL||window.URL;var textFileAsBlob=new Blob([textToWrite],{type:"text/plain"});var downloadLink=document.createElement("a");downloadLink.innerHTML="Download File";downloadLink.style.display="none";downloadLink.download=fileNameToSaveAs;downloadLink.href=windowURL.createObjectURL(textFileAsBlob);downloadLink.onclick=function(event){document.body.removeChild(event.target)};document.body.appendChild(downloadLink);downloadLink.click();wepsim_notify_success("INFO","Successful opportunity for downloading: "+fileNameToSaveAs)}function getURLTimeStamp(){var dateObj=new Date;var year=dateObj.getUTCFullYear();var month=dateObj.getUTCMonth()+1;var day=dateObj.getUTCDate();var hour=dateObj.getUTCHours();var minutes=dateObj.getUTCMinutes();return year+month+day+hour+minutes}function fetchURL(f_url){if(navigator.onLine){return fetch(f_url+"?time="+getURLTimeStamp())}return caches.match(f_url)}function wepsim_save_to_file(textToWrite,fileNameToSaveAs){var ret=false;if(is_cordova())ret=wepsim_file_saveTo(textToWrite,fileNameToSaveAs);else ret=wepsim_file_downloadTo(textToWrite,fileNameToSaveAs);return ret}function wepsim_load_from_url(url,do_next){if(false===is_mobile()){fetchURL(url).then((function(response){if(typeof response=="undefined"){wepsim_notify_error("ERROR","File "+url+" could not be fetched:
    \n"+" * Please check that you are on-line.");return}if(response.ok){response.text().then((function(text){do_next(text)}))}}))}else{var xmlhttp=new XMLHttpRequest;xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&(xmlhttp.status==200||xmlhttp.status==0)){var textFromFileLoaded=xmlhttp.responseText;if(null!==do_next)do_next(textFromFileLoaded)}};xmlhttp.open("GET",url,true);xmlhttp.send()}}function wepsim_url_getJSON(url_json){var jstr={};var jobj=[];try{jstr=$.getJSON({url:url_json,async:false});jobj=JSON.parse(jstr.responseText)}catch(e){ws_alert("Unable to load '"+url_json+"': "+e+".\n");jobj=[]}return jobj}function wepsim_url_json(json_url,do_after){var xhr=new XMLHttpRequest;xhr.open("HEAD",json_url,true);xhr.onreadystatechange=function(){if(this.readyState==this.DONE){var size=0;var content_length=xhr.getResponseHeader("Content-Length");if(content_length!==null){size=parseInt(content_length)}var max_json_size=get_cfg("max_json_size");if(sizeINFO","Copied "+msg+"!.")}function wepsim_clipboard_CopyFromTextarea(element_name){var msg="successful";try{var copyTextarea=document.getElementById(element_name);copyTextarea.select();document.execCommand("copy");clipboard_copy=$("#"+element_name).val()}catch(err){msg="unsuccessful"}wepsim_notify_success("INFO","Copied "+msg+"!.")}var ws_preload_tasks=[{name:"mode",action:function(hash){var ws_mode=get_cfg("ws_mode");if(hash.mode!==ws_mode)wsweb_select_main(hash.mode);return"
  • Mode set to "+hash.mode+".
  • "}},{name:"config_set",action:function(hash){cfgset_load(hash.config_set);wepsim_uicfg_restore();return"
  • Configuration set titled "+hash.config_set+" loaded.
  • "}},{name:"examples_set",action:function(hash){var url_examples_set=get_cfg("example_url");var ret=wepsim_example_loadSet(url_examples_set);wepsim_example_reset();wepsim_example_load(hash.examples_set);var result_txt=" has been loaded";if(null==ret){result_txt=" could not be loaded"}return"
  • Examples set titled "+hash.examples_set+""+result_txt+".
  • "}},{name:"example",action:function(hash){var example_obj=null;var example_index=parseInt(hash.example);if(isNaN(example_index)==false){example_obj=ws_examples[example_index]}else{for(var i=0;iExample titled "+example_obj.title+" has been loaded. "}},{name:"simulator",action:function(hash){var panels=hash.simulator.split(":");if(typeof panels[0]!=="undefined"){if(panels[0]==="microcode"){wsweb_change_show_processor()}if(panels[0]==="assembly"){wsweb_change_show_asmdbg()}}if(typeof panels[1]!=="undefined"){wsweb_set_details(panels[1].toUpperCase())}if(typeof panels[2]!=="undefined"){wsweb_do_action(panels[2].toLowerCase())}return"
  • User interface has been adapted.
  • "}},{name:"checkpoint",action:function(hash){uri_obj=new URL(hash.checkpoint);wepsim_checkpoint_loadURI(uri_obj)}},{name:"notify",action:function(hash){return""}},{name:"preload",action:function(hash){return""}}];function wepsim_preload_fromHash(hash){var key="";var act=function(){};var o="";for(var i=0;iState: restored into the state history.";wsweb_select_main(checkpointObj.mode);inputfirm.setValue(checkpointObj.firmware);inputasm.setValue(checkpointObj.assembly);o+="
  • Firmware and Assembly: Loaded";u="";if(checkpointObj.firmware.trim()!==""){wepsim_compile_firmware(checkpointObj.firmware);u+="Firmware"}if(checkpointObj.assembly.trim()!==""){wepsim_compile_assembly(checkpointObj.assembly);u+=" + Assembly"}if(u!==""){o+=" + Compiled"}o+=".
  • ";simcore_record_set(checkpointObj.record);if(o!==""){o="WepSIM has been instructed to restore a checkpoint:
    "+"
      "+o+"
    "+"To close this notification please press in the "+'X mark.
    '}if(checkpointObj.notify===true){wepsim_notify_do_notify("Restored Checkpoint",o,"info",get_cfg("NOTIF_delay"))}return o}function wepsim_checkpoint_Obj2NB(elements){var val="";var typ="";var cells=[];for(var key in elements){val=elements[key];typ=typeof val;if(typ!=="string"){val=JSON.stringify(val,null,2)}cells.push({cell_type:"markdown",source:"## "+key,metadata:{}});cells.push({cell_type:"code",source:val,outputs:[],execution_count:1,metadata:{name:key,type:typ,collapsed:false,deletable:false,editable:false}})}var nbObj={metadata:{kernelspec:{name:"node_nteract",language:"javascript",display_name:"Node.js (nteract)"},kernel_info:{name:"node_nteract"},language_info:{name:"javascript",version:"8.2.1",mimetype:"application/javascript",file_extension:".js"},title:"WepSIM ",nteract:{version:"nteract-on-jupyter@2.0.0"}},nbformat:4,nbformat_minor:0,cells:cells};return nbObj}function wepsim_checkpoint_NB2Obj(nbObj){var elements={};if(typeof nbObj.cells==="undefined")return elements;if(typeof nbObj.cells.length==="undefined")return elements;var key="";var type="";var value="";for(var i=0;i'+' '+obj_wsbackup[i].tag+""}o+="";$("#"+id_listdiv+"").html(o);return true}function wepsim_checkpoint_loadFromCache(id_backupname){var ret={error:true,msg:""};var browserCacheElto=$("input[name="+id_backupname+"]:checked");if(typeof browserCacheElto[0]==="undefined"){ret.msg="Invalid arguments";return ret}var id_backupcache=browserCacheElto[0].id;var obj_wsbackup=wepsim_checkpoint_backup_load();obj_wsbackup=obj_wsbackup.reverse();var current_checkpoint=obj_wsbackup[id_backupcache];if(typeof current_checkpoint==="undefined"){ret.msg="Backup id is not valid";return ret}var obj_fileToLoad={name:""};wepsim_checkpoint_loadFromObj(current_checkpoint,obj_fileToLoad);ret.error=false;ret.msg="Processing load request...";return ret}function wepsim_checkpoint_addCurrentToCache(){var obj_wsbackup=wepsim_checkpoint_backup_load();var current_date=Date().toString();var current_checkpoint=wepsim_checkpoint_get(current_date);if(current_checkpoint.firmware.trim()!==""&¤t_checkpoint.assembly.trim()!==""){obj_wsbackup.push(current_checkpoint)}wepsim_checkpoint_backup_save(obj_wsbackup);return true}function wepsim_checkpoint_clearCache(){var obj_wsbackup=[];wepsim_checkpoint_backup_save(obj_wsbackup);return true}function wepsim_update_signal_dialog_title(key){var b_btns=key+": "+"'+"';return wepsim_config_dialog_dropdown("success",b_btns,"var shval = $('#ask_shard').val(); "+"var shkey = $('#ask_skey').val(); "+"update_signal_loadhelp('#help2', shval, shkey);\"")}function wepsim_update_signal_dialog_body(key,signal_obj){var checkvalue=signal_obj.value>>>0;var str_bolded="";var str_checked="";var input_help="";var behav_raw="";var behav_str="";var n=0;var nvalues=Math.pow(2,signal_obj.nbits);if(signal_obj.behavior.length==nvalues){input_help='
      ';for(var k=0;kdefault value'}behav_raw=signal_obj.behavior[k];behav_str=compute_signal_verbals(key,k);if(""==behav_str.trim()){behav_str="<without main effect>"}n=k.toString(10);input_help+='
    1. '+'"+"
    2. "}input_help+="
    "}else{input_help+='
      '+"
      \n"+"
    "}var curr_hw=simhw_short_name();if(""==curr_hw){curr_hw="ep"}return'"}function wepsim_update_signal_dialog(key){var signal_obj=simhw_sim_signal(key);if(typeof signal_obj==="undefined"){return null}var dlg_obj={id:"dlg_updatesignal",title:function(){return wepsim_update_signal_dialog_title(key)},body:function(){return wepsim_update_signal_dialog_body(key,signal_obj)},value:signal_obj.value,buttons:{success:{label:' '+'Save',className:"btn-info btn-sm col col-md-3 float-right",callback:function(){key=$("#ask_skey").val();user_input=$("input[name='ask_svalue']:checked").val();if(typeof user_input=="undefined"){user_input=$("input[name='ask_svalue']").val()}wepsim_update_signal_with_value(key,user_input);wsweb_dialogbox_close_updatesignal()}},close:{label:''+'Close',className:"btn-primary btn-sm col col-md-3 float-right",callback:function(){wsweb_dialogbox_close_updatesignal()}}},onshow:function(){if(typeof $(".dial").knob!=="undefined"){var nvalues=Math.pow(2,signal_obj.nbits);$(".dial").knob({min:0,max:nvalues-1}).val(signal_obj.value).trigger("change")}var bb=$("#dlg_updatesignal");bb.find(".modal-title").addClass("mx-auto");bb.find(".bootbox-close-button").addClass("mx-1");bb.modal("handleUpdate");wsweb_scroll_record("#scroller-signal");simcore_record_captureInit()},size:"large"};return wsweb_dlg_open(dlg_obj)}function wepsim_update_signal_quick(key){var signal_obj=simhw_sim_signal(key);if(typeof signal_obj==="undefined"){return}var nvalues=Math.pow(2,simhw_sim_signal(key).nbits);var user_input=simhw_sim_signal(key).value;user_input=(user_input+1)%nvalues;wepsim_update_signal_with_value(key,user_input)}function wepsim_update_signal_with_value(key,value){simhw_sim_signal(key).value=value;propage_signal_update(key);simcore_record_append_new("Update signal "+key+" with value "+value,'wepsim_update_signal_with_value("'+key+'", '+value+");\n")}function show_visgraph(jit_fire_dep,jit_fire_order){var sig={};var tmp_hash={};var tmp_nodes=[];var tmp_id=0;for(sig in simhw_sim_signals()){tmp_hash[sig]=tmp_id;tmp_nodes.push({id:tmp_id,label:sig,title:sig});tmp_id++}for(var i=0;iµadd "+reg_maddr}}var state_history=[];function wepsim_state_history_get(){return state_history}function wepsim_state_history_reset(){$("[data-toggle=popover4]").popover("hide");state_history=[]}function wepsim_state_history_add(){var ret=wepsim_state_get_clk();var state_obj=simcore_simstate_current2state();ret.content=simcore_simstate_state2checklist(state_obj,"");state_history.push(ret)}function wepsim_state_results_empty(){var empty_results=''+"<Empty (only modified values are shown)>"+"";$("#check_results1").html(empty_results);$("#s_clip").html("clipboard");$("#s_ref").html("reference")}function wepsim_state_history_empty(){var empty_history='
    '+''+'<Empty history>'+"";$("#history1").html(empty_history)}function wepsim_state_history_list(){if(0==state_history.length){wepsim_state_history_empty();wepsim_state_results_empty();return}$("[data-toggle=popover4]").popover("hide");var t=0;var it="";var tt="";var vr="";var o="";for(var i=state_history.length-1;i>=0;i--){t=new Date(state_history[i].time);it=t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+"-"+t.getHours()+"-"+t.getMinutes()+"-"+t.getSeconds()+"-"+t.getMilliseconds();tt='
    '+state_history[i].title+"
    "+"was inserted at:
    "+"Date: "+t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+"
    "+"Hour: "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()+"-"+t.getMilliseconds()+"
    "+'"+"
    ";vrow="";if(i!=0)vrow='
     
     
    ';o+='
    '+'
    '+' '+' '+' \t\t '+state_history[i].title_short+""+" "+" "+vrow+"
    "+'
    '+'
    '+' '+' '+' '+"
    "+tt+'
    '+'
    '+state_history[i].content+"
    "+' "+"
    "+"
    "+"
    "}$("#history1").html(o);wepsim_state_results_empty();$("[data-toggle=popover4]").popover({html:true,placement:"auto",trigger:"click",container:"body",animation:false,content:function(){var id=$(this).attr("id");return $("#popover-content-"+id).html()},sanitizeFn:function(content){return content}})}function wepsim_dialog_current_state(){var ret=wepsim_state_get_clk();$("#curr_clk_maddr").html(ret.title_short);var state_obj=simcore_simstate_current2state();var txt_checklist=simcore_simstate_state2checklist(state_obj,"");$("#end_state1").tokenfield("setTokens",txt_checklist);wepsim_notify_success("INFO","Current state loaded !");var neltos=0;var nceltos=0;var ga_str="";for(var component in state_obj){nceltos=0;for(var eltos in state_obj[component]){nceltos++}ga_str=ga_str+","+component+"="+nceltos;neltos=neltos+nceltos}ga("send","event","state","state.dump","state.dump"+".ci="+get_value(simhw_sim_state("REG_IR_DECO"))+",neltos="+neltos+ga_str)}function wepsim_dialog_check_state(obj_chklst_expected,obj_chklst_current){var obj_result=simcore_simstate_diff_results(obj_chklst_expected,obj_chklst_current);var msg="";if(0==obj_result.errors)msg=" 
    "+"Meets the specified requirements"+"
    ";else msg=simcore_simstate_checkreport2html(obj_result.result,true);$("#check_results1").html(msg);ga("send","event","state","state.check","state.check"+",ci="+get_value(simhw_sim_state("REG_IR_DECO"))+".a="+obj_result.neltos_expected+",b="+obj_result.neltos_obtained+",sd="+obj_result.errors);return true}function wepsim_dialog_check_reset(){$("#end_state1").val("");$("#end_state1").tokenfield("setTokens",[]);$("#check_results1").html("");return true}function wepsim_execute_reset(reset_cpu,reset_memory){wepsim_state_history_reset();if(true===reset_memory){var SIMWARE=get_simware();if(SIMWARE.firmware.length!==0){update_memories(SIMWARE)}}if(true===reset_cpu){simcore_reset()}}function wepsim_execute_instruction(){var ret=simcore_check_if_can_execute();if(false===ret.ok){wsweb_dlg_alert(ret.msg);return false}var options={verbosity:0,cycles_limit:get_cfg("DBG_limitick")};ret=simcore_execute_microprogram(options);if(false===ret.ok){wepsim_show_stopbyevent("Info",ret.msg);return false}return true}function wepsim_execute_microinstruction(){var ret=simcore_check_if_can_execute();if(false===ret.ok){wsweb_dlg_alert(ret.msg);return false}ret=simcore_execute_microinstruction();if(false===ret.ok){wepsim_show_stopbyevent("Info",ret.msg);return false}return true}function wepsim_execute_set_breakpoint(hexaddr,is_set){var SIMWARE=get_simware();var curr_mp=simhw_internalState("MP");var curr_addr=parseInt(hexaddr,16);if(typeof curr_mp[curr_addr]!=="undefined"){curr_mp[curr_addr].breakpoint=is_set}if(typeof SIMWARE.mp[hexaddr]!=="undefined"){SIMWARE.mp[hexaddr].breakpoint=is_set}return true}function wepsim_execute_toggle_breakpoint(hexaddr){var SIMWARE=get_simware();var curr_mp=simhw_internalState("MP");var curr_addr=parseInt(hexaddr,16);var is_set=false;if(typeof curr_mp[curr_addr]!=="undefined"){is_set=curr_mp[curr_addr].breakpoint;curr_mp[curr_addr].breakpoint=!is_set}if(typeof SIMWARE.mp[hexaddr]!=="undefined"){is_set=SIMWARE.mp[hexaddr].breakpoint;SIMWARE.mp[hexaddr].breakpoint=!is_set}return is_set}function wepsim_execute_toggle_microbreakpoint(hexaddr){var curr_mc=simhw_internalState("MC");var curr_addr=parseInt(hexaddr,16);var is_set=false;if(typeof curr_mc[curr_addr]!=="undefined"){is_set=curr_mc[curr_addr].breakpoint;curr_mc[curr_addr].breakpoint=!is_set}return is_set}var DBG_stop=true;var DBG_limit_instruction=0;function wepsim_execute_stop(){DBG_stop=true;DBG_limit_instruction=0;webui_button_set_stop("exebar1");var o="CLK-"+Math.trunc(get_value(simhw_sim_state("CLK")))+"+"+"DECO_INS-"+Math.trunc(get_value(simhw_sim_state("DECO_INS")))+"+"+"ACC_TIME-"+Math.trunc(get_value(simhw_sim_state("ACC_TIME")));ga("send","event","execution","execution."+"cpu","execution."+"cpu"+"."+o);return true}function wepsim_execute_play(wepsim_execute_stop){var ret=simcore_check_if_can_execute();if(false===ret.ok){wsweb_dlg_alert(ret.msg);return false}DBG_stop=false;DBG_limit_instruction=0;webui_button_set_start("exebar1");wepsim_execute_chainplay(wepsim_execute_stop);return true}function wepsim_execute_toggle_play(wepsim_execute_stop){if(DBG_stop===false){DBG_stop=true}else{wepsim_execute_play(wepsim_execute_stop)}return DBG_stop}function wepsim_check_stopbybreakpoint(dash_memaddr){if(typeof dash_memaddr==="undefined"){return false}return dash_memaddr.breakpoint}function wepsim_show_stopbyevent(msg1,msg2){var dlg_obj={id:"current_state2",title:function(){var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var reg_maddr=get_value(simhw_sim_state(maddr_name));var curr_maddr="0x"+reg_maddr.toString(16);var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=get_value(simhw_sim_state(pc_name));var curr_addr="0x"+reg_pc.toString(16);var dialog_title=msg1+" @ pc="+curr_addr+"+mpc="+curr_maddr;return''+dialog_title+""},body:function(){return'
    '+'
    '+'
    '+'\t
    '+'\t '+"\t
    "+'\t
    '+'\t
    '+msg2+"
    "+"\t
    "+"
    "+"
    "+"
    "},buttons:{states:{label:"States",className:"btn btn-secondary col float-left shadow-none mr-auto",callback:function(){wsweb_dlg_close(dlg_obj);wsweb_dialog_open("state");return true}},close:{label:"Close",className:"btn-primary col float-right shadow-none"}},size:"",onshow:function(){}};wsweb_dlg_open(dlg_obj);return true}function wepsim_check_memdashboard(ref_mdash,notif_origin){if(typeof ref_mdash==="undefined"){return true}if(ref_mdash.state){wepsim_state_history_add();wepsim_state_history_list()}var notifications=ref_mdash.notify.length;if(notifications>1){var dialog_title="Notify @ 0x"+parseInt(notif_origin).toString(16)+": "+ref_mdash.notify[1];var dialog_msg='
    ';for(var k=1;k"}dialog_msg+="
    ";bootbox.confirm({title:dialog_title,message:dialog_msg,buttons:{cancel:{label:"Stop",className:"btn-danger btn-sm"},confirm:{label:"Continue",className:"btn-primary btn-sm"}},callback:function(result){if(result)setTimeout(wepsim_execute_chainplay,get_cfg("DBG_delay"),wepsim_execute_stop);else wepsim_execute_stop()}});return false}return true}function pack_ret2(p_ok,p_level,p_msg){var ret2={ok:p_ok,msg_level:p_level,msg:p_msg};return ret2}function wepsim_execute_chunk(options,chunk){var ret=false;var ret2={};var curr_mp=simhw_internalState("MP");var curr_firm=simhw_internalState("FIRMWARE");var pc_name=simhw_sim_ctrlStates_get().pc.state;var ref_pc=simhw_sim_state(pc_name);var reg_pc=get_value(ref_pc);var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var ref_maddr=simhw_sim_state(maddr_name);var reg_maddr=get_value(ref_maddr);var ref_mdash=null;var i_clks=0;var i=0;while(i0&&i_clks>=options.cycles_limit){return pack_ret2(false,"Info","WARNING: clock cycles limit reached in a single instruction.")}reg_maddr=get_value(ref_maddr);reg_pc=get_value(ref_pc);ref_mdash=simhw_internalState_get("MC",reg_maddr);ret=wepsim_check_memdashboard(ref_mdash,reg_maddr);if(false===ret){return pack_ret2(false,"","")}ret=wepsim_check_stopbybreakpoint(ref_mdash);if(true===ret){return pack_ret2(false,"Breakpoint","INFO: Microinstruction is going to be issue.")}if(0==reg_maddr&&false==ref_mdash.is_native||0!=reg_maddr&&true==ref_mdash.is_native){ref_mdash=simhw_internalState_get("MP",reg_pc);ret=wepsim_check_memdashboard(ref_mdash,reg_pc);if(false===ret){return pack_ret2(false,"","")}ret=wepsim_check_stopbybreakpoint(ref_mdash);if(true===ret){return pack_ret2(false,"Breakpoint","INFO: Instruction is going to be fetched.")}i++;i_clks=0}}return pack_ret2(true,"","INFO: number of instruction executed: "+i+" (limited to "+options.instruction_limit+")")}function wepsim_execute_chunk_atlevel(chunk,wepsim_execute_stop){var options={};var ret=false;var playlevel=get_cfg("DBG_level");if(playlevel!=="instruction"){options={verbosity:0,cycles_limit:get_cfg("DBG_limitick")};ret=wepsim_execute_chunk(options,chunk);if(ret.ok==false&&ret.msg.trim()!=""){wepsim_show_stopbyevent(ret.msg_level,ret.msg);wepsim_execute_stop()}return ret.ok}var curr_firm=simhw_internalState("FIRMWARE");var pc_name=simhw_sim_ctrlStates_get().pc.state;var ref_pc=simhw_sim_state(pc_name);var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var ref_maddr=simhw_sim_state(maddr_name);var ref_mdash=0;options={verbosity:0,cycles_limit:get_cfg("DBG_limitick")};ret=false;var reg_pc=0;for(var i=0;iget_cfg("DBG_limitins")){wepsim_show_stopbyevent("Limit","Number of executed instructions limit reached.
    "+"
    "+"See related configuration options about limits:
    "+"");wepsim_execute_stop();return}setTimeout(wepsim_execute_chainplay,get_cfg("DBG_delay"),wepsim_execute_stop)}function wepsim_notify_show_notify(ntf_title,ntf_message,ntf_type,ntf_delay){var ac=$("#alerts-container");if(ac.length===0){ac=$('
    ');$("body").append(ac)}var btn1=$('
    ";return o}function wepsim_show_breakpoint_icon_list(){var o="
    "+"
    ";var prev_type="";for(var elto in breakpoint_icon_list){if(breakpoint_icon_list[elto].type!=prev_type){o=o+"
    "+"
    "+"
    "+breakpoint_icon_list[elto].type+"
    "+"
    "+"
    ";prev_type=breakpoint_icon_list[elto].type}o=o+""+elto+" icon'}o=o+"
    "+"
    ";return o}function wepsim_show_breakpoint_icon_template(){var o='";return o}function wepsim_config_dialog_title(name,color,str_onchange){return""}function wepsim_config_dialog_dropdown(color,base_buttons,str_onchange){return""}var ws_config=[];ws_config.push({id:"select7",type:"General",u_class:"",code_cfg:"
    "+i18n_get_selectcfg()+"
    ",code_init:function(){$("#select7").val(get_cfg("ws_idiom"))},description:"Idiom for help, examples, etc."});ws_config.push({id:"slider3",type:"General",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label8-"+get_cfg("NOTIF_delay")).button("toggle")},description:"Notification speed: time before disapear"});ws_config.push({id:"radio15",type:"General",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){var optValue=get_cfg("ws_skin_dark_mode");$("#label15-"+optValue).button("toggle");wepsim_restore_darkmode(optValue)},description:"Dark Mode"});ws_config.push({id:"radio12",type:"Execution",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label12-"+get_cfg("DBG_delay")).button("toggle")},description:"Running speed: execution speed"});ws_config.push({id:"select1",type:"Execution",u_class:"",code_cfg:""+" \t\tstop icon"+"",code_init:function(){var elto=get_cfg("ICON_theme");$("#img_select1").attr("src","images/stop/stop_"+elto+".gif");$("#img_select1").attr("class",breakpoint_icon_list[elto].addclass);$("#breakpointicon1").popover({html:true,content:wepsim_show_breakpoint_icon_list,template:wepsim_show_breakpoint_icon_template(),sanitizeFn:function(content){return content}}).on("shown.bs.popover",(function(shownEvent){wepsim_uicfg_apply()}))},description:"Breakpoint icon: icon to be used for breakpoints"});ws_config.push({id:"select6",type:"Execution",u_class:"",code_cfg:"
    "+"\t "+"\t
    ",code_init:function(){$("#select6").val(get_cfg("DBG_limitins"))},description:"Limit instructions: number of instructions to be executed"});ws_config.push({id:"select3",type:"Execution",u_class:"",code_cfg:"
    "+"\t "+"\t
    ",code_init:function(){$("#select3").val(get_cfg("DBG_limitick"))},description:"Limit instruction ticks: to limit clock ticks"});ws_config.push({id:"radio7",type:"Editor",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label7-"+get_cfg("editor_theme")).button("toggle")},description:"Editor theme: light or dark"});ws_config.push({id:"select2",type:"Editor",u_class:"",code_cfg:"
    "+" "+"
    ",code_init:function(){$("#select2").val(get_cfg("editor_mode"))},description:"Editor mode: vim, emacs, etc."});ws_config.push({id:"radio2",type:"Register file",u_class:"user_archived",code_cfg:"
    "+"
    "+"\t "+"\t "+"\t "+"
    "+"
    "+"\t "+"\t "+"\t "+"
    "+"\t
    ",code_init:function(){$("#label2-"+get_cfg("RF_display_format")).button("toggle")},description:"Display format "+"\'>(example)'});ws_config.push({id:"radio3",type:"Register file",u_class:"user_archived",code_cfg:"
    "+"\t "+"\t "+"
    ",code_init:function(){$("#label3-"+get_cfg("RF_display_name")).button("toggle")},description:"Register file names"});ws_config.push({id:"radio9",type:"Register file",u_class:"user_archived",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label9-"+get_cfg("is_editable")).button("toggle")},description:"Editable registers: edit register file values"});ws_config.push({id:"colorpicker1",type:"Circuitry simulation",u_class:"user_microcode",code_cfg:"
    "+"\t "+"
    ",code_init:function(){$("#colorpicker1").spectrum({preferredFormat:"hex",color:get_cfg("color_data_active")})},description:"Data-path color (example)"});ws_config.push({id:"colorpicker2",type:"Circuitry simulation",u_class:"user_microcode",code_cfg:"
    "+"\t "+"\t
    ",code_init:function(){$("#colorpicker2").spectrum({preferredFormat:"hex",color:get_cfg("color_name_active")})},description:"Signal color"});ws_config.push({id:"radio10",type:"Circuitry simulation",u_class:"user_archived user_microcode",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label10-"+get_cfg("is_byvalue")).button("toggle")},description:"Show by value or by activation"});ws_config.push({id:"radio5",type:"Circuitry simulation",u_class:"user_microcode",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label5-"+get_cfg("is_interactive")).button("toggle")},description:"Interactive mode: signal value can be updated"});ws_config.push({id:"radio6",type:"Circuitry simulation",u_class:"user_microcode",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label6-"+get_cfg("is_quick_interactive")).button("toggle")},description:"Quick interactive mode: quick update of signal value"});ws_config.push({id:"radio11",type:"Accesibility",u_class:"user_archived",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label11-"+get_cfg("use_voice")).button("toggle")},description:"Active voice: external voice control"});ws_config.push({id:"radio13",type:"Accesibility",u_class:"user_archived",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){$("#label13-"+get_cfg("verbal_verbose")).button("toggle")},description:"Verbalization: textual or mathematical"});ws_config.push({id:"select8",type:"Accesibility",u_class:"",code_cfg:"
    "+" "+"
    ",code_init:function(){$("#select8").val(get_cfg("ws_skin_ui"))},description:"WepSIM User Interface skin"});ws_config.push({id:"radio14",type:"Accesibility",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){var optValue=get_cfg("ws_skin_user");$("#label14-"+optValue.replace(/:/g,"__")).button("toggle")},description:"Beginner view"});ws_config.push({id:"radio16",type:"Accesibility",u_class:"",code_cfg:"
    "+"\t "+"\t "+"\t
    ",code_init:function(){var optValue=get_cfg("AS_enable");$("#label16-"+optValue).button("toggle")},description:"Auto-scroll while executing"});var ws_examples=[];var ws_examples_set=[{name:"Empty",url:"",url_base_asm:"",url_base_mc:""}];var ws_examples_active=-1;function wepsim_example_reset(){ws_examples=[];ws_examples_active=-1;webui_toolbar_updateExampleSet()}function wepsim_example_load(e_name){var jobj=null;for(var i=0;i0)sample_hw=sid[0];else console.log("warning: example without hardware id");var sample_mc="";if(sid.length>1)sample_mc=sid[1];else console.log("warning: example without microcode id");var sample_asm="";if(sid.length>2)sample_asm=sid[2];else console.log("warning: example without assembly id");var url=ws_examples_set[ws_examples_active].url_base_asm+"asm-"+sample_asm+".txt";var do_next=function(mcode){inputasm.setValue(mcode);inputasm.refresh();var ok=false;var SIMWARE=get_simware();if(SIMWARE.firmware.length!==0){ok=wepsim_compile_assembly(mcode);inputasm.is_compiled=ok}if(false===ok){wsweb_change_workspace_assembly();return}if(true===chain_next_step){setTimeout((function(){wsweb_change_workspace_simulator()}),50)}setTimeout((function(){show_memories_values()}),500);wepsim_notify_success("INFO","Example ready to be used.")};wepsim_load_from_url(url,do_next);simcore_record_append_new("Load assembly from example "+example_id,'load_from_example_assembly("'+example_id+'", '+chain_next_step+");\n");ga("send","event","example","example.assembly","example.assembly."+sample_hw+"."+sample_asm)}function load_from_example_firmware(example_id,chain_next_step){if(-1==ws_examples_active){ws_alert("warning: no active example set");return}inputfirm.setValue("Please wait...");inputfirm.refresh();var sid=example_id.split(":");var sample_hw="";if(sid.length>0)sample_hw=sid[0];else console.log("warning: example without hardware id");var sample_mc="";if(sid.length>1)sample_mc=sid[1];else console.log("warning: example without microcode id");var sample_asm="";if(sid.length>2)sample_asm=sid[2];else console.log("warning: example without assembly id");var url=ws_examples_set[ws_examples_active].url_base_mc+"mc-"+sample_mc+".txt";inputfirm.setOption("readOnly",false);var do_next=function(mcode){inputfirm.setValue(mcode);inputfirm.refresh();var ok=wepsim_compile_firmware(mcode);inputfirm.is_compiled=ok;if(false===ok){wsweb_change_workspace_microcode();return}if(true===chain_next_step){setTimeout((function(){load_from_example_assembly(example_id,chain_next_step)}),50)}else{setTimeout((function(){show_memories_values();asmdbg_update_assembly()}),50);wepsim_notify_success("INFO","Example ready to be used.")}};wepsim_load_from_url(url,do_next);simcore_record_append_new("Load firmware from example "+example_id,'load_from_example_firmware("'+example_id+'", false);\n');ga("send","event","example","example.firmware","example.firmware."+sample_hw+"."+sample_mc)}function share_example(m,base_url){var e_description=ws_examples[m].description;e_description=e_description.replace(/<[^>]+>/g,"");var e_id=ws_examples[m].id;var e_hw=ws_examples[m].hardware;var share_title="WepSIM example "+e_id+"...";var share_text="This is a link to the WepSIM example "+e_id+" ("+e_description+"):\n";var share_url=""+base_url+"?mode="+e_hw+"&examples_set="+ws_examples_set[ws_examples_active].name+"&example="+m;return share_information("example_"+m,share_title,share_text,share_url)}function table_examples_html(examples){var ahw="ep";var ep_modes=wepsim_mode_getAvailableModes();var mode=get_cfg("ws_mode");if(mode!=="null"&&!ep_modes.includes(mode)){ahw=mode}var base_url=get_cfg("base_url");var fmt_toggle="";var w100_toggle="";var toggle_cls="";var t_hwmcasm="";var t_index="";var e_title="";var e_type="";var e_level="";var e_hw="";var e_mc="";var e_asm="";var e_description="";var e_id="";var u="";var examples_groupby_type={};for(var m=0;m'+' '+t_index+""+""+'
    '+' '+e_title+""+''+base_url+"?mode="+mode+"&examples_set="+ws_examples_set[ws_examples_active].name+"&example="+m+""+'
    '+' "+' "+"
    "+"
    "+'
    '+" "+e_description+""+"
    "+'
    ';if(typeof examples_groupby_type[e_type]==="undefined"){examples_groupby_type[e_type]=[]}examples_groupby_type[e_type].push({row:u,level:e_level})}var o="";u="";var l="";for(m in examples_groupby_type){u='
    ';l=examples_groupby_type[m][0].level;for(var n=0;n";o=o+"
    "+ahw.toUpperCase()+": "+m+"
    "+u}if(o.trim()===""){o='<No examples are available for the selected hardware>'}o='
    '+o+"
    ";return o}function table_helps_html(helps){var o="";var fmt_toggle="";var w100_toggle="";var toggle_cls="";var fmt_header="";var e_title="";var e_itype="";var e_utype="";var e_reference="";var e_description="";var e_id="";var t_index="";var utypes=[];for(var m=0;m'+'
    ';for(m=0;m"+helps[m].u_type+"
    "}e_title=helps[m].title;e_itype=helps[m].i_type;e_utype=helps[m].u_type;e_uclass=helps[m].u_class;e_reference=helps[m].reference;e_description=helps[m].description;e_id=helps[m].id;var onclick_code="";if("relative"===e_itype)onclick_code="wepsim_help_set_relative('"+e_reference+"');"+"wepsim_help_refresh();";if("absolute"===e_itype)onclick_code="wepsim_help_set_absolute('"+e_reference+"');"+"wepsim_help_refresh();";if("code"===e_itype)onclick_code=e_reference;if(fmt_toggle==="")fmt_toggle="bg-light";else fmt_toggle="";if(m%2==0)w100_toggle="collapse7 show";else w100_toggle="";toggle_cls=fmt_toggle+" "+e_uclass+" "+e_utype;t_index=(m+1).toString().padStart(2," ").replace(/ /g," ");o=o+fmt_header+'
    '+' '+t_index+""+"
    "+'
    '+' '+e_title+""+"
    "+'
    '+" "+e_description+""+"
    "+'
    '}o=o+"
    ";return o}function wepsim_help_refresh(){simcore_record_append_new("Refresh help content","wepsim_help_refresh();\n");var helpdiv="#scroller-help1";var scrolltothetop=function(){var helpdiv_container="scroller-help1";var elto=document.getElementById(helpdiv_container);if(elto!=null)elto.scrollTop=0};var helpurl="";var seg_idiom=get_cfg("ws_idiom");var seg_hardw=simhw_active().sim_short_name;var rel=$("#help1_ref").data("relative");if(typeof rel!="undefined"&&rel!=""){var r=rel.split("#");helpurl="help/"+r[0]+"-"+seg_idiom+".html";resolve_html_url(helpdiv,helpurl,"#"+r[1],scrolltothetop);ga("send","event","help","help.simulator","help.simulator."+rel);return}var ab1=$("#help1_ref").data("absolute");if(typeof ab1!="undefined"&&ab1!=""){helpurl="examples/hardware/"+seg_hardw+"/help/"+ab1+"-"+seg_idiom+".html";resolve_html_url(helpdiv,helpurl,"",scrolltothetop);ga("send","event","help","help."+ab1,"help."+ab1+".*");return}var cod1=$("#help1_ref").data("code");if(typeof cod1!="undefined"&&cod1==="true"){ga("send","event","help","help.code","help.code.*");return}if(typeof rel!="undefined"&&rel==""){var html_index=table_helps_html(ws_help);$(helpdiv).html(html_index);ga("send","event","help","help.index","help.index");return}}function wepsim_help_set_relative(rel){$("#help1_ref").data("relative",rel);$("#help1_ref").data("absolute","");$("#help1_ref").data("code","false");simcore_record_append_new("Update help content",'wepsim_help_set_relative("'+rel+'");\n')}function wepsim_help_set_absolute(ab1){$("#help1_ref").data("relative","");$("#help1_ref").data("absolute",ab1);$("#help1_ref").data("code","false");simcore_record_append_new("Update help content",'wepsim_help_set_absolute("'+ab1+'");\n')}function wepsim_open_help_content(content){$("#scroller-help1").html(content);$("#help1_ref").data("relative","");$("#help1_ref").data("absolute","");$("#help1_ref").data("code","true")}function wepsim_open_help_hardware_summary(){var ahw2=simhw_active().sim_short_name;var img2="examples/hardware/"+ahw2+"/images/cpu.svg?time=20190102";var lyr2=""+"Your browser does not support SVG"+"";wepsim_open_help_content(lyr2);simcore_record_append_new("Open hardware summary","wepsim_open_help_hardware_summary();\n")}function request_html_url(r_url){var robj=null;if(false===is_mobile()){if(navigator.onLine)robj=fetch(r_url);else robj=caches.match(r_url).then()}else{robj=$.ajax(r_url,{type:"GET",dataType:"html"})}return robj}function update_div_frompartialhtml(helpdiv,key,data){var default_content="
    Sorry, No more details available for this element.

    \n";if(""===data)$(helpdiv).html(default_content);else $(helpdiv).html(data);if(""===data||""===key||"#"===key){return}var help_content=$(helpdiv).filter(key).html();if(typeof help_content==="undefined"){help_content=$(helpdiv).find(key).html()}if(typeof help_content==="undefined"){help_content=default_content}$(helpdiv).html(help_content)}function resolve_html_url(helpdiv,r_url,key,update_div){return request_html_url(r_url).then((function(data){if(typeof data=="object"){data.text().then((function(res){update_div_frompartialhtml(helpdiv,key,res);update_div()}))}else{update_div_frompartialhtml(helpdiv,key,data);update_div()}}))}function update_signal_loadhelp(helpdiv,simhw,key){var curr_idiom=get_cfg("ws_idiom");var help_base="examples/hardware/"+simhw+"/help/signals-"+curr_idiom+".html";resolve_html_url(helpdiv,help_base,"#"+key,(function(){$(helpdiv).trigger("create")}));ga("send","event","help","help.signal","help.signal."+simhw+"."+key)}function update_checker_loadhelp(helpdiv,key){var curr_idiom=get_cfg("ws_idiom");var help_base="help/simulator-"+curr_idiom+".html";resolve_html_url(helpdiv,help_base,"#"+key,(function(){$(helpdiv).trigger("create")}));ga("send","event","help","help.checker","help.checker."+key)}var ws_help=[];ws_help.push({id:"simulator",title:"Execute example",i_type:"code",u_type:"tutorial",u_class:"",reference:"wsweb_dialog_close('help'); "+"wsweb_recordbar_show(); "+"wepsim_checkpoint_loadExample('tutorial_2.txt') ; "+"setTimeout(wsweb_record_play, 1000);",description:"Play the execute example tutorial.
    "});ws_help.push({id:"simulator",title:"Welcome tutorial",i_type:"code",u_type:"tutorial",u_class:"",reference:"wsweb_dialog_close('help'); "+"sim_tutorial_showframe('welcome', 0);",description:"Open the welcome tutorial.
    "});ws_help.push({id:"simulator",title:"Simple usage tutorial",i_type:"code",u_type:"tutorial",u_class:"",reference:"wsweb_dialog_close('help'); "+"sim_tutorial_showframe('simpleusage', 0);",description:"Open the simple usage tutorial, for microprogramming and assembly programming.
    "});ws_help.push({id:"simulator",title:"Simulator: firmware",i_type:"relative",u_type:"simulator",u_class:"user_microcode",reference:"simulator#help_simulator_firmware",description:"How to work with the firmware to be loaded into the control memory.
    "});ws_help.push({id:"microcode",title:"Microcode format",i_type:"relative",u_type:"simulator",u_class:"user_microcode",reference:"simulator#help_firmware_format",description:"Syntax of the microcode used.
    "});ws_help.push({id:"simulator",title:"Simulator: assembly",i_type:"relative",u_type:"simulator",u_class:"",reference:"simulator#help_simulator_assembly",description:"How to work with the assembly that use the aforementioned firmware.
    "});ws_help.push({id:"assembly",title:"Assembly format",i_type:"relative",u_type:"simulator",u_class:"",reference:"simulator#help_assembly_format",description:"Syntax of the assembly elements.
    "});ws_help.push({id:"simulator",title:"Simulator: execution",i_type:"relative",u_type:"simulator",u_class:"",reference:"simulator#help_simulator_execution",description:"How the simulator can execute the assembly and firmware.
    "});ws_help.push({id:"simulator",title:"Simulator: states",i_type:"relative",u_type:"simulator",u_class:"",reference:"simulator#help_dumper",description:"How the simulator can show the current state, and the difference between two states.
    "});ws_help.push({id:"architecture",title:"Simulated architecture",i_type:"absolute",u_type:"simulated processor",u_class:"",reference:"hardware",description:"Description of the simulated processor architecture.
    "});ws_help.push({id:"architecture",title:"Simulated signals",i_type:"absolute",u_type:"simulated processor",u_class:"user_microcode",reference:"signals",description:"Main signals summary of the simulated elemental processor.
    "});ws_help.push({id:"architecture",title:"Hardware summary",i_type:"code",u_type:"simulated processor",u_class:"user_microcode",reference:"wepsim_open_help_hardware_summary();"+"simcore_record_append_new('Show hardware summary', "+" 'wepsim_open_help_hardware_summary();\\\n');",description:"Reference card for the simulated elemental processor hardware.
    "});ws_help.push({id:"about",title:"License, platforms, etc.",i_type:"relative",u_type:"info",u_class:"",reference:"about#help_about",description:"WepSIM license, supported platforms, technologies used.
    "});ws_help.push({id:"authors",title:"Authors",i_type:"code",u_type:"info",u_class:"",reference:"wsweb_dialog_close('help'); "+"wsweb_dialog_open('about');",description:"Authors of WepSIM.
    "});tutorials={};function sim_tutorial_goframe(tutorial_name,from_step,to_step){var tutorial=tutorials[tutorial_name];if(typeof tutorial==="undefined"){return}tutorial[from_step].code_post();if(typeof tutbox!=="undefined"){tutbox.modal("hide")}setTimeout((function(){sim_tutorial_showframe(tutorial_name,to_step)}),tutorial[from_step].wait_next);if(simcore_voice_canSpeak()){window.speechSynthesis.cancel()}}function sim_tutorial_cancelframe(){var ws_mode=get_cfg("ws_mode");wsweb_select_main(ws_mode);tutbox.modal("hide");if(simcore_voice_canSpeak()){window.speechSynthesis.cancel()}}function sim_tutorial_showframe(tutorial_name,step){var tutorial=tutorials[tutorial_name];if(typeof tutorials=="undefined"){return}if(step==tutorial.length){return}if(step<0){return}ga("send","event","help","help.tutorial","help.tutorial.name="+tutorial_name+",step="+step);tutorial[step].code_pre();var wsi=get_cfg("ws_idiom");var bbbt={};bbbt.cancel={label:i18n_get("gui",wsi,"Disable tutorial mode"),className:"btn-danger col float-right",callback:function(){sim_tutorial_cancelframe()}};if(step!=0)bbbt.prev={label:i18n_get("gui",wsi,"Prev."),className:"btn-success col float-right",callback:function(){sim_tutorial_goframe(tutorial_name,step,step-1)}};if(step!=tutorial.length-1)bbbt.next={label:i18n_get("gui",wsi,"Next"),className:"btn-success col float-right",callback:function(){sim_tutorial_goframe(tutorial_name,step,step+1)}};else bbbt.end={label:i18n_get("gui",wsi,"End"),className:"btn-success col float-right",callback:function(){sim_tutorial_goframe(tutorial_name,step,step+1)}};tutbox=bootbox.dialog({title:tutorial[step].title,message:tutorial[step].message,buttons:bbbt,size:"large",animate:false});simcore_voice_speak(tutorial[step].title.replace(/<[^>]*>/g,"")+". "+tutorial[step].message.replace(/<[^>]*>/g,""));i18n_update_tags("tutorial_"+tutorial_name)}tutorials.welcome=[];tutorials.welcome.push({id:"welcome",title:"title 0",message:"message 0",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 1",message:"message 1",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 2",message:"message 2",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 3",message:"message 3",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 4",message:"message 4",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.welcome.push({id:"welcome",title:"title 5",message:"message 5",code_pre:function(){},code_post:function(){load_from_example_firmware("ep:ep_mips_base:ep_s1_e1",true)},wait_next:100});tutorials.simpleusage=[];tutorials.simpleusage.push({id:"simpleusage",title:"title 0",message:"message 0",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 1",message:"message 1",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 2",message:"message 2",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 3",message:"message 3",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 4",message:"message 4",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});tutorials.simpleusage.push({id:"simpleusage",title:"title 5",message:"message 5",code_pre:simcore_do_nothing_handler,code_post:simcore_do_nothing_handler,wait_next:100});var tour=null;function wepsim_newbie_tour(){var ws_idiom=get_cfg("ws_idiom");wepsim_newbie_tour_setLang(ws_idiom);if(null==tour){tour=introJs()}tour.setOptions({steps:ws_tour,keyboardNavigation:true,tooltipClass:"tooltip-large",showProgress:true,showStepNumbers:true,scrollToElement:true,nextLabel:i18n_get("gui",ws_idiom,"Next"),prevLabel:i18n_get("gui",ws_idiom,"Prev."),overlayOpacity:"0.2"});tour.onbeforechange((function(){ws_tour[this._currentStep].do_before()}));tour.onexit((function(){$("#help1").modal("hide");wsweb_dialog_close("examples");wsweb_dialog_close("config");if(get_cfg("ws_mode")!="ep"){wsweb_select_main("ep")}return true}));tour.start();ga("send","event","ui","ui.tour","ui.tour.newbie")}function wepsim_newbie_tour_setLang(lang){var step="";for(var i=0;iStep 1",step:"step1",position:"auto",do_before:function(){tour.refresh();return true}});ws_tour.push({title:"WepSIM",element:"#select4",intro:"Step 2",step:"step2",position:"auto",do_before:function(){wsweb_select_main("ep");tour.refresh();return true}});ws_tour.push({title:"WepSIM",element:"#btn_help1",intro:"Step 3",step:"step3",position:"auto",do_before:function(){tour.refresh();return true}});ws_tour.push({title:"WepSIM",element:"#btn_example1",intro:"Step 4",step:"step4",position:"auto",do_before:function(){tour.refresh();return true}});ws_tour.push({title:"WepSIM",element:"#btn_cfg1",intro:"Step 5",step:"step5",position:"auto",do_before:function(){tour.refresh();return true}});ws_tour.push({title:"WepSIM",intro:"Step 6",step:"step6",position:"auto",do_before:function(){tour.refresh();return true}});function wepsim_voice_init(){if(!annyang){return false}annyang.addCommands(wepsim_voice_commands);annyang.addCallback("errorNetwork",(function(){annyang.abort();alert("Sorry but some network connection is needed in order to use the voice recognition engine.")}));SpeechKITT.annyang();SpeechKITT.setStylesheet("external/speechkitt/themes/flat.css");SpeechKITT.setInstructionsText("What can I help you with? (list)");SpeechKITT.vroom();return true}function wepsim_voice_start(){if(!annyang){wepsim_notify_error("

    Warning:
    "+"annyang not available"+"

    ","Voice support is not available in this platform.");return false}SpeechKITT.show();return true}function wepsim_voice_stop(){if(!annyang){return false}SpeechKITT.hide();return true}var wepsim_voice_commands={};var wepsim_voice_dialog=null;wepsim_voice_commands["hello"]=function(){var msg="Hello, I am WepSIM, nice to meet you. ";simcore_voice_speak(msg)};wepsim_voice_commands["(show) configuration"]=function(){wsweb_dialog_open("config")};wepsim_voice_commands["(show) examples"]=function(){wsweb_dialog_open("examples")};wepsim_voice_commands["load example :id (from) :level"]=function(id,level){var ex_id=parseInt(id);var ex_lv=parseInt(level);load_from_example_firmware("ep:s"+ex_lv+"_e"+ex_lv,true)};wepsim_voice_commands["(show) help"]=function(){wsweb_dialog_open("help");wepsim_help_refresh()};wepsim_voice_commands["close"]=function(){wsweb_dialog_close("help");wsweb_dialog_close("config");wsweb_dialog_close("examples");if(null!==wepsim_voice_dialog){wepsim_voice_dialog.modal("hide")}};wepsim_voice_commands["reset"]=function(){wepsim_execute_reset(true,true);var msg="Current processor has been reset.";simcore_voice_speak(msg)};wepsim_voice_commands["next"]=function(){wepsim_execute_instruction();var msg="Next executed.";simcore_voice_speak(msg)};wepsim_voice_commands["next micro(instruction)"]=function(){wepsim_execute_microinstruction();var msg="Next microinstruction executed. ";simcore_voice_speak(msg)};wepsim_voice_commands["play"]=function(){wepsim_execute_play()};wepsim_voice_commands["stop"]=function(){wepsim_execute_stop()};wepsim_voice_commands["describe micro(instruction)"]=function(){var msg=get_verbal_from_current_mpc();simcore_voice_speak(msg)};wepsim_voice_commands["describe instruction"]=function(){var msg=get_verbal_from_current_pc();simcore_voice_speak(msg)};wepsim_voice_commands["list"]=function(){var vc_list="available commands:
    ";for(var vc in wepsim_voice_commands){vc_list=vc_list+" * '"+vc+"'
    "}wepsim_voice_dialog=bootbox.alert(vc_list);wepsim_voice_dialog.modal("show");var msg=$("

    ").html(vc_list).text();simcore_voice_speak(msg)};wepsim_voice_commands["silence"]=function(){simcore_voice_stopSpeak()};var breakpoint_icon_list={classic:{type:"classic",addclass:"no-dark-mode",origin:"https://www.optikunde.de/farbe/rot.php"},pushpin:{type:"classic",addclass:"no-dark-mode",origin:"http://clipart-library.com/red-push-pin.html"},cat1:{type:"pets",addclass:"no-dark-mode",origin:""},dog1:{type:"pets",addclass:"no-dark-mode",origin:""},halloween1:{type:"halloween",addclass:"no-dark-mode",origin:"https://es.vexels.com/svg-png/halloween/"},halloween2:{type:"halloween",addclass:"no-dark-mode",origin:"https://es.vexels.com/png-svg/vista-previa/153871/casa-de-halloween-de-miedo"},xmas1:{type:"christmas",addclass:"",origin:"https://week-of-icons-2018.netlify.com/data/5/animations/1.gif"},xmas2:{type:"christmas",addclass:"",origin:"https://week-of-icons-2018.netlify.com/data/5/animations/3.gif"},xmas3:{type:"christmas",addclass:"",origin:"https://peaceartsite.com/images/stained-glass-snowy-peace-t.gif"},r2d2:{type:"star wars",addclass:"",origin:"https://imgur.com/gallery/gKSmy"},sw:{type:"star wars",addclass:"",origin:"https://i2.wp.com/icons.iconarchive.com/icons/sensibleworld/starwars/1024/Death-Star-icon.png"},bb8:{type:"star wars",addclass:"no-dark-mode",origin:""},vader1:{type:"star wars",addclass:"",origin:""},ds1:{type:"star wars",addclass:"",origin:"https://media0.giphy.com/media/SVhnmDDdOzrZC/source.gif"},lotr4:{type:"lotr",addclass:"no-dark-mode",origin:"http://www.cinecollectibles.com/gentle-giant-c-1_62.html"},lotr2:{type:"lotr",addclass:"no-dark-mode",origin:"https://www.forbes.com/sites/adrianbridgwater/2016/01/15/microsoft-r-one-big-data-tool-to-rule-them-all/"},lotr6:{type:"lotr",addclass:"no-dark-mode",origin:"https://pm1.narvii.com/5903/f831ee80d012b8a8ba7156c39505cc4824889901_128.jpg"},hp1:{type:"harry potter",addclass:"no-dark-mode",origin:"http://www.logosclicks.com/logos/harry-potter-name-logo-46a93c.html"},hp2:{type:"harry potter",addclass:"no-dark-mode",origin:"https://www.flaticon.com/free-icon/harry-potter_86485"},hp3:{type:"harry potter",addclass:"no-dark-mode",origin:"https://lafrikileria.com/es/cosas-de-harry-potter-regalos/20569-funko-pop-patronus-harry-potter-889698469944.html"},super:{type:"films",addclass:"no-dark-mode",origin:"https://worldvectorlogo.com/logo/superman-3"},batman:{type:"films",addclass:"",origin:"http://getwallpapers.com/collection/black-and-white-batman-wallpaper"},grail:{type:"films",addclass:"no-dark-mode",origin:"http://3png.com/a-31243892.html"},despicable:{type:"films",addclass:"no-dark-mode",origin:"https://www.helloforos.com/t/cerrado/350821/81"},t800b:{type:"films",addclass:"no-dark-mode",origin:"https://www.pngegg.com/en/png-buhsk"},t1000a:{type:"films",addclass:"no-dark-mode",origin:"https://i0.pngocean.com/files/328/174/569/the-terminator-sticker-t-1000-telegram-world-of-tanks-suren-mnatsakanyan-street.jpg"}};function sim_core_breakpointicon_get(icon_name){var icon_obj=null;icon_obj=breakpoint_icon_list[icon_name];if(typeof icon_obj==="undefined"){icon_name="classic";icon_obj=breakpoint_icon_list[icon_name]}return"stop icon"} \ No newline at end of file diff --git a/ws_dist/min.wepsim_node.js b/ws_dist/min.wepsim_node.js index d60fd7165..b57447257 100644 --- a/ws_dist/min.wepsim_node.js +++ b/ws_dist/min.wepsim_node.js @@ -1,5 +1,5 @@ class HTMLElement { } -var sim={systems:[],active:null,index:0};function simhw_add(newElto){var found=-1;for(var m=0;m=0&&sim.systems.length>=newActive){sim.active=sim.systems[newActive];sim.index=newActive}compile_behaviors();firedep_to_fireorder(jit_fire_dep);compute_references();compile_verbals()}function simhw_getIdByName(short_name){for(var m=0;m>>0).toString(16)}function check_behavior(){if(0==simhw_sim_signals().length){ws_alert("ALERT: empty signals!!!")}if(0==simhw_sim_states().length){ws_alert("ALERT: empty states!!!")}for(var key in simhw_sim_signals()){for(var key2 in simhw_sim_signal(key).behavior){var behaviors=simhw_sim_signal(key).behavior[key2].split(";");for(var i=0;i "+behavior_k[0]+" ("+behavior_i+")");return}if(behavior_k.length!=simhw_syntax_behavior(behavior_k[0]).nparameters){ws_alert("ALERT: Behavior has an incorrect number of elements --\x3e "+behavior_i+"/"+simhw_syntax_behavior(behavior_k[0]).nparameters);return}for(var j=1;j '"+behavior_i);return}else if("S"==t&&typeof simhw_sim_signal(s[0])=="undefined"){ws_alert("ALERT: Behavior has an undefined reference to a signal -> '"+behavior_i);return}else if("X"==t&&typeof simhw_sim_state(s[0])=="undefined"&&typeof simhw_sim_signal(s[0])=="undefined"){ws_alert("ALERT: Behavior has an undefined reference to a object state OR signal -> '"+behavior_i);return}}}}}}var jit_behaviors=false;var jit_verbals=false;var jit_fire_dep=null;var jit_fire_order=null;var jit_dep_network=null;var jit_fire_ndep=null;function firedep_to_fireorder(jit_fire_dep){var allfireto=false;jit_fire_order=[];jit_fire_ndep=[];for(var sig in simhw_sim_signals()){if(typeof jit_fire_dep[sig]=="undefined"){jit_fire_order.push(sig);continue}ndep=0;allfireto=false;for(var sigorg in jit_fire_dep[sig]){ndep++;if(jit_fire_dep[sig][sigorg]==simhw_sim_signal(sigorg).behavior.length){allfireto=true}}jit_fire_ndep[sig]=ndep;if(allfireto==false)jit_fire_order.push(sig)}}function compile_behaviors(){var jit_bes="";jit_fire_dep={};var sig_obj=null;var expr_obj=null;for(var sig in simhw_sim_signals()){jit_bes+="simhw_sim_signal('"+sig+"').behavior_fn = new Array();\n";for(var val in simhw_sim_signal(sig).behavior){var input_behavior=simhw_sim_signal(sig).behavior[val];var jit_be="";var s_exprs=input_behavior.split(";");for(var i=0;i>>0;if(value!=0){vec.CPU["R"+i]={type:"register",default_value:0,id:"R"+i,op:"=",value:"0x"+value.toString(16)}}}for(i=0;i>>0;if(value!=0){vec.CPU[internal_reg[i]]={type:"register",default_value:0,id:internal_reg[i],op:"=",value:"0x"+value.toString(16)}}}return vec},read_state:function(vec,check){if(typeof vec.CPU=="undefined"){vec.CPU={}}var key=check["id"].toUpperCase().trim();var val=parseInt(check["value"]).toString(16);if("REGISTER"==check["type"].toUpperCase().trim()){vec.CPU[key]={type:"register",default_value:0,id:key,op:check["condition"],value:"0x"+val};return true}return false},get_state:function(reg){var r_reg=reg.toUpperCase().trim();if(typeof sim.ep.states["REG_"+r_reg]!="undefined"){var value=get_value(sim.ep.states["REG_"+r_reg])>>>0;return"0x"+value.toString(16)}r_reg=r_reg.replace("R","");var index=parseInt(r_reg);if(typeof sim.ep.states.BR[index]!="undefined"){var value=get_value(sim.ep.states.BR[index])>>>0;return"0x"+value.toString(16)}return null},get_value:function(elto){if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index))return get_value(simhw_sim_state(elto))>>>0;return get_value(simhw_sim_states().BR[index])>>>0},set_value:function(elto,value){var pc_name=simhw_sim_ctrlStates_get().pc.state;if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index)){set_value(simhw_sim_state(elto),value);if(pc_name===elto){show_asmdbg_pc()}return value}return set_value(simhw_sim_states().BR[index],value)}};sim.ep.ctrl_states.pc={name:"PC",state:"REG_PC",is_pointer:true};sim.ep.ctrl_states.sp={name:"SP",state:"BR.29",is_pointer:true};sim.ep.ctrl_states.fp={name:"FP",state:"BR.30",is_pointer:true};sim.ep.ctrl_states.ir={name:"IR",state:"REG_IR",default_eltos:{co:{begin:0,end:5,length:6},cop:{begin:28,end:31,length:4}},is_pointer:false};sim.ep.ctrl_states.mpc={name:"mPC",state:"REG_MICROADDR",is_pointer:false};sim.ep.internal_states.MC={};sim.ep.internal_states.ROM={};sim.ep.internal_states.FIRMWARE={};sim.ep.internal_states.io_hash={};sim.ep.internal_states.fire_stack=[];sim.ep.internal_states.tri_state_names=["T1","T2","T3","T4","T5","T6","T7","T8","T9","T10","T11"];sim.ep.internal_states.fire_visible={databus:false,internalbus:false};sim.ep.internal_states.filter_states=["REG_IR_DECO,col-12","REG_IR,col-auto","REG_PC,col-auto","REG_MAR,col-auto","REG_MBR,col-auto","REG_RT1,col-auto","REG_RT2,col-auto","REG_RT3,col-auto","REG_SR,col-auto","REG_MICROADDR,col-auto"];sim.ep.internal_states.filter_signals=["A0,0","B,0","C,0","SELA,5","SELB,5","SELC,2","SELCOP,0","MR,0","MC,0","C0,0","C1,0","C2,0","C3,0","C4,0","C5,0","C6,0","C7,0","T1,0","T2,0","T3,0","T4,0","T5,0","T6,0","T7,0","T8,0","T9,0","T10,0","T11,0","M1,0","M2,0","M7,0","MA,0","MB,0","SELP,0","LC,0","SE,0","SIZE,0","OFFSET,0","BW,0","R,0","W,0","TA,0","TD,0","IOR,0","IOW,0","TEST_I,0","TEST_U,0"];sim.ep.internal_states.alu_flags={flag_n:0,flag_z:0,flag_v:0,flag_c:0};sim.ep.states.BR=[];sim.ep.states.BR[0]={name:"R0",verbal:"Register 0",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[1]={name:"R1",verbal:"Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[2]={name:"R2",verbal:"Register 2",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[3]={name:"R3",verbal:"Register 3",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[4]={name:"R4",verbal:"Register 4",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[5]={name:"R5",verbal:"Register 5",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[6]={name:"R6",verbal:"Register 6",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[7]={name:"R7",verbal:"Register 7",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[8]={name:"R8",verbal:"Register 8",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[9]={name:"R9",verbal:"Register 9",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[10]={name:"R10",verbal:"Register 10",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[11]={name:"R11",verbal:"Register 11",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[12]={name:"R12",verbal:"Register 12",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[13]={name:"R13",verbal:"Register 13",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[14]={name:"R14",verbal:"Register 14",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[15]={name:"R15",verbal:"Register 15",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[16]={name:"R16",verbal:"Register 16",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[17]={name:"R17",verbal:"Register 17",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[18]={name:"R18",verbal:"Register 18",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[19]={name:"R19",verbal:"Register 19",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[20]={name:"R20",verbal:"Register 20",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[21]={name:"R21",verbal:"Register 21",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[22]={name:"R22",verbal:"Register 22",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[23]={name:"R23",verbal:"Register 23",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[24]={name:"R24",verbal:"Register 24",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[25]={name:"R25",verbal:"Register 25",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[26]={name:"R26",verbal:"Register 26",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[27]={name:"R27",verbal:"Register 27",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[28]={name:"R28",verbal:"Register 28",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[29]={name:"R29",verbal:"Register 29",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[30]={name:"R30",verbal:"Register 30",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.BR[31]={name:"R31",verbal:"Register 31",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_PC"]={name:"PC",verbal:"Program Counter Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MAR"]={name:"MAR",verbal:"Memory Address Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MBR"]={name:"MBR",verbal:"Memory Data Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_IR"]={name:"IR",verbal:"Instruction Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT1"]={name:"RT1",verbal:"Temporal 1 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT2"]={name:"RT2",verbal:"Temporal 2 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_RT3"]={name:"RT3",verbal:"Temporal 3 Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_SR"]={name:"SR",verbal:"State Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_IB"]={name:"I_BUS",verbal:"Internal Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_AB"]={name:"A_BUS",verbal:"Address Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_CB"]={name:"C_BUS",verbal:"Control Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BUS_DB"]={name:"D_BUS",verbal:"Data Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["C2_T2"]={name:"C2_T2",verbal:"Output of PC",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["RA_T9"]={name:"RA_T9",verbal:"Input of T9 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["RB_T10"]={name:"RB_T10",verbal:"Input of T10 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["SELEC_T3"]={name:"SELEC_T3",verbal:"Input of T3 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["SELP_M7"]={name:"SELP_M7",verbal:"Output of MUX SelP",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["ALU_C6"]={name:"ALU_C6",verbal:"Input of Temporal 3 Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["MA_ALU"]={name:"MA_ALU",verbal:"Input ALU via MA",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["MB_ALU"]={name:"MB_ALU",verbal:"Input ALU via MB",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_C"]={name:"FLAG_C",verbal:"Carry Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_V"]={name:"FLAG_V",verbal:"Overflow Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_N"]={name:"FLAG_N",verbal:"Negative Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_Z"]={name:"FLAG_Z",verbal:"Zero Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_I"]={name:"FLAG_I",verbal:"Interruption Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["FLAG_U"]={name:"FLAG_U",verbal:"User Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["REG_MICROADDR"]={name:"µADDR",verbal:"Microaddress Register",visible:true,nbits:"12",value:0,default_value:0,draw_data:["svg_cu:text4667"]};sim.ep.states["REG_MICROINS"]={name:"µINS",verbal:"Microinstruction Register",visible:true,nbits:"77",value:{},default_value:{},draw_data:[]};sim.ep.states["FETCH"]={name:"FETCH",verbal:"Input Fetch",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["ROM_MUXA"]={name:"ROM_MUXA",verbal:"Input ROM",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["SUM_ONE"]={name:"SUM_ONE",verbal:"Input next microinstruction",visible:false,nbits:"12",value:1,default_value:1,draw_data:[]};sim.ep.states["MUXA_MICROADDR"]={name:"MUXA_MICROADDR",verbal:"Input microaddress",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.ep.states["MUXC_MUXB"]={name:"MUXC_MUXB",verbal:"Output of MUX C",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["INEX"]={name:"INEX",verbal:"Illegal Instruction Exception",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["BS_M1"]={name:"BS_M1",verbal:"from Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["BS_TD"]={name:"BS_TD",verbal:"Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["INTV"]={name:"INTV",verbal:"Interruption Vector",visible:false,nbits:"8",value:0,default_value:0,draw_data:[]};sim.ep.states["M2_C2"]={name:"M2_C2",verbal:"Input of Program Counter",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["M1_C1"]={name:"M1_C1",verbal:"Input of Memory Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["M7_C7"]={name:"M7_C7",verbal:"Input of State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["VAL_ZERO"]={name:"VAL_ZERO",verbal:"Wired Zero",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.ep.states["VAL_ONE"]={name:"VAL_ONE",verbal:"Wired One",visible:false,nbits:"32",value:1,default_value:1,draw_data:[]};sim.ep.states["VAL_FOUR"]={name:"VAL_FOUR",verbal:"Wired Four",visible:false,nbits:"32",value:4,default_value:4,draw_data:[]};sim.ep.states["REG_IR_DECO"]={name:"IR_DECO",verbal:"Instruction Decoded",visible:true,nbits:"0",value:0,default_value:0,draw_data:[]};sim.ep.states["DECO_INS"]={name:"DECO_INS",verbal:"Instruction decoded in binary",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["CLK"]={name:"CLK",verbal:"Clock",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states["ACC_TIME"]={name:"ACC_TIME",verbal:"Accumulated CPU time",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals["C"]={name:"C",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["MV MUXC_MUXB VAL_ZERO; FIRE B","MBIT MUXC_MUXB INT 0 1; FIRE B","MBIT MUXC_MUXB IORDY 0 1; FIRE B","MBIT MUXC_MUXB MRDY 0 1; FIRE B","MBIT MUXC_MUXB REG_SR 0 1; FIRE B","MBIT MUXC_MUXB REG_SR 1 1; FIRE B","MBIT MUXC_MUXB REG_SR 28 1; FIRE B","MBIT MUXC_MUXB REG_SR 29 1; FIRE B","MBIT MUXC_MUXB REG_SR 30 1; FIRE B","MBIT MUXC_MUXB REG_SR 31 1; FIRE B","MV MUXC_MUXB INEX; FIRE B"],fire_name:["svg_cu:text3410"],draw_data:[["svg_cu:path3108"],["svg_cu:path3062"],["svg_cu:path3060"],["svg_cu:path3136"],["svg_cu:path3482"],["svg_cu:path3480"],["svg_cu:path3488"],["svg_cu:path3486"],["svg_cu:path3484"],["svg_cu:path3484-9"],["svg_cu:path3108-3","svg_cu:path3260-3-8-6","svg_cu:path3260-3-8","svg_cu:path3260-3"]],draw_name:[["svg_cu:path3496","svg_cu:path3414","svg_cu:path3194-08"]]};sim.ep.signals["B"]={name:"B",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV A1 MUXC_MUXB; FIRE A1","NOT_ES A1 MUXC_MUXB; FIRE A1"],depends_on:["CLK"],fire_name:["svg_cu:text3408"],draw_data:[["svg_cu:path3094-7"],["svg_cu:path3392","svg_cu:path3372","svg_cu:path3390","svg_cu:path3384","svg_cu:path3108-1","svg_cu:path3100-8-7"]],draw_name:[[],["svg_cu:path3194-0","svg_cu:path3138-8","svg_cu:path3498-6"]]};sim.ep.signals["A0"]={name:"A0",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 1; FIRE A0A1","SBIT_SIGNAL A0A1 1 1; FIRE A0A1"],depends_on:["CLK"],fire_name:["svg_cu:text3406"],draw_data:[["svg_cu:path3096"],["svg_cu:path3096"]],draw_name:[[],["svg_cu:path3138-8-1","svg_cu:path3098-2","svg_cu:path3124-2-5"]]};sim.ep.signals["A1"]={name:"A1",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 0; FIRE A0A1","SBIT_SIGNAL A0A1 1 0; FIRE A0A1"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3094"],["svg_cu:path3094"]],draw_name:[[]]};sim.ep.signals["A0A1"]={name:"A0A1",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["PLUS1 MUXA_MICROADDR REG_MICROADDR","CP_FIELD MUXA_MICROADDR REG_MICROINS/MADDR","MV MUXA_MICROADDR ROM_MUXA","MV MUXA_MICROADDR FETCH"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3102","svg_cu:path3100","svg_cu:path3098","svg_cu:path3100-9","svg_cu:path3088"],["svg_cu:path3104","svg_cu:path3134","svg_cu:path3500","svg_cu:path3416"],["svg_cu:path3504","svg_cu:path3100-8","svg_cu:path3234-9"],["svg_cu:path3124"]],draw_name:[[]]};sim.ep.signals["C0"]={name:"C0",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_MAR BUS_IB"],fire_name:["svg_p:text3077"],draw_data:[["svg_p:path3081"]],draw_name:[["svg_p:path3075"]]};sim.ep.signals["C1"]={name:"C1",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_MBR M1_C1"],fire_name:["svg_p:text3079"],draw_data:[["svg_p:path3055"]],draw_name:[["svg_p:path3073"]]};sim.ep.signals["C2"]={name:"C2",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_PC M2_C2; UPDATEDPC"],fire_name:["svg_p:text3179"],draw_data:[["svg_p:path3485"]],draw_name:[["svg_p:path3177"]]};sim.ep.signals["C3"]={name:"C3",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_IR BUS_IB; DECO; FIRE_IFSET C 10"],fire_name:["svg_p:text3439"],draw_data:[["svg_p:path3339"]],draw_name:[["svg_p:path3337"]]};sim.ep.signals["C4"]={name:"C4",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT1 BUS_IB"],fire_name:["svg_p:text3441"],draw_data:[["svg_p:path3263"]],draw_name:[["svg_p:path3255"]]};sim.ep.signals["C5"]={name:"C5",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT2 BUS_IB"],fire_name:["svg_p:text3443"],draw_data:[["svg_p:path3277"]],draw_name:[["svg_p:path3269"]]};sim.ep.signals["C6"]={name:"C6",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_RT3 ALU_C6"],fire_name:["svg_p:text3445"],draw_data:[["svg_p:path3325","svg_p:path3323"]],draw_name:[["svg_p:path3245"]]};sim.ep.signals["C7"]={name:"C7",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","LOAD REG_SR M7_C7; FIRE C"],fire_name:["svg_p:text3655"],draw_data:[["svg_p:path3651-9"]],draw_name:[["svg_p:path3681"]]};sim.ep.signals["TA"]={name:"TA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_AB REG_MAR; MOVE_BITSE A1A0 0 2 BUS_AB 0; FIRE_IFCHANGED A1A0 A1A0"],fire_name:["svg_p:text3091"],draw_data:[["svg_p:path3089","svg_p:path3597","svg_p:path3513","svg_p:path3601","svg_p:path3601-2","svg_p:path3187","svg_p:path3087","svg_p:path2995","svg_p:path3535"]],draw_name:[["svg_p:path3085"]]};sim.ep.signals["TD"]={name:"TD",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_DB BS_TD; MOVE_BITSE A1A0 0 2 BUS_AB 0; FIRE_IFCHANGED A1A0 A1A0"],fire_name:["svg_p:text3103"],draw_data:[["svg_p:path3101","svg_p:path3587","svg_p:path3515","svg_p:path3071","svg_p:path3419","svg_p:path3099","svg_p:path3097","svg_p:path3559-5","svg_p:path3419-1-0","svg_p:path3583","svg_p:path3419-1","svg_p:path3491","svg_p:path3641","svg_p:path3541"]],draw_name:[["svg_p:path3095"]]};sim.ep.signals["T1"]={name:"T1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_MBR; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3105"],draw_data:[["svg_p:path3071","svg_p:path3069","svg_p:path3049","svg_p:path3063-9","svg_p:path3071","svg_p:path3071"]],draw_name:[["svg_p:path3067"]]};sim.ep.signals["T2"]={name:"T2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_PC; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3449"],draw_data:[["svg_p:path3199","svg_p:path3201","svg_p:path3049"]],draw_name:[["svg_p:path3329"]]};sim.ep.signals["T3"]={name:"T3",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB SELEC_T3; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3451"],draw_data:[["svg_p:path3349","svg_p:path3931","svg_p:path3345","svg_p:path3049"]],draw_name:[["svg_p:path3351"]]};sim.ep.signals["T4"]={name:"T4",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT1; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3453"],draw_data:[["svg_p:path3261","svg_p:path3259","svg_p:path3049"]],draw_name:[["svg_p:path3305"]]};sim.ep.signals["T5"]={name:"T5",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT2; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3455"],draw_data:[["svg_p:path3275","svg_p:path3273","svg_p:path3049"]],draw_name:[["svg_p:path3307"]]};sim.ep.signals["T6"]={name:"T6",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB ALU_C6; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3457"],draw_data:[["svg_p:path3589","svg_p:path3317","svg_p:path3163-2","svg_p:path3049"]],draw_name:[["svg_p:path3319"]]};sim.ep.signals["T7"]={name:"T7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_RT3; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3459"],draw_data:[["svg_p:path3327","svg_p:path3311","svg_p:path3049"]],draw_name:[["svg_p:path3313"]]};sim.ep.signals["T8"]={name:"T8",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_SR; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3657"],draw_data:[["svg_p:path3651","svg_p:path3647","svg_p:path3049"]],draw_name:[["svg_p:path3649"]]};sim.ep.signals["T9"]={name:"T9",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RA_T9; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3147"],draw_data:[["svg_p:path3143","svg_p:path3139","svg_p:path3049","svg_p:path3143-9"]],draw_name:[["svg_p:path3133"]]};sim.ep.signals["T10"]={name:"T10",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RB_T10; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3149"],draw_data:[["svg_p:path3145","svg_p:path3141","svg_p:path3049","svg_p:path3145-5"]],draw_name:[["svg_p:path3137"]]};sim.ep.signals["T11"]={name:"T11",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","CP_FIELD BUS_IB REG_MICROINS/EXCODE; FIRE M7; FIRE M2; FIRE M1"],fire_name:["svg_p:text3147-5","svg_cu:tspan4426"],draw_data:[["svg_p:path3145","svg_p:path3081-3","svg_p:path3139-7","svg_p:path3049","svg_cu:path3081-3","svg_cu:path3139-7","svg_cu:path3502"]],draw_name:[["svg_p:path3133-6","svg_cu:path3133-6"]]};sim.ep.signals["M1"]={name:"M1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M1_C1 BUS_IB","MV M1_C1 BS_M1"],depends_on:["C1"],fire_name:["svg_p:text3469"],draw_data:[["svg_p:path3063","svg_p:path3061","svg_p:path3059"],["svg_p:path3057","svg_p:path3641","svg_p:path3419","svg_p:path3583"]],draw_name:[[],["svg_p:path3447"]]};sim.ep.signals["M2"]={name:"M2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M2_C2 BUS_IB","PLUS4 M2_C2 REG_PC"],depends_on:["C2"],fire_name:["svg_p:text3471"],draw_data:[["svg_p:path3217","svg_p:path3215","svg_p:path3213","svg_p:path3213-9"],["svg_p:path3211","svg_p:path3209","svg_p:path3193","svg_p:path3207","svg_p:path3197","svg_p:path3201"]],draw_name:[[],["svg_p:path3467","svg_p:path3467"]]};sim.ep.signals["M7"]={name:"M7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M7_C7 BUS_IB","MV M7_C7 SELP_M7"],depends_on:["C7"],fire_name:["svg_p:text3673"],draw_data:[["svg_p:path3691","svg_p:path3693","svg_p:path3659"],["svg_p:path3695"]],draw_name:[[],["svg_p:path3667"]]};sim.ep.signals["MA"]={name:"MA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MA_ALU RA_T9; FIRE COP","MV MA_ALU REG_RT1; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3463"],draw_data:[["svg_p:path3249","svg_p:path3161","svg_p:path3165"],["svg_p:path3279"]],draw_name:[[],["svg_p:path3423"]]};sim.ep.signals["MB"]={name:"MB",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MV MB_ALU RB_T10; FIRE COP","MV MB_ALU REG_RT2; FIRE COP","MV MB_ALU VAL_FOUR; FIRE COP","MV MB_ALU VAL_ONE; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3465"],draw_data:[["svg_p:path3281","svg_p:path3171","svg_p:path3169"],["svg_p:path3283"],["svg_p:path3295","svg_p:path3293"],["svg_p:path3297","svg_p:path3299"]],draw_name:[[],["svg_p:path3425","svg_p:path3427"]]};sim.ep.signals["COP"]={name:"COP",visible:true,type:"L",value:0,default_value:0,nbits:"4",forbidden:true,behavior:["NOP_ALU; UPDATE_NZVC","AND ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","OR ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","NOT ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","XOR ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SRL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SRA ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","RR ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","RL ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","ADD ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","SUB ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","MUL ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","DIV ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","MOD ALU_C6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3","LUI ALU_C6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET SELP 3"],depends_on:["SELCOP"],fire_name:["svg_p:text3303"],draw_data:[["svg_p:path3237","svg_p:path3239","svg_p:path3261-8","svg_p:path3321","svg_p:path3901-6","svg_p:path3317-9"]],draw_name:[["svg_p:path3009","svg_p:path3301"]]};sim.ep.signals["SELP"]={name:"SELP",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["NOP","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_U 0; FIRE M7","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_I 1; FIRE M7","MV SELP_M7 REG_SR; UPDATE_FLAG SELP_M7 FLAG_C 31; UPDATE_FLAG SELP_M7 FLAG_V 30; UPDATE_FLAG SELP_M7 FLAG_N 29; UPDATE_FLAG SELP_M7 FLAG_Z 28; FIRE M7"],fire_name:["svg_p:text3703"],draw_data:[[],["svg_p:path3643"],["svg_p:path3705"],["svg_p:path3675","svg_p:path3331"]],draw_name:[[],["svg_p:path3697"]]};sim.ep.signals["SELA"]={name:"SELA",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RA"],depends_on:["RA"],fire_name:["svg_cu:text3164"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELB"]={name:"SELB",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RB"],depends_on:["RB"],fire_name:["svg_cu:text3168"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELC"]={name:"SELC",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE MR_RC"],depends_on:["RC"],fire_name:["svg_cu:text3172"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["SELCOP"]={name:"SELCOP",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE MC"],depends_on:["COP"],fire_name:["svg_cu:text3312"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["EXCODE"]={name:"EXCODE",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE T11"],fire_name:["svg_cu:text3312-6"],draw_data:[[]],draw_name:[[]]};sim.ep.signals["RA"]={name:"RA",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["GET RA_T9 BR RA; FIRE_IFSET T9 1; FIRE_IFSET MA 0"],depends_on:["SELA"],fire_name:["svg_p:text3107"],draw_data:[[]],draw_name:[["svg_p:path3109"]]};sim.ep.signals["RB"]={name:"RB",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["GET RB_T10 BR RB; FIRE_IFSET T10 1; FIRE_IFSET MB 0"],depends_on:["SELB"],fire_name:["svg_p:text3123"],draw_data:[[]],draw_name:[["svg_p:path3113"]]};sim.ep.signals["RC"]={name:"RC",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["FIRE LC"],depends_on:["SELC"],fire_name:["svg_p:text3125"],draw_data:[[]],draw_name:[["svg_p:path3117"]]};sim.ep.signals["LC"]={name:"LC",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","SET BR RC BUS_IB"],fire_name:["svg_p:text3127"],draw_data:[["svg_p:path3153","svg_p:path3151","svg_p:path3129"]],draw_name:[["svg_p:path3121"]]};sim.ep.signals["SE"]={name:"SE",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3; MOVE_BITS SBWA 4 1 SE; FIRE_IFCHANGED SBWA SE","MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3; MOVE_BITS SBWA 4 1 SE; FIRE_IFCHANGED SBWA SE"],depends_on:["T3"],fire_name:["svg_p:text3593","svg_p:text3431"],draw_data:[[]],draw_name:[["svg_p:path3591","svg_p:path3447-7-7"]]};sim.ep.signals["SIZE"]={name:"SIZE",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3363"],draw_data:[[]],draw_name:[["svg_p:path3355"]]};sim.ep.signals["OFFSET"]={name:"OFFSET",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_IR OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3707"],draw_data:[[]],draw_name:[["svg_p:path3359"]]};sim.ep.signals["MC"]={name:"MC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT COP REG_IR 0 4; FIRE COP;","CP_FIELD COP REG_MICROINS/SELCOP; FIRE COP;"],depends_on:["SELCOP"],fire_name:["svg_cu:text3322","svg_cu:text3172-1-5"],draw_data:[["svg_cu:path3320","svg_cu:path3142"],["svg_cu:path3318","svg_cu:path3502-6","svg_cu:path3232-6"]],draw_name:[[],["svg_cu:path3306"]]};sim.ep.signals["MR"]={name:"MR",verbal:["Copy from IR[SelA], from IR[SelB], and from IR[SelB] into RA, RB, and RC. ","Copy SelA, SelB, and SelB into RA, RB, and RC. "],visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MR_RA MR; FIRE MR_RA; MV MR_RB MR; FIRE MR_RB; MV MR_RC MR; FIRE MR_RC;","MV MR_RA MR; FIRE MR_RA; MV MR_RB MR; FIRE MR_RB; MV MR_RC MR; FIRE MR_RC;"],depends_on:["SELA","SELB","SELC"],fire_name:["svg_cu:text3222","svg_cu:text3242","svg_cu:text3254","svg_cu:text3172-1"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3260","svg_cu:path3196","svg_cu:path3278","svg_cu:path3232","svg_cu:path3292"],["svg_cu:path3270","svg_cu:path3282","svg_cu:path3300","svg_cu:path3258","svg_cu:path3260","svg_cu:path3258-4","svg_cu:path3278","svg_cu:path3196","svg_cu:path3294","svg_cu:path3292","svg_cu:path3288","svg_cu:path3232","svg_cu:path3280"]],draw_name:[[],["svg_cu:path3220","svg_cu:path3240","svg_cu:path3252"]]};sim.ep.signals["MR_RA"]={name:"MR_RA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RA REG_IR REG_MICROINS/SELA 5; FIRE RA;","CP_FIELD RA REG_MICROINS/SELA; FIRE RA;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["MR_RB"]={name:"MR_RB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RB REG_IR REG_MICROINS/SELB 5; FIRE RB;","CP_FIELD RB REG_MICROINS/SELB; FIRE RB;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["MR_RC"]={name:"MR_RC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RC REG_IR REG_MICROINS/SELC 5; FIRE RC;","CP_FIELD RC REG_MICROINS/SELC; FIRE RC;"],fire_name:[],draw_data:[[]],draw_name:[[]]};sim.ep.signals["BW"]={name:"BW",verbal:["Select one byte (based on A1A0) from Word. ","Select two bytes (one Half Word based on A1A0) from Word. ","","Select the full Word. "],visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW","MOVE_BITS BWA 2 2 BW; MOVE_BITS SBWA 2 2 BW; FIRE_IFCHANGED BWA BW; FIRE SBWA; RESET_CHANGED BW"],fire_name:["svg_p:text3433"],draw_data:[["svg_p:path3061-2-6","svg_p:path3101-8","svg_p:path3535-8"]],draw_name:[[],[]]};sim.ep.signals["A1A0"]={name:"A1A0",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA","MOVE_BITS BWA 0 2 A1A0; MOVE_BITS SBWA 0 2 A1A0; FIRE BWA; FIRE SBWA"],fire_name:["svg_p:text3603"],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["BWA"]={name:"BWA",visible:false,type:"L",value:0,default_value:0,nbits:"4",behavior:["BSEL BS_TD 0 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 8 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 24 8 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 0 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","BSEL BS_TD 16 16 REG_MBR 0; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W","MV BS_TD REG_MBR; FIRE TD; FIRE R; FIRE W"],fire_name:["svg_p:text3533-5"],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["SBWA"]={name:"SBWA",visible:false,type:"L",value:0,default_value:0,nbits:"5",behavior:["BSEL BS_M1 0 8 BUS_DB 0; FIRE M1","BSEL BS_M1 0 8 BUS_DB 8; FIRE M1","BSEL BS_M1 0 8 BUS_DB 16; FIRE M1","BSEL BS_M1 0 8 BUS_DB 24; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","BSEL BS_M1 0 8 BUS_DB 0; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 8; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 16; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 8 BUS_DB 24; EXT_SIG BS_M1 7; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 0; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","BSEL BS_M1 0 16 BUS_DB 16; EXT_SIG BS_M1 15; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1","MV BS_M1 BUS_DB; FIRE M1"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["IOR"]={name:"IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS KBD_IOR 0 1 IOR; MOVE_BITS SCR_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE KBD_IOR; FIRE SCR_IOR; FIRE L3D_IOR"],fire_name:["svg_p:text3715"],draw_data:[[],["svg_p:path3733","svg_p:path3491","svg_p:text3715"]],draw_name:[[],[]]};sim.ep.signals["IOW"]={name:"IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW"],fire_name:["svg_p:text3717"],draw_data:[[],["svg_p:path3735","svg_p:path3491","svg_p:text3717"]],draw_name:[[],[]]};sim.ep.signals["I"]={name:"I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_I VAL_ONE; FIRE_IFSET SELP 2"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["U"]={name:"U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_U VAL_ONE; FIRE_IFSET SELP 2"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals["TEST_C"]={name:"TEST_C",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_C VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_C VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3"],draw_data:[["svg_p:text3701-3"]],draw_name:[[]]};sim.ep.signals["TEST_V"]={name:"TEST_V",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_V VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_V VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-1"],draw_data:[["svg_p:text3701-3-1"]],draw_name:[[]]};sim.ep.signals["TEST_N"]={name:"TEST_N",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_N VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_N VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-2"],draw_data:[["svg_p:text3701-3-2"]],draw_name:[[]]};sim.ep.signals["TEST_Z"]={name:"TEST_Z",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_Z VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_Z VAL_ONE; FIRE_IFSET SELP 3"],depends_on:["SELCOP","COP"],fire_name:["svg_p:text3701-3-5"],draw_data:[["svg_p:text3701-3-5"]],draw_name:[[]]};sim.ep.signals["TEST_I"]={name:"TEST_I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE_IFSET SELP 2","MV FLAG_I VAL_ONE; FIRE_IFSET SELP 2"],depends_on:["CLK"],fire_name:["svg_p:text3669"],draw_data:[["svg_p:text3669"]],draw_name:[[]]};sim.ep.signals["TEST_U"]={name:"TEST_U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE_IFSET SELP 1","MV FLAG_U VAL_ONE; FIRE_IFSET SELP 1"],depends_on:["CLK"],fire_name:["svg_p:text3669-1"],draw_data:[["svg_p:text3669-1"]],draw_name:[[]]};sim.ep.signals["TEST_INTV"]={name:"TEST_INTV",visible:true,type:"L",value:0,default_value:0,nbits:"8",forbidden:true,behavior:["MBIT INTV TEST_INTV 0 32"],depends_on:["INT"],fire_name:["svg_p:tspan4225"],draw_data:[["svg_p:path3749"]],draw_name:[[]]};sim.ep.behaviors["NOP"]={nparameters:1,operation:function(s_expr){},verbal:function(s_expr){return""}};sim.ep.behaviors["NOP_ALU"]={nparameters:1,operation:function(s_expr){sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=0;sim.ep.internal_states.alu_flags.flag_c=0;sim.ep.internal_states.alu_flags.flag_v=0},verbal:function(s_expr){return""}};sim.ep.behaviors["MV"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.ep.behaviors["LOAD"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Load from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.ep.behaviors["CP_FIELD"]={nparameters:3,types:["X","X"],operation:function(s_expr){r=s_expr[2].split("/");sim_elto_org=get_reference(r[0]);newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval!="undefined"){sim_elto_dst=get_reference(s_expr[1]);set_value(sim_elto_dst,newval)}},verbal:function(s_expr){var r=s_expr[2].split("/");var sim_elto_org=get_reference(r[0]);var newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval=="undefined")newval="<undefined>";else newval=show_value(newval);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from Field "+r[1]+" of "+show_verbal(r[0])+" to "+show_verbal(s_expr[1])+" value "+newval+". "}return show_verbal(s_expr[1])+" = "+show_verbal(r[0])+"."+r[1]+" ("+newval+"). "}};sim.ep.behaviors["NOT_ES"]={nparameters:3,types:["S","E"],operation:function(s_expr){set_value(sim.ep.signals[s_expr[1]],Math.abs(get_value(sim.ep.states[s_expr[2]])-1))},verbal:function(s_expr){var value=Math.abs(get_value(sim.ep.states[s_expr[2]])-1);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Logical NOT of "+s_expr[2]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Logical NOT "+s_expr[2]+"). "}};sim.ep.behaviors["GET"]={nparameters:4,types:["E","E","S"],operation:function(s_expr){set_value(sim.ep.states[s_expr[1]],get_value(sim.ep.states[s_expr[2]][sim.ep.signals[s_expr[3]].value]))},verbal:function(s_expr){var value=get_value(sim.ep.states[s_expr[2]][sim.ep.signals[s_expr[3]].value]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Register File "+s_expr[3]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Register File "+s_expr[3]+"). "}};sim.ep.behaviors["SET"]={nparameters:4,types:["E","S","E"],operation:function(s_expr){set_value(sim.ep.states[s_expr[1]][sim.ep.signals[s_expr[2]].value],get_value(sim.ep.states[s_expr[3]]))},verbal:function(s_expr){var value=get_value(sim.ep.states[s_expr[3]]);var o_ref=sim.ep.states[s_expr[1]][sim.ep.signals[s_expr[2]].value];var o_verbal=o_ref.name;if(typeof o_ref.verbal!="undefined")o_verbal=o_ref.verbal;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+o_verbal+" the value "+show_value(value)+". "}return o_verbal+" = "+show_value(value)+". "}};sim.ep.behaviors["AND"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])&get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])&get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU AND with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (AND). "}};sim.ep.behaviors["OR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])|get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])|get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU OR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (OR). "}};sim.ep.behaviors["NOT"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=~get_value(sim.ep.states[s_expr[2]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=~get_value(sim.ep.states[s_expr[2]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU NOT with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (NOT). "}};sim.ep.behaviors["XOR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])^get_value(sim.ep.states[s_expr[3]]);set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])^get_value(sim.ep.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU XOR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (XOR). "}};sim.ep.behaviors["SRL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Logical with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRL). "}};sim.ep.behaviors["SRA"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Arithmetic with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRA). "}};sim.ep.behaviors["SL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=result>>>31},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Left with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SL). "}};sim.ep.behaviors["RR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1|(get_value(sim.ep.states[s_expr[2]])&1)<<31;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])>>>1|(get_value(sim.ep.states[s_expr[2]])&1)<<31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Right Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (RR). "}};sim.ep.behaviors["RL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1|(get_value(sim.ep.states[s_expr[2]])&2147483648)>>>31;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<1|(get_value(sim.ep.states[s_expr[2]])&2147483648)>>>31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Left Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LR). "}};sim.ep.behaviors["ADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a+b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a+b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU ADD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (ADD). "}};sim.ep.behaviors["SUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a-b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a-b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU SUB with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SUB). "}};sim.ep.behaviors["MUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a*b;set_value(sim.ep.states[s_expr[1]],result>>>0);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_c=0;sim.ep.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.ep.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.ep.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;var result=a*b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MUL with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MUL). "}};sim.ep.behaviors["DIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){set_value(sim.ep.states[s_expr[1]],0);sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=1;sim.ep.internal_states.alu_flags.flag_v=1;sim.ep.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){return"ALU DIV zero by zero (oops!). "}var result=Math.floor(a/b);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU DIV with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (DIV). "}};sim.ep.behaviors["MOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){set_value(sim.ep.states[s_expr[1]],0);sim.ep.internal_states.alu_flags.flag_n=0;sim.ep.internal_states.alu_flags.flag_z=1;sim.ep.internal_states.alu_flags.flag_v=1;sim.ep.internal_states.alu_flags.flag_c=0;return}var result=a%b;set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var b=get_value(sim.ep.states[s_expr[3]])<<0;if(0==b){return"ALU MOD zero by zero (oops!). "}var result=a%b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MOD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MOD). "}};sim.ep.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<16;set_value(sim.ep.states[s_expr[1]],result);sim.ep.internal_states.alu_flags.flag_n=result<0?1:0;sim.ep.internal_states.alu_flags.flag_z=result==0?1:0;sim.ep.internal_states.alu_flags.flag_v=0;sim.ep.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.ep.states[s_expr[2]])<<16;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Load Upper Immediate with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LUI). "}};sim.ep.behaviors["PLUS1"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+1;set_value(sim.ep.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+show_verbal(s_expr[1])+" "+show_verbal(s_expr[2])+" plus one with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 1"+" ("+show_value(result)+"). "}};sim.ep.behaviors["PLUS4"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+4;set_value(sim.ep.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.ep.states[s_expr[2]])<<0;var result=a+4;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+show_verbal(s_expr[1])+" "+show_verbal(s_expr[2])+" plus four with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 4"+" ("+show_value(result)+"). "}};sim.ep.behaviors["MBIT"]={nparameters:5,types:["X","X","I","I"],operation:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);set_value(sim_elto_dst,parseInt(n2,2))},verbal:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3=parseInt(n2,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(n3)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(n3)+", "+size+" bits from bit "+offset+"). "}};sim.ep.behaviors["MBIT_SN"]={nparameters:5,types:["S","E","E","I"],operation:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.ep.states[s_expr[3]]);else if(typeof sim.ep.states[r[0]].value[r[1]]!="undefined")base=sim.ep.states[r[0]].value[r[1]];else if(typeof sim.ep.signals[r[1]].default_value!="undefined")base=sim.ep.signals[r[1]].default_value;else if(typeof sim.ep.states[r[1]].default_value!="undefined")base=sim.ep.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.ep.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.ep.states[s_expr[3]]);else if(typeof sim.ep.states[r[0]].value[r[1]]!="undefined")base=sim.ep.states[r[0]].value[r[1]];else if(typeof sim.ep.signals[r[1]].default_value!="undefined")base=sim.ep.signals[r[1]].default_value;else if(typeof sim.ep.states[r[1]].default_value!="undefined")base=sim.ep.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.ep.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);var from_elto="";if(1==r.length)from_elto=show_verbal(s_expr[3]);else from_elto=show_verbal(s_expr[2])+"["+r[1]+"] ";var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+from_elto+"into "+show_verbal(s_expr[1])+" "+"value "+parseInt(n3,2)+". "}return show_verbal(s_expr[1])+" = "+from_elto+" ("+parseInt(n3,2)+"). "}};sim.ep.behaviors["SBIT_SIGNAL"]={nparameters:4,types:["X","I","I"],operation:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)},verbal:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)}};sim.ep.behaviors["UPDATE_FLAG"]={nparameters:4,types:["X","X","I"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value&~(1<>>0)},verbal:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Update "+show_verbal(s_expr[2])+" to value "+sim_elto_org.value+". "}return show_verbal(s_expr[1])+"."+show_verbal(s_expr[3])+" = "+sim_elto_org.value+". "}};sim.ep.behaviors["MBITS"]={nparameters:8,types:["E","I","E","S","S","I","S"],operation:function(s_expr){var offset=parseInt(sim.ep.signals[s_expr[4]].value);var size=parseInt(sim.ep.signals[s_expr[5]].value);var n1=get_value(sim.ep.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.ep.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}set_value(sim.ep.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var offset=parseInt(sim.ep.signals[s_expr[4]].value);var size=parseInt(sim.ep.signals[s_expr[5]].value);var n1=get_value(sim.ep.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.ep.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}n1=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return" Copy from "+show_verbal(s_expr[3])+" to "+show_verbal(s_expr[1])+" value "+show_value(n1)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[3])+" ("+show_value(n1)+", "+size+" bits from bit "+offset+"). "}};sim.ep.behaviors["BSEL"]={nparameters:6,types:["E","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;set_value(sim.ep.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var posd=parseInt(s_expr[2]);var len=parseInt(s_expr[3]);var poso=parseInt(s_expr[5]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;var n5=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[4])+" to "+show_verbal(s_expr[1])+" value "+show_value(n5)+" (copied "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[4])+" ("+show_value(n5)+", "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}};sim.ep.behaviors["EXT_SIG"]={nparameters:3,types:["E","I"],operation:function(s_expr){var n1=get_value(sim.ep.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}set_value(sim.ep.states[s_expr[1]],parseInt(n4,2))},verbal:function(s_expr){var n1=get_value(sim.ep.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}var n5=parseInt(n4,2);return"Sign Extension with value "+show_value(n5)+". "}};sim.ep.behaviors["MOVE_BITS"]={nparameters:5,types:["S","I","I","S"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=0;var len=parseInt(s_expr[3]);var n1=sim.ep.signals[s_expr[4]].value.toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.ep.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.ep.behaviors["MOVE_BITSE"]={nparameters:6,types:["S","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.ep.states[s_expr[4]]).toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.ep.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.ep.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.ep.behaviors["DECO"]={nparameters:1,operation:function(s_expr){sim.ep.states["INEX"].value=0;var oi=decode_instruction(sim.ep.internal_states.FIRMWARE,sim.ep.ctrl_states.ir,get_value(sim.ep.states["REG_IR"]));if(null==oi.oinstruction){ws_alert("ERROR: undefined instruction code in IR ("+"co:"+oi.op_code.toString(2)+", "+"cop:"+oi.cop_code.toString(2)+")");sim.ep.states["ROM_MUXA"].value=0;sim.ep.states["INEX"].value=1;return-1}var rom_addr=oi.op_code<<6;if(typeof oi.oinstruction.cop!="undefined"){rom_addr=rom_addr+oi.cop_code}if(typeof sim.ep.internal_states["ROM"][rom_addr]=="undefined"){ws_alert("ERROR: undefined rom address "+rom_addr+" in firmware");sim.ep.states["ROM_MUXA"].value=0;return-1}sim.ep.states["ROM_MUXA"].value=sim.ep.internal_states["ROM"][rom_addr];var val=get_value(sim.ep.states["DECO_INS"]);set_value(sim.ep.states["DECO_INS"],val+1);var pc=get_value(sim.ep.states["REG_PC"])-4;var decins=get_deco_from_pc(pc);set_value(sim.ep.states["REG_IR_DECO"],decins);show_dbg_ir(get_value(sim.ep.states["REG_IR_DECO"]))},verbal:function(s_expr){return"Decode instruction. "}};sim.ep.behaviors["FIRE"]={nparameters:2,types:["S"],operation:function(s_expr){if(sim.ep.internal_states.fire_stack.indexOf(s_expr[1])!=-1){return}sim.ep.internal_states.fire_stack.push(s_expr[1]);update_draw(sim.ep.signals[s_expr[1]],sim.ep.signals[s_expr[1]].value);if("L"==sim.ep.signals[s_expr[1]].type){update_state(s_expr[1])}sim.ep.internal_states.fire_stack.pop(s_expr[1]);check_buses(s_expr[1])},verbal:function(s_expr){return""}};sim.ep.behaviors["FIRE_IFSET"]={nparameters:3,types:["S","I"],operation:function(s_expr){if(get_value(sim.ep.signals[s_expr[1]])!=parseInt(s_expr[2])){return}sim.ep.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.ep.behaviors["FIRE_IFCHANGED"]={nparameters:3,types:["S","X"],operation:function(s_expr){sim_elto=get_reference(s_expr[2]);if(sim_elto.changed==false){return}sim.ep.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.ep.behaviors["RESET_CHANGED"]={nparameters:2,types:["X"],operation:function(s_expr){sim_elto=get_reference(s_expr[1]);sim_elto.changed=false},verbal:function(s_expr){return""}};sim.ep.behaviors["CLOCK"]={nparameters:1,operation:function(s_expr){var new_maddr=null;var mcelto=null;var t0=performance.now();var val=get_value(sim.ep.states["CLK"]);set_value(sim.ep.states["CLK"],val+1);new_maddr=get_value(sim.ep.states["REG_MICROADDR"]);mcelto=sim.ep.internal_states["MC"][new_maddr];if(typeof mcelto!=="undefined"&&false==mcelto.is_native){for(var i=0;i>>0},set_value:function(elto,value){var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.ep.internal_states.MP,elto,melto);show_main_memory(sim.ep.internal_states.MP,elto,typeof valref==="undefined",true);return value}};sim.ep.internal_states.segments={};sim.ep.internal_states.MP={};sim.ep.internal_states.MP_wc=0;sim.ep.signals.MRDY={name:"MRDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED MRDY C","FIRE_IFCHANGED MRDY C"],fire_name:["svg_p:tspan3916","svg_p:text3909"],draw_data:[[],["svg_p:path3895","svg_p:path3541"]],draw_name:[[],[]]};sim.ep.signals.R={name:"R",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_READ BUS_AB BUS_DB BWA MRDY CLK; FIRE MRDY"],fire_name:["svg_p:text3533-5-2","svg_p:text3713"],draw_data:[[],["svg_p:path3557","svg_p:path3571"]],draw_name:[[],[]]};sim.ep.signals.W={name:"W",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_WRITE BUS_AB BUS_DB BWA MRDY CLK; FIRE MRDY"],fire_name:["svg_p:text3533-5-08","svg_p:text3527","svg_p:text3431-7"],draw_data:[[],["svg_p:path3559","svg_p:path3575","svg_p:path3447-7"]],draw_name:[[],[]]};sim.ep.behaviors.MEM_READ={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);sim.ep.signals[s_expr[4]].value=0;var remain=get_var(sim.ep.internal_states.MP_wc);if(typeof sim.ep.events.mem[clk-1]!="undefined"&&sim.ep.events.mem[clk-1]>0){remain=sim.ep.events.mem[clk-1]-1}sim.ep.events.mem[clk]=remain;if(remain>0){return}address=address&4294967292;var value=main_memory_getvalue(sim.ep.internal_states.MP,address);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}dbvalue=main_memory_fusionvalues(dbvalue,value,bw);sim.ep.states[s_expr[2]].value=dbvalue>>>0;sim.ep.signals[s_expr[4]].value=1;show_main_memory(sim.ep.internal_states.MP,address,full_redraw,false)},verbal:function(s_expr){var verbal="";var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);var bw_type="word";if(0==(bw&12))bw_type="byte";else if(1==(bw&12))bw_type="half";var value=main_memory_getvalue(sim.ep.internal_states.MP,address);if(typeof value==="undefined")value=0;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){verbal="Try to read a "+bw_type+" from memory "+"at address 0x"+address.toString(16)+" with value 0x"+value.toString(16)+". "}verbal="Memory output = 0x"+value.toString(16)+" (Read a "+bw_type+" from 0x"+address.toString(16)+"). ";return verbal}};sim.ep.behaviors.MEM_WRITE={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);sim.ep.signals[s_expr[4]].value=0;var remain=get_var(sim.ep.internal_states.MP_wc);if(typeof sim.ep.events.mem[clk-1]!="undefined"&&sim.ep.events.mem[clk-1]>0){remain=sim.ep.events.mem[clk-1]-1}sim.ep.events.mem[clk]=remain;if(remain>0){return}address=address&4294967292;var value=main_memory_getvalue(sim.ep.internal_states.MP,address);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}value=main_memory_fusionvalues(value,dbvalue,bw);var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.ep.internal_states.MP,address,melto);sim.ep.signals[s_expr[4]].value=1;show_main_memory(sim.ep.internal_states.MP,address,full_redraw,true)},verbal:function(s_expr){var verbal="";var address=sim.ep.states[s_expr[1]].value;var dbvalue=sim.ep.states[s_expr[2]].value;var bw=sim.ep.signals[s_expr[3]].value;var clk=get_value(sim.ep.states[s_expr[5]].value);var bw_type="word";if(0==(bw&12))bw_type="byte";else if(1==(bw&12))bw_type="half";var value=main_memory_getvalue(sim.ep.internal_states.MP,address);if(typeof value==="undefined")value=0;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){verbal="Try to write a "+bw_type+" to memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". "}verbal="Memory[0x"+address.toString(16)+"] = "+"0x"+value.toString(16)+" (Write a "+bw_type+" to 0x"+address.toString(16)+"). ";return verbal}};sim.ep.behaviors.MEMORY_RESET={nparameters:1,operation:function(s_expr){sim.ep.events.mem={}},verbal:function(s_expr){return"Reset main memory (all values will be zeroes). "}};sim.ep.components.IO={name:"IO",version:"1",abilities:["IO_TIMER"],details_name:["IO_STATS","IO_CONFIG"],details_fire:[["svg_p:text3775"],[]],write_state:function(vec){return vec},read_state:function(o,check){return false},get_state:function(reg){return null},get_value:function(elto){var associated_state=simhw_internalState_get("io_hash",elto);var value=get_value(simhw_sim_state(associated_state))>>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.ep.internal_states.io_int_factory=[];sim.ep.internal_states.io_int_factory[0]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[1]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[2]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[3]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[4]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[5]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[6]={period:0,probability:.5,accumulated:0,active:false};sim.ep.internal_states.io_int_factory[7]={period:0,probability:.5,accumulated:0,active:false};var IOSR_ID=4352;var IOCR_ID=4356;var IODR_ID=4360;sim.ep.internal_states.io_hash[IOSR_ID]="IOSR";sim.ep.internal_states.io_hash[IOCR_ID]="IOCR";sim.ep.internal_states.io_hash[IODR_ID]="IODR";sim.ep.states.IOSR={name:"IOSR",verbal:"IO State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.IOCR={name:"IOCR",verbal:"IO Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.IODR={name:"IODR",verbal:"IO Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals.INT={name:"INT",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE C","FIRE C"],fire_name:["svg_p:tspan4199"],draw_data:[[],["svg_p:path3809"]],draw_name:[[],[]]};sim.ep.signals.IORDY={name:"IORDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED IORDY C","FIRE_IFCHANGED IORDY C"],fire_name:["svg_p:tspan4089","svg_p:path3793","svg_p:text3911"],draw_data:[[],["svg_p:path3897"]],draw_name:[[],[]]};sim.ep.signals.IO_IOR={name:"IO_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOR BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE SBWA"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.IO_IOW={name:"IO_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOW BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE SBWA"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.IO_IE={name:"IO_IE",visible:true,type:"L",value:1,default_value:1,nbits:"1",behavior:["NOP","IO_CHK_I CLK INT INTV; FIRE C"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.ep.signals.INTA={name:"INTA",visible:true,type:"L",value:1,default_value:0,nbits:"1",behavior:["NOP","INTA CLK INT INTA BUS_DB INTV; FIRE BW; FIRE C"],fire_name:["svg_p:text3785-0-6-0-5-5-1-1"],draw_data:[[],["svg_p:path3807","svg_p:path3737"]],draw_name:[[],[]]};sim.ep.behaviors.IO_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==IOSR_ID)set_value(sim.ep.states[s_expr[2]],iosr);if(bus_ab==IOCR_ID)set_value(sim.ep.states[s_expr[2]],iocr);if(bus_ab==IODR_ID)set_value(sim.ep.states[s_expr[2]],iodr)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==IOSR_ID)verbal="I/O device read at IOSR of value "+iosr+". ";if(bus_ab==IOCR_ID)verbal="I/O device read at IOCR of value "+iocr+". ";if(bus_ab==IODR_ID)verbal="I/O device read at IODR of value "+iodr+". ";return verbal}};sim.ep.behaviors.IO_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab!=IOSR_ID&&bus_ab!=IOCR_ID&&bus_ab!=IODR_ID){return}if(bus_ab==IOSR_ID)set_value(sim.ep.states[s_expr[3]],bus_db);if(bus_ab==IOCR_ID)set_value(sim.ep.states[s_expr[4]],bus_db);if(bus_ab==IODR_ID)set_value(sim.ep.states[s_expr[5]],bus_db);var iocr_id=get_value(sim.ep.states[s_expr[4]]);var iodr_id=get_value(sim.ep.states[s_expr[5]]);if(iocr_id<0||iocr_id>7)return;set_var(sim.ep.internal_states.io_int_factory[iocr_id].period,iodr_id);set_var(sim.ep.internal_states.io_int_factory[iocr_id].probability,1);if(0==iodr_id)set_var(sim.ep.internal_states.io_int_factory[iocr_id].probability,0)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab==IOSR_ID)verbal="I/O device write at IOSR with value "+bus_db+". ";if(bus_ab==IOCR_ID)verbal="I/O device write at IOCR with value "+bus_db+". ";if(bus_ab==IODR_ID)verbal="I/O device write at IODR with value "+bus_db+". ";return verbal}};sim.ep.behaviors.IO_CHK_I={nparameters:4,types:["E","S","E"],operation:function(s_expr){var clk=get_value(sim.ep.states[s_expr[1]]);for(var i=sim.ep.internal_states.io_int_factory.length-1;i>=0;i--){if(get_var(sim.ep.internal_states.io_int_factory[i].period)==0)continue;if(get_var(sim.ep.internal_states.io_int_factory[i].active)==true){set_value(sim.ep.signals[s_expr[2]],1);set_value(sim.ep.states[s_expr[3]],i)}if(clk%get_var(sim.ep.internal_states.io_int_factory[i].period)==0){if(Math.random()>get_var(sim.ep.internal_states.io_int_factory[i].probability))continue;set_var(sim.ep.internal_states.io_int_factory[i].accumulated,get_var(sim.ep.internal_states.io_int_factory[i].accumulated)+1);set_var(sim.ep.internal_states.io_int_factory[i].active,true);if(typeof sim.ep.events.io[clk]=="undefined")sim.ep.events.io[clk]=[];sim.ep.events.io[clk].push(i);set_value(sim.ep.signals[s_expr[2]],1);set_value(sim.ep.states[s_expr[3]],i)}}},verbal:function(s_expr){return"Check I/O Interruption. "}};sim.ep.behaviors.INTA={nparameters:6,types:["E","S","S","E","E"],operation:function(s_expr){var clk=get_value(sim.ep.states[s_expr[1]]);if(typeof sim.ep.events.io[clk]!="undefined"){set_value(sim.ep.states[s_expr[4]],sim.ep.events.io[clk][0]);return}set_value(sim.ep.signals[s_expr[2]],0);set_value(sim.ep.states[s_expr[5]],0);for(var i=0;i>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.ep.internal_states.l3d_dim=4;sim.ep.internal_states.l3d_neltos=Math.pow(sim.ep.internal_states.l3d_dim,3);sim.ep.internal_states.l3d_state=Array.from({length:sim.ep.internal_states.l3d_neltos},(()=>({active:false})));sim.ep.internal_states.l3d_frame="0".repeat(sim.ep.internal_states.l3d_neltos);var L3DSR_ID=8448;var L3DCR_ID=8452;var L3DDR_ID=8456;sim.ep.internal_states.io_hash[L3DSR_ID]="L3DSR";sim.ep.internal_states.io_hash[L3DCR_ID]="L3DCR";sim.ep.internal_states.io_hash[L3DDR_ID]="L3DDR";sim.ep.states.L3DSR={name:"L3DSR",verbal:"L3D State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.L3DCR={name:"L3DCR",verbal:"L3D Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.states.L3DDR={name:"L3DDR",verbal:"L3D Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.ep.signals.L3D_IOR={name:"L3D_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOR BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE SBWA"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.signals.L3D_IOW={name:"L3D_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOW BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE SBWA; L3D_SYNC"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.ep.behaviors.L3D_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==L3DCR_ID){set_value(sim.ep.states[s_expr[2]],iocr)}if(bus_ab==L3DDR_ID){set_value(sim.ep.states[s_expr[2]],iodr)}if(bus_ab==L3DSR_ID){var x=(iodr&4278190080)>>24;var y=(iodr&16711680)>>16;var z=(iodr&65280)>>8;var p=z*Math.pow(sim.ep.internal_states.l3d_dim,2)+y*sim.ep.internal_states.l3d_dim+x;var s=get_var(sim.ep.internal_states.l3d_state[p].active);set_value(sim.ep.states[s_expr[2]],s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var iosr=get_value(sim.ep.states[s_expr[3]]);var iocr=get_value(sim.ep.states[s_expr[4]]);var iodr=get_value(sim.ep.states[s_expr[5]]);if(bus_ab==L3DSR_ID)verbal="I/O device read at L3DSR of value "+iosr+". ";if(bus_ab==L3DCR_ID)verbal="I/O device read at L3DCR of value "+iocr+". ";if(bus_ab==L3DDR_ID)verbal="I/O device read at L3DDR of value "+iodr+". ";return verbal}};sim.ep.behaviors.L3D_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab!=L3DSR_ID&&bus_ab!=L3DCR_ID&&bus_ab!=L3DDR_ID){return}if(bus_ab==L3DSR_ID){set_value(sim.ep.states[s_expr[3]],bus_db)}if(bus_ab==L3DDR_ID){set_value(sim.ep.states[s_expr[5]],bus_db)}if(bus_ab==L3DCR_ID){set_value(sim.ep.states[s_expr[4]],bus_db);var x=(bus_db&4278190080)>>24;var y=(bus_db&16711680)>>16;var z=(bus_db&65280)>>8;var p=z*Math.pow(sim.ep.internal_states.l3d_dim,2)+y*sim.ep.internal_states.l3d_dim+x;var s=(bus_db&255)!=0;set_var(sim.ep.internal_states.l3d_state[p].active,s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.ep.states[s_expr[1]]);var bus_db=get_value(sim.ep.states[s_expr[2]]);if(bus_ab==L3DSR_ID)verbal="I/O device write at L3DSR with value "+bus_db+". ";if(bus_ab==L3DCR_ID)verbal="I/O device write at L3DCR with value "+bus_db+". ";if(bus_ab==L3DDR_ID)verbal="I/O device write at L3DDR with value "+bus_db+". ";return verbal}};sim.ep.behaviors.L3D_RESET={nparameters:1,operation:function(s_expr){sim.ep.events.l3d={};for(var i=0;i>>0;if(value!=0){vec.CPU["R"+i]={type:"register",default_value:0,id:"R"+i,op:"=",value:"0x"+value.toString(16)}}}for(var i=0;i>>0;if(value!=0){vec.CPU[internal_reg[i]]={type:"register",default_value:0,id:internal_reg[i],op:"=",value:"0x"+value.toString(16)}}}return vec},read_state:function(vec,check){if(typeof vec.CPU=="undefined")vec.CPU={};var key=check["id"].toUpperCase().trim();var val=parseInt(check["value"]).toString(16);if("REGISTER"==check["type"].toUpperCase().trim()){vec.CPU[key]={type:"register",default_value:0,id:key,op:check["condition"],value:"0x"+val};return true}return false},get_state:function(reg){var r_reg=reg.toUpperCase().trim();if(typeof sim.poc.states["REG_"+r_reg]!="undefined"){var value=get_value(sim.poc.states["REG_"+r_reg])>>>0;return"0x"+value.toString(16)}r_reg=r_reg.replace("R","");var index=parseInt(r_reg);if(typeof sim.poc.states.BR[index]!="undefined"){var value=get_value(sim.poc.states.BR[index])>>>0;return"0x"+value.toString(16)}return null},get_value:function(elto){if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index))return get_value(simhw_sim_state(elto))>>>0;return get_value(simhw_sim_states().BR[index])>>>0},set_value:function(elto,value){var pc_name=simhw_sim_ctrlStates_get().pc.state;if(Number.isInteger(elto))index=elto;else index=parseInt(elto);if(isNaN(index)){set_value(simhw_sim_state(elto),value);if(pc_name===elto){show_asmdbg_pc()}return value}return set_value(simhw_sim_states().BR[index],value)}};sim.poc.ctrl_states.pc={name:"PC",state:"REG_PC",is_pointer:true};sim.poc.ctrl_states.sp={name:"SP",state:"BR.29",is_pointer:true};sim.poc.ctrl_states.fp={name:"FP",state:"BR.30",is_pointer:true};sim.poc.ctrl_states.ir={name:"IR",state:"REG_IR",default_eltos:{co:{begin:0,end:5,length:6},cop:{begin:27,end:31,length:5}},is_pointer:false};sim.poc.ctrl_states.mpc={name:"mPC",state:"REG_MICROADDR",is_pointer:false};sim.poc.internal_states.MC={};sim.poc.internal_states.ROM={};sim.poc.internal_states.FIRMWARE={};sim.poc.internal_states.io_hash={};sim.poc.internal_states.fire_stack=[];sim.poc.internal_states.tri_state_names=["T1","T2","T3","T6","T8","T9","T10","T11"];sim.poc.internal_states.fire_visible={databus:false,internalbus:false};sim.poc.internal_states.filter_states=["REG_IR_DECO,col-12","REG_IR,col-auto","REG_PC,col-auto","REG_SR,col-auto","REG_RT1,col-auto","REG_MAR,col-auto","REG_MBR,col-auto","REG_MICROADDR,col-auto"];sim.poc.internal_states.filter_signals=["A0,0","B,0","C,0","SELA,5","SELB,5","SELC,2","SELCOP,0","MR,0","MC,0","C0,0","C1,0","C2,0","C3,0","C4,0","C7,0","T1,0","T2,0","T3,0","T6,0","T8,0","T9,0","T10,0","T11,0","M1,0","M7,0","MA,0","MB,0","LC,0","SE,0","SIZE,0","OFFSET,0","BW,0","R,0","W,0","TA,0","TD,0","IOR,0","IOW,0","TEST_I,0","TEST_U,0"];sim.poc.internal_states.alu_flags={flag_n:0,flag_z:0,flag_v:0,flag_c:0};sim.poc.states.BR=[];sim.poc.states.BR[0]={name:"R0",verbal:"Register 0",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[1]={name:"R1",verbal:"Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[2]={name:"R2",verbal:"Register 2",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[3]={name:"R3",verbal:"Register 3",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[4]={name:"R4",verbal:"Register 4",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[5]={name:"R5",verbal:"Register 5",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[6]={name:"R6",verbal:"Register 6",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[7]={name:"R7",verbal:"Register 7",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[8]={name:"R8",verbal:"Register 8",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[9]={name:"R9",verbal:"Register 9",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[10]={name:"R10",verbal:"Register 10",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[11]={name:"R11",verbal:"Register 11",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[12]={name:"R12",verbal:"Register 12",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[13]={name:"R13",verbal:"Register 13",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[14]={name:"R14",verbal:"Register 14",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[15]={name:"R15",verbal:"Register 15",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[16]={name:"R16",verbal:"Register 16",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[17]={name:"R17",verbal:"Register 17",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[18]={name:"R18",verbal:"Register 18",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[19]={name:"R19",verbal:"Register 19",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[20]={name:"R20",verbal:"Register 20",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[21]={name:"R21",verbal:"Register 21",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[22]={name:"R22",verbal:"Register 22",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[23]={name:"R23",verbal:"Register 23",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[24]={name:"R24",verbal:"Register 24",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[25]={name:"R25",verbal:"Register 25",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[26]={name:"R26",verbal:"Register 26",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[27]={name:"R27",verbal:"Register 27",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[28]={name:"R28",verbal:"Register 28",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[29]={name:"R29",verbal:"Register 29",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[30]={name:"R30",verbal:"Register 30",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[31]={name:"R31",verbal:"Register 31",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[32]={name:"R32",verbal:"Register 32",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[33]={name:"R33",verbal:"Register 33",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[34]={name:"R34",verbal:"Register 34",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[35]={name:"R35",verbal:"Register 35",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[36]={name:"R36",verbal:"Register 36",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[37]={name:"R37",verbal:"Register 37",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[38]={name:"R38",verbal:"Register 38",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[39]={name:"R39",verbal:"Register 39",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[40]={name:"R40",verbal:"Register 40",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[41]={name:"R41",verbal:"Register 41",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[42]={name:"R42",verbal:"Register 42",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[43]={name:"R43",verbal:"Register 43",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[44]={name:"R44",verbal:"Register 44",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[45]={name:"R45",verbal:"Register 45",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[46]={name:"R46",verbal:"Register 46",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[47]={name:"R47",verbal:"Register 47",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[48]={name:"R48",verbal:"Register 48",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[49]={name:"R49",verbal:"Register 49",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[50]={name:"R50",verbal:"Register 50",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[51]={name:"R51",verbal:"Register 51",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[52]={name:"R52",verbal:"Register 52",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[53]={name:"R53",verbal:"Register 53",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[54]={name:"R54",verbal:"Register 54",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[55]={name:"R55",verbal:"Register 55",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[56]={name:"R56",verbal:"Register 56",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[57]={name:"R57",verbal:"Register 57",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[58]={name:"R58",verbal:"Register 58",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[59]={name:"R59",verbal:"Register 59",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[60]={name:"R60",verbal:"Register 60",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[61]={name:"R61",verbal:"Register 61",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[62]={name:"R62",verbal:"Register 62",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.BR[63]={name:"R63",verbal:"Register 63",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_PC"]={name:"PC",verbal:"Program Counter Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MAR"]={name:"MAR",verbal:"Memory Address Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MBR"]={name:"MBR",verbal:"Memory Data Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_IR"]={name:"IR",verbal:"Instruction Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_SR"]={name:"SR",verbal:"State Register",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_RT1"]={name:"RT1",verbal:"Temporal Register 1",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_IB"]={name:"I_BUS",verbal:"Internal Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_AB"]={name:"A_BUS",verbal:"Address Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_CB"]={name:"C_BUS",verbal:"Control Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BUS_DB"]={name:"D_BUS",verbal:"Data Bus",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["RA_T9"]={name:"RA_T9",verbal:"Input of T9 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["RB_T10"]={name:"RB_T10",verbal:"Input of T10 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["SELEC_T3"]={name:"SELEC_T3",verbal:"Input of T3 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["ALU_T6"]={name:"ALU_T6",verbal:"Input of T6 Tristate",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["MA_ALU"]={name:"MA_ALU",verbal:"Input ALU via MA",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["MB_ALU"]={name:"MB_ALU",verbal:"Input ALU via MB",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_C"]={name:"FLAG_C",verbal:"Carry Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_V"]={name:"FLAG_V",verbal:"Overflow Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_N"]={name:"FLAG_N",verbal:"Negative Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_Z"]={name:"FLAG_Z",verbal:"Zero Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_I"]={name:"FLAG_I",verbal:"Interruption Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["FLAG_U"]={name:"FLAG_U",verbal:"User Flag",visible:true,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["REG_MICROADDR"]={name:"µADDR",verbal:"Microaddress Register",visible:true,nbits:"12",value:0,default_value:0,draw_data:["svg_cu:text4667"]};sim.poc.states["REG_MICROINS"]={name:"µINS",verbal:"Microinstruction Register",visible:true,nbits:"77",value:{},default_value:{},draw_data:[]};sim.poc.states["FETCH"]={name:"FETCH",verbal:"Input Fetch",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["ROM_MUXA"]={name:"ROM_MUXA",verbal:"Input ROM",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["SUM_ONE"]={name:"SUM_ONE",verbal:"Input next microinstruction",visible:false,nbits:"12",value:1,default_value:1,draw_data:[]};sim.poc.states["MUXA_MICROADDR"]={name:"MUXA_MICROADDR",verbal:"Input microaddress",visible:false,nbits:"12",value:0,default_value:0,draw_data:[]};sim.poc.states["MUXC_MUXB"]={name:"MUXC_MUXB",verbal:"Output of MUX C",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["INEX"]={name:"INEX",verbal:"Illegal Instruction Exception",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["BS_M1"]={name:"BS_M1",verbal:"from Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["BS_TD"]={name:"BS_TD",verbal:"Memory",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["INTV"]={name:"INTV",verbal:"Interruption Vector",visible:false,nbits:"8",value:0,default_value:0,draw_data:[]};sim.poc.states["M1_C1"]={name:"M1_C1",verbal:"Input of Memory Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["M7_C7"]={name:"M7_C7",verbal:"Input of State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["VAL_ZERO"]={name:"VAL_ZERO",verbal:"Wired Zero",visible:false,nbits:"1",value:0,default_value:0,draw_data:[]};sim.poc.states["VAL_ONE"]={name:"VAL_ONE",verbal:"Wired One",visible:false,nbits:"32",value:1,default_value:1,draw_data:[]};sim.poc.states["VAL_FOUR"]={name:"VAL_FOUR",verbal:"Wired Four",visible:false,nbits:"32",value:4,default_value:4,draw_data:[]};sim.poc.states["REG_IR_DECO"]={name:"IR_DECO",verbal:"Instruction Decoded",visible:true,nbits:"0",value:0,default_value:0,draw_data:[]};sim.poc.states["DECO_INS"]={name:"DECO_INS",verbal:"Instruction decoded in binary",visible:true,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["CLK"]={name:"CLK",verbal:"Clock",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states["ACC_TIME"]={name:"ACC_TIME",verbal:"Accumulated CPU time",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals["C"]={name:"C",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["MV MUXC_MUXB VAL_ZERO; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB INT 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB IORDY 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB MRDY 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 0 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 1 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 28 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 29 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 30 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MBIT MUXC_MUXB REG_SR 31 1; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB","MV MUXC_MUXB INEX; FIRE_IFCHANGED B MUXC_MUXB; RESET_CHANGED MUXC_MUXB"],fire_name:["svg_cu:text3410"],draw_data:[["svg_cu:path3108"],["svg_cu:path3062"],["svg_cu:path3060"],["svg_cu:path3136"],["svg_cu:path3482"],["svg_cu:path3480"],["svg_cu:path3488"],["svg_cu:path3486"],["svg_cu:path3484"],["svg_cu:path3484-9"],["svg_cu:path3108-3","svg_cu:path3260-3-8-6","svg_cu:path3260-3-8","svg_cu:path3260-3"]],draw_name:[["svg_cu:path3496","svg_cu:path3414","svg_cu:path3194-08"]]};sim.poc.signals["B"]={name:"B",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV A1 MUXC_MUXB; FIRE A1","NOT_ES A1 MUXC_MUXB; FIRE A1"],depends_on:["CLK"],fire_name:["svg_cu:text3408"],draw_data:[["svg_cu:path3094-7"],["svg_cu:path3392","svg_cu:path3372","svg_cu:path3390","svg_cu:path3384","svg_cu:path3108-1","svg_cu:path3100-8-7"]],draw_name:[[],["svg_cu:path3194-0","svg_cu:path3138-8","svg_cu:path3498-6"]]};sim.poc.signals["A0"]={name:"A0",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 1; FIRE A0A1","SBIT_SIGNAL A0A1 1 1; FIRE A0A1"],depends_on:["CLK"],fire_name:["svg_cu:text3406"],draw_data:[["svg_cu:path3096"],["svg_cu:path3096"]],draw_name:[[],["svg_cu:path3138-8-1","svg_cu:path3098-2","svg_cu:path3124-2-5"]]};sim.poc.signals["A1"]={name:"A1",visible:false,type:"L",value:0,default_value:0,nbits:"1",behavior:["SBIT_SIGNAL A0A1 0 0; FIRE A0A1","SBIT_SIGNAL A0A1 1 0; FIRE A0A1"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3094"],["svg_cu:path3094"]],draw_name:[[]]};sim.poc.signals["A0A1"]={name:"A0A1",visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["PLUS1 MUXA_MICROADDR REG_MICROADDR","CP_FIELD MUXA_MICROADDR REG_MICROINS/MADDR","MV MUXA_MICROADDR ROM_MUXA","MV MUXA_MICROADDR FETCH"],depends_on:["CLK"],fire_name:[],draw_data:[["svg_cu:path3102","svg_cu:path3100","svg_cu:path3098","svg_cu:path3100-9","svg_cu:path3088"],["svg_cu:path3104","svg_cu:path3134","svg_cu:path3500","svg_cu:path3416"],["svg_cu:path3504","svg_cu:path3100-8","svg_cu:path3234-9"],["svg_cu:path3124"]],draw_name:[[]]};sim.poc.signals["C0"]={name:"C0",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_MAR BUS_IB"],fire_name:["svg_p:text3077"],draw_data:[["svg_p:path3081"]],draw_name:[["svg_p:path3075"]]};sim.poc.signals["C1"]={name:"C1",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_MBR M1_C1"],fire_name:["svg_p:text3079"],draw_data:[["svg_p:path3055"]],draw_name:[["svg_p:path3073"]]};sim.poc.signals["C2"]={name:"C2",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_PC BUS_IB; UPDATEDPC"],fire_name:["svg_p:text3179"],draw_data:[["svg_p:path3217"]],draw_name:[["svg_p:path3177"]]};sim.poc.signals["C3"]={name:"C3",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_IR BUS_IB; DECO; FIRE_IFSET C 10"],fire_name:["svg_p:text3439"],draw_data:[["svg_p:path3339","svg_p:path3913-4"]],draw_name:[["svg_p:path3337"]]};sim.poc.signals["C4"]={name:"C4",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_RT1 BUS_IB"],fire_name:["svg_p:tspan482"],draw_data:[["svg_p:path3339-4"]],draw_name:[["svg_p:path3337-0"]]};sim.poc.signals["C7"]={name:"C7",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","MV REG_SR M7_C7; FIRE C"],fire_name:["svg_p:text3655"],draw_data:[["svg_p:path3651-9"]],draw_name:[["svg_p:path3681"]]};sim.poc.signals["TA"]={name:"TA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_AB REG_MAR"],fire_name:["svg_p:text3091"],draw_data:[["svg_p:path3089","svg_p:path3597","svg_p:path3513","svg_p:path3601","svg_p:path3601-2","svg_p:path3187","svg_p:path3087","svg_p:path2995","svg_p:path3535"]],draw_name:[["svg_p:path3085"]]};sim.poc.signals["TD"]={name:"TD",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_DB REG_MBR; FIRE R; FIRE W"],fire_name:["svg_p:text3103"],draw_data:[["svg_p:path3101","svg_p:path3587","svg_p:path3419-8","svg_p:path3071","svg_p:path3099","svg_p:path3097","svg_p:path3559-5","svg_p:path3419-1-0","svg_p:path3583","svg_p:path3419-1","svg_p:path3491","svg_p:path3641","svg_p:path3541"]],draw_name:[["svg_p:path3095"]]};sim.poc.signals["T1"]={name:"T1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_MBR; FIRE M7; FIRE M1"],fire_name:["svg_p:text3105"],draw_data:[["svg_p:path3071","svg_p:path3069","svg_p:path3049","svg_p:path3063-9","svg_p:path3071"]],draw_name:[["svg_p:path3067"]]};sim.poc.signals["T2"]={name:"T2",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_PC; FIRE M7; FIRE M1"],fire_name:["svg_p:text3449"],draw_data:[["svg_p:path3199","svg_p:path3201","svg_p:path3049"]],draw_name:[["svg_p:path3329"]]};sim.poc.signals["T3"]={name:"T3",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB SELEC_T3; FIRE M7; FIRE M1"],fire_name:["svg_p:text3451"],draw_data:[["svg_p:path3349","svg_p:path3931","svg_p:path3345","svg_p:path3049"]],draw_name:[["svg_p:path3351"]]};sim.poc.signals["T6"]={name:"T6",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB ALU_T6; FIRE M7; FIRE M1"],fire_name:["svg_p:text3457"],draw_data:[["svg_p:path3589","svg_p:path3317","svg_p:path3163-2","svg_p:path3049","svg_p:path3317-9","svg_p:path3321","svg_p:path3261-8"]],draw_name:[["svg_p:path3319"]]};sim.poc.signals["T8"]={name:"T8",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB REG_SR; FIRE M7; FIRE M1"],fire_name:["svg_p:text3657"],draw_data:[["svg_p:path3651","svg_p:path3647","svg_p:path3049"]],draw_name:[["svg_p:path3649"]]};sim.poc.signals["T9"]={name:"T9",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RA_T9; FIRE M7; FIRE M1"],fire_name:["svg_p:text3147"],draw_data:[["svg_p:path3143","svg_p:path3139","svg_p:path3049","svg_p:path3143-9"]],draw_name:[["svg_p:path3133"]]};sim.poc.signals["T10"]={name:"T10",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MV BUS_IB RB_T10; FIRE M7; FIRE M1"],fire_name:["svg_p:text3149"],draw_data:[["svg_p:path3145","svg_p:path3141","svg_p:path3049","svg_p:path3145-5"]],draw_name:[["svg_p:path3137"]]};sim.poc.signals["T11"]={name:"T11",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","CP_FIELD BUS_IB REG_MICROINS/EXCODE; FIRE M7; FIRE M1"],fire_name:["svg_p:text3147-5","svg_cu:tspan4426"],draw_data:[["svg_p:path3081-3","svg_p:path3139-7","svg_p:path3049","svg_cu:path3081-3","svg_cu:path3139-7","svg_cu:path3502"]],draw_name:[["svg_p:path3133-6","svg_cu:path3133-6"]]};sim.poc.signals["M1"]={name:"M1",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M1_C1 BUS_IB","MV M1_C1 BUS_DB"],depends_on:["C1"],fire_name:["svg_p:text3469"],draw_data:[["svg_p:path3063","svg_p:path3061","svg_p:path3059"],["svg_p:path3057","svg_p:path3641","svg_p:path3419","svg_p:path3583"]],draw_name:[[],["svg_p:path3447"]]};sim.poc.signals["M7"]={name:"M7",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV M7_C7 BUS_IB","MV M7_C7 REG_SR; UPDATE_FLAG M7_C7 FLAG_C 31; UPDATE_FLAG M7_C7 FLAG_V 30; UPDATE_FLAG M7_C7 FLAG_N 29; UPDATE_FLAG M7_C7 FLAG_Z 28"],depends_on:["C7"],fire_name:["svg_p:text3673"],draw_data:[["svg_p:path3691","svg_p:path3693","svg_p:path3659"],["svg_p:path3695"]],draw_name:[[],["svg_p:path3667"]]};sim.poc.signals["MA"]={name:"MA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MA_ALU RA_T9; FIRE COP","MV MA_ALU BUS_IB; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3463"],draw_data:[["svg_p:path3249","svg_p:path3161","svg_p:path3165"],["svg_p:path3279"]],draw_name:[[],["svg_p:path3423"]]};sim.poc.signals["MB"]={name:"MB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV MB_ALU RB_T10; FIRE COP","MV MB_ALU REG_PC; FIRE COP"],depends_on:["SELA","SELB"],fire_name:["svg_p:text3465"],draw_data:[["svg_p:path3281","svg_p:path3171","svg_p:path3169"],["svg_p:path3283"]],draw_name:[[],["svg_p:path3425","svg_p:path3427"]]};sim.poc.signals["COP"]={name:"COP",visible:true,type:"L",value:0,default_value:0,nbits:"5",forbidden:true,behavior:["NOP_ALU; UPDATE_NZVC","AND ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","OR ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","NOT ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","XOR ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SRL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SRA ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","RR ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","RL ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUB ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","MUL ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","DIV ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","MOD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","LUI ALU_T6 MA_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADDFOUR ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","ADDONE ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUBFOUR ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","SUBONE ALU_T6 MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FADD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FSUB ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FMUL ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FDIV ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","FMOD ALU_T6 MA_ALU MB_ALU; UPDATE_NZVC; FIRE_IFSET T6 1; FIRE_IFSET M7 1","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU","NOP_ALU"],depends_on:["SELCOP"],fire_name:["svg_p:text3303"],draw_data:[["svg_p:path3237","svg_p:path3239","svg_p:path3261-8","svg_p:path3321","svg_p:path3901-6","svg_p:path3317-9"]],draw_name:[["svg_p:path3009","svg_p:path3301"]]};sim.poc.signals["SELA"]={name:"SELA",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRA SELA; RESET_CHANGED SELA"],depends_on:["RA"],fire_name:["svg_cu:text3164"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELB"]={name:"SELB",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRB SELB; RESET_CHANGED SELB"],depends_on:["RB"],fire_name:["svg_cu:text3168"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELC"]={name:"SELC",visible:true,type:"L",value:0,default_value:0,nbits:"6",behavior:["FIRE_IFCHANGED MRC SELC; RESET_CHANGED SELC"],depends_on:["RC"],fire_name:["svg_cu:text3172"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["SELCOP"]={name:"SELCOP",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["FIRE_IFCHANGED MC SELCOP; RESET_CHANGED SELCOP"],depends_on:["COP"],fire_name:["svg_cu:text3312"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["EXCODE"]={name:"EXCODE",visible:true,type:"L",value:0,default_value:0,nbits:"4",behavior:["FIRE T11"],fire_name:["svg_cu:text3312-6"],draw_data:[[]],draw_name:[[]]};sim.poc.signals["RA"]={name:"RA",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["GET RA_T9 BR RA; FIRE_IFSET T9 1; FIRE_IFSET MA 0"],depends_on:["SELA"],fire_name:["svg_p:text3107"],draw_data:[[]],draw_name:[["svg_p:path3109"]]};sim.poc.signals["RB"]={name:"RB",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["GET RB_T10 BR RB; FIRE_IFSET T10 1; FIRE_IFSET MB 0"],depends_on:["SELB"],fire_name:["svg_p:text3123"],draw_data:[[]],draw_name:[["svg_p:path3113"]]};sim.poc.signals["RC"]={name:"RC",visible:true,type:"L",value:0,default_value:0,nbits:"6",forbidden:true,behavior:["FIRE LC"],depends_on:["SELC"],fire_name:["svg_p:text3125"],draw_data:[[]],draw_name:[["svg_p:path3117"]]};sim.poc.signals["LC"]={name:"LC",visible:true,type:"E",value:0,default_value:0,nbits:"1",behavior:["NOP","SET BR RC BUS_IB"],fire_name:["svg_p:text3127"],draw_data:[["svg_p:path3153","svg_p:path3151","svg_p:path3129"]],draw_name:[["svg_p:path3121"]]};sim.poc.signals["SE"]={name:"SE",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3","MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3593"],draw_data:[[]],draw_name:[["svg_p:path3591","svg_p:path3447-7-7"]]};sim.poc.signals["SIZE"]={name:"SIZE",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3363"],draw_data:[[]],draw_name:[["svg_p:path3355"]]};sim.poc.signals["OFFSET"]={name:"OFFSET",visible:true,type:"L",value:0,default_value:0,nbits:"5",behavior:["MBITS SELEC_T3 0 REG_RT1 OFFSET SIZE 0 SE; FIRE T3"],depends_on:["T3"],fire_name:["svg_p:text3707"],draw_data:[[]],draw_name:[["svg_p:path3359"]]};sim.poc.signals["MC"]={name:"MC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT COP REG_IR 0 5; FIRE_IFCHANGED COP MC","CP_FIELD COP REG_MICROINS/SELCOP; FIRE_IFCHANGED COP MC"],depends_on:["SELCOP"],fire_name:["svg_cu:text3322","svg_cu:text3172-1-5"],draw_data:[["svg_cu:path3320","svg_cu:path3142"],["svg_cu:path3318","svg_cu:path3502-6","svg_cu:path3232-6"]],draw_name:[[],["svg_cu:path3306"]]};sim.poc.signals["MRA"]={name:"MRA",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RA REG_IR REG_MICROINS/SELA 5; FIRE RA;","CP_FIELD RA REG_MICROINS/SELA; FIRE RA;"],depends_on:["SELA"],fire_name:["svg_cu:text3222"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3260"],["svg_cu:path3270","svg_cu:path3258","svg_cu:path3260","svg_cu:path3294","svg_cu:path3288","svg_cu:path3280"]],draw_name:[[],["svg_cu:path3220"]]};sim.poc.signals["MRB"]={name:"MRB",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RB REG_IR REG_MICROINS/SELB 5; FIRE RB;","CP_FIELD RB REG_MICROINS/SELB; FIRE RB;"],depends_on:["SELB"],fire_name:["svg_cu:text3242"],draw_data:[["svg_cu:path3196","svg_cu:path3278","svg_cu:path3292"],["svg_cu:path3282","svg_cu:path3258-4","svg_cu:path3278","svg_cu:path3196"]],draw_name:[[],["svg_cu:path3240"]]};sim.poc.signals["MRC"]={name:"MRC",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MBIT_SN RC REG_IR REG_MICROINS/SELC 5; FIRE RC;","CP_FIELD RC REG_MICROINS/SELC; FIRE RC;"],depends_on:["SELC"],fire_name:["svg_cu:text3254"],draw_data:[["svg_cu:path3494","svg_cu:path3492","svg_cu:path3490","svg_cu:path3142b","svg_cu:path3188","svg_cu:path3190","svg_cu:path3192","svg_cu:path3194","svg_cu:path3276","svg_cu:path3290","svg_cu:path3232","svg_cu:path3292"],["svg_cu:path3300","svg_cu:path3294","svg_cu:path3292","svg_cu:path3288","svg_cu:path3232"]],draw_name:[[],["svg_cu:path3252"]]};sim.poc.signals["IOR"]={name:"IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOR 0 1 IOR; FIRE SCR_IOR; MOVE_BITS IO_IOR 0 1 IOR; MOVE_BITS L3D_IOR 0 1 IOR; FIRE IO_IOR; MOVE_BITS KBD_IOR 0 1 IOR; FIRE KBD_IOR; FIRE L3D_IOR"],fire_name:[],draw_data:[[],["svg_p:path3733","svg_p:path3491","svg_p:text3715"]],draw_name:[[],[]]};sim.poc.signals["IOW"]={name:"IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MOVE_BITS SCR_IOW 0 1 IOW; FIRE SCR_IOW; MOVE_BITS IO_IOW 0 1 IOW; FIRE IO_IOW; MOVE_BITS L3D_IOW 0 1 IOW; FIRE L3D_IOW"],fire_name:[],draw_data:[[],["svg_p:path3735","svg_p:path3491","svg_p:text3717"]],draw_name:[[],[]]};sim.poc.signals["TEST_C"]={name:"TEST_C",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_C VAL_ZERO; FIRE M7","MV FLAG_C VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3"],draw_data:[["svg_p:text3701-3"]],draw_name:[[]]};sim.poc.signals["TEST_V"]={name:"TEST_V",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_V VAL_ZERO; FIRE M7","MV FLAG_V VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-1"],draw_data:[["svg_p:text3701-3-1"]],draw_name:[[]]};sim.poc.signals["TEST_N"]={name:"TEST_N",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_N VAL_ZERO; FIRE M7","MV FLAG_N VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-2"],draw_data:[["svg_p:text3701-3-2"]],draw_name:[[]]};sim.poc.signals["TEST_Z"]={name:"TEST_Z",visible:true,type:"L",value:0,default_value:0,nbits:"1",forbidden:true,behavior:["MV FLAG_Z VAL_ZERO; FIRE M7","MV FLAG_Z VAL_ONE; FIRE M7"],depends_on:["SELCOP"],fire_name:["svg_p:text3701-3-5"],draw_data:[["svg_p:text3701-3-5"]],draw_name:[[]]};sim.poc.signals["TEST_I"]={name:"TEST_I",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_I VAL_ZERO; FIRE M7","MV FLAG_I VAL_ONE; FIRE M7"],depends_on:["CLK"],fire_name:["svg_cu:text3440"],draw_data:[["svg_cu:text3440"]],draw_name:[[]]};sim.poc.signals["TEST_U"]={name:"TEST_U",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["MV FLAG_U VAL_ZERO; FIRE M7","MV FLAG_U VAL_ONE; FIRE M7"],depends_on:["CLK"],fire_name:["svg_cu:text3442"],draw_data:[["svg_cu:text3442"]],draw_name:[[]]};sim.poc.signals["TEST_INTV"]={name:"TEST_INTV",visible:true,type:"L",value:0,default_value:0,nbits:"8",forbidden:true,behavior:["MBIT INTV TEST_INTV 0 32"],depends_on:["INT"],fire_name:["svg_p:tspan4225"],draw_data:[["svg_p:path3749"]],draw_name:[[]]};sim.poc.behaviors["NOP"]={nparameters:1,operation:function(s_expr){},verbal:function(s_expr){return""}};sim.poc.behaviors["NOP_ALU"]={nparameters:1,operation:function(s_expr){sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){return"Reset ALU flags. "}};sim.poc.behaviors["MV"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="short"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(newval)+"). "}};sim.poc.behaviors["LOAD"]={nparameters:3,types:["X","X"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);newval=get_value(sim_elto_org);set_value(sim_elto_dst,newval)},verbal:function(s_expr){var sim_elto_org=get_reference(s_expr[2]);var newval=get_value(sim_elto_org);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Load from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(newval)+". "}return show_verbal(s_expr[1])+" = "+show_value(newval)+" ( "+show_verbal(s_expr[2])+"). "}};sim.poc.behaviors["CP_FIELD"]={nparameters:3,types:["X","X"],operation:function(s_expr){r=s_expr[2].split("/");sim_elto_org=get_reference(r[0]);newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval!="undefined"){sim_elto_dst=get_reference(s_expr[1]);set_value(sim_elto_dst,newval)}},verbal:function(s_expr){var r=s_expr[2].split("/");var sim_elto_org=get_reference(r[0]);var newval=get_value(sim_elto_org);newval=newval[r[1]];if(typeof newval=="undefined")newval="<undefined>";else newval=show_value(newval);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return'Copy from "'+show_verbal(r[0])+'"['+r[1]+"] "+"to "+show_verbal(s_expr[1])+" (value "+newval+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(r[0])+"."+r[1]+" ("+newval+"). "}};sim.poc.behaviors["NOT_ES"]={nparameters:3,types:["S","E"],operation:function(s_expr){set_value(sim.poc.signals[s_expr[1]],Math.abs(get_value(sim.poc.states[s_expr[2]])-1))},verbal:function(s_expr){var value=Math.abs(get_value(sim.poc.states[s_expr[2]])-1);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Logical NOT of "+s_expr[2]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Logical NOT "+s_expr[2]+"). "}};sim.poc.behaviors["GET"]={nparameters:4,types:["E","E","S"],operation:function(s_expr){set_value(sim.poc.states[s_expr[1]],get_value(sim.poc.states[s_expr[2]][sim.poc.signals[s_expr[3]].value]))},verbal:function(s_expr){var value=get_value(sim.poc.states[s_expr[2]][sim.poc.signals[s_expr[3]].value]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Set "+show_verbal(s_expr[1])+" with value "+show_value(value)+" (Register File "+s_expr[3]+"). "}return show_verbal(s_expr[1])+" = "+show_value(value)+" (Register File "+s_expr[3]+"). "}};sim.poc.behaviors["SET"]={nparameters:4,types:["E","S","E"],operation:function(s_expr){set_value(sim.poc.states[s_expr[1]][sim.poc.signals[s_expr[2]].value],get_value(sim.poc.states[s_expr[3]]))},verbal:function(s_expr){var value=get_value(sim.poc.states[s_expr[3]]);var o_ref=sim.poc.states[s_expr[1]][sim.poc.signals[s_expr[2]].value];var o_verbal=o_ref.name;if(typeof o_ref.verbal!="undefined")o_verbal=o_ref.verbal;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy to "+o_verbal+" the value "+show_value(value)+". "}return o_verbal+" = "+show_value(value)+". "}};sim.poc.behaviors["AND"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])&get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])&get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU AND with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (AND). "}};sim.poc.behaviors["OR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])|get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])|get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU OR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (OR). "}};sim.poc.behaviors["NOT"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=~get_value(sim.poc.states[s_expr[2]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=~get_value(sim.poc.states[s_expr[2]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU NOT with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (NOT). "}};sim.poc.behaviors["XOR"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])^get_value(sim.poc.states[s_expr[3]]);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])^get_value(sim.poc.states[s_expr[3]]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU XOR with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (XOR). "}};sim.poc.behaviors["SRL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Logical with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRL). "}};sim.poc.behaviors["SRA"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Right Arithmetic with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SRA). "}};sim.poc.behaviors["SL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Shift Left with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SL). "}};sim.poc.behaviors["RR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1|(get_value(sim.poc.states[s_expr[2]])&1)<<31;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])>>>1|(get_value(sim.poc.states[s_expr[2]])&1)<<31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Right Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (RR). "}};sim.poc.behaviors["RL"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1|(get_value(sim.poc.states[s_expr[2]])&2147483648)>>>31;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<1|(get_value(sim.poc.states[s_expr[2]])&2147483648)>>>31;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Left Rotation with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LR). "}};sim.poc.behaviors["ADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a+b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a+b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU ADD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (ADD). "}};sim.poc.behaviors["SUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a-b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a-b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU SUB with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (SUB). "}};sim.poc.behaviors["MUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a*b;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a*b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MUL with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MUL). "}};sim.poc.behaviors["DIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){return"ALU DIV zero by zero (oops!). "}var result=Math.floor(a/b);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU DIV with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (DIV). "}};sim.poc.behaviors["MOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=a%b;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){return"ALU MOD zero by zero (oops!). "}var result=a%b;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU MOD with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (MOD). "}};sim.poc.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"ALU Load Upper Immediate with result "+show_value(result)+". "}return"ALU output = "+show_value(result)+" (LUI). "}};sim.poc.behaviors["ADDFOUR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;return"ALU ADD 4 with result "+show_value(result)+". "}};sim.poc.behaviors["ADDONE"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;return"ALU ADD 1 with result "+show_value(result)+". "}};sim.poc.behaviors["SUBFOUR"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-4;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-4;return"ALU SUB 4 with result "+show_value(result)+". "}};sim.poc.behaviors["SUBONE"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-1;set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=a>>>31&&b>>>31;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a-1;return"ALU SUB 1 with result "+show_value(result)+". "}};sim.poc.behaviors["FADD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)+b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)+b.toFixed(2);return"ALU Float ADD with result "+result+". "}};sim.poc.behaviors["FSUB"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)-b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)-b.toFixed(2);return"ALU Float SUB with result "+result+". "}};sim.poc.behaviors["FMUL"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)*b.toFixed(2);set_value(sim.poc.states[s_expr[1]],result>>>0);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_c=0;sim.poc.internal_states.alu_flags.flag_v=0;if(result<0&&a>=0&&b>=0)sim.poc.internal_states.alu_flags.flag_v=1;if(result>=0&&a<0&&b<0)sim.poc.internal_states.alu_flags.flag_v=1},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)*b.toFixed(2);return"ALU Float MUL with result "+result+". "}};sim.poc.behaviors["FDIV"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;if(0==b){set_value(sim.poc.states[s_expr[1]],0);sim.poc.internal_states.alu_flags.flag_n=0;sim.poc.internal_states.alu_flags.flag_z=1;sim.poc.internal_states.alu_flags.flag_v=1;sim.poc.internal_states.alu_flags.flag_c=0;return}var result=Math.floor(a/b);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)/b.toFixed(2);return"ALU Float DIV with result "+result+". "}};sim.poc.behaviors["FMOD"]={nparameters:4,types:["E","E","E"],operation:function(s_expr){var result=(get_value(sim.poc.states[s_expr[2]])<<0)%(get_value(sim.poc.states[s_expr[3]])<<0);set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var b=get_value(sim.poc.states[s_expr[3]])<<0;var result=a.toFixed(2)%b.toFixed(2);return"ALU Float MOD with result "+result+". "}};sim.poc.behaviors["LUI"]={nparameters:3,types:["E","E"],operation:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;set_value(sim.poc.states[s_expr[1]],result);sim.poc.internal_states.alu_flags.flag_n=result<0?1:0;sim.poc.internal_states.alu_flags.flag_z=result==0?1:0;sim.poc.internal_states.alu_flags.flag_v=0;sim.poc.internal_states.alu_flags.flag_c=0},verbal:function(s_expr){var result=get_value(sim.poc.states[s_expr[2]])<<16;return"ALU Load Upper Immediate with result "+show_value(result)+". "}};sim.poc.behaviors["PLUS1"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;set_value(sim.poc.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+1;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Add one to "+show_verbal(s_expr[2])+" and copy to "+show_verbal(s_expr[1])+" with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 1"+" ("+show_value(result)+"). "}};sim.poc.behaviors["PLUS4"]={nparameters:3,types:["E","E"],operation:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;set_value(sim.poc.states[s_expr[1]],result>>>0)},verbal:function(s_expr){var a=get_value(sim.poc.states[s_expr[2]])<<0;var result=a+4;var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Add four to "+show_verbal(s_expr[2])+" and copy to "+show_verbal(s_expr[1])+" with result "+show_value(result)+". "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" + 4"+" ("+show_value(result)+"). "}};sim.poc.behaviors["MBIT"]={nparameters:5,types:["X","X","I","I"],operation:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);set_value(sim_elto_dst,parseInt(n2,2))},verbal:function(s_expr){var sim_elto_dst=get_reference(s_expr[1]);var sim_elto_org=get_reference(s_expr[2]);var offset=parseInt(s_expr[3]);var size=parseInt(s_expr[4]);var n1=get_value(sim_elto_org).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3=parseInt(n2,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[2])+" to "+show_verbal(s_expr[1])+" value "+show_value(n3)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[2])+" ("+show_value(n3)+", "+size+" bits from bit "+offset+"). "}};sim.poc.behaviors["MBIT_SN"]={nparameters:5,types:["S","E","E","I"],operation:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.poc.states[s_expr[3]]);else if(typeof sim.poc.states[r[0]].value[r[1]]!="undefined")base=sim.poc.states[r[0]].value[r[1]];else if(typeof sim.poc.signals[r[1]].default_value!="undefined")base=sim.poc.signals[r[1]].default_value;else if(typeof sim.poc.states[r[1]].default_value!="undefined")base=sim.poc.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.poc.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var base=0;var r=s_expr[3].split("/");if(1==r.length)base=get_value(sim.poc.states[s_expr[3]]);else if(typeof sim.poc.states[r[0]].value[r[1]]!="undefined")base=sim.poc.states[r[0]].value[r[1]];else if(typeof sim.poc.signals[r[1]].default_value!="undefined")base=sim.poc.signals[r[1]].default_value;else if(typeof sim.poc.states[r[1]].default_value!="undefined")base=sim.poc.states[r[1]].default_value;else ws_alert("WARN: undefined state/field pair -> "+r[0]+"/"+r[1]);var offset=parseInt(s_expr[4]);var n1=get_value(sim.poc.states[s_expr[2]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-(base+offset-1),offset);var from_elto="";if(1==r.length)from_elto=show_verbal(s_expr[3]);else from_elto='"'+show_verbal(s_expr[2])+'"['+r[1]+"] ";var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+from_elto+"into "+show_verbal(s_expr[1])+" "+"value "+parseInt(n3,2)+". "}return show_verbal(s_expr[1])+" = "+from_elto+" ("+parseInt(n3,2)+"). "}};sim.poc.behaviors["SBIT_SIGNAL"]={nparameters:4,types:["X","I","I"],operation:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)},verbal:function(s_expr){sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value;var mask=1<>>0)}};sim.poc.behaviors["UPDATE_FLAG"]={nparameters:4,types:["X","X","I"],operation:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var new_value=sim_elto_dst.value&~(1<>>0)},verbal:function(s_expr){sim_elto_org=get_reference(s_expr[2]);sim_elto_dst=get_reference(s_expr[1]);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Update "+show_verbal(s_expr[2])+" to value "+sim_elto_org.value+". "}return show_verbal(s_expr[1])+"."+show_verbal(s_expr[3])+" = "+sim_elto_org.value+". "}};sim.poc.behaviors["MBITS"]={nparameters:8,types:["E","I","E","S","S","I","S"],operation:function(s_expr){var offset=parseInt(sim.poc.signals[s_expr[4]].value);var size=parseInt(sim.poc.signals[s_expr[5]].value);var n1=get_value(sim.poc.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.poc.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}set_value(sim.poc.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var offset=parseInt(sim.poc.signals[s_expr[4]].value);var size=parseInt(sim.poc.signals[s_expr[5]].value);var n1=get_value(sim.poc.states[s_expr[3]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(offset+size-1),size);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;if("1"==sim.poc.signals[s_expr[7]].value&&"1"==n2.substr(0,1)){n3="11111111111111111111111111111111".substring(0,32-n2.length)+n2}n1=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return" Copy from "+show_verbal(s_expr[3])+" to "+show_verbal(s_expr[1])+" value "+show_value(n1)+" (copied "+size+" bits from bit "+offset+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[3])+" ("+show_value(n1)+", "+size+" bits from bit "+offset+"). "}};sim.poc.behaviors["BSEL"]={nparameters:6,types:["E","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;set_value(sim.poc.states[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){var posd=parseInt(s_expr[2]);var len=parseInt(s_expr[3]);var poso=parseInt(s_expr[5]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n2=n2.substr(31-(poso+len)+1,len);var n3="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var n4="00000000000000000000000000000000".substr(0,posd);n3=n3+n4;var n5=parseInt(n3,2);var verbose=get_cfg("verbal_verbose");if(verbose!=="math"){return"Copy from "+show_verbal(s_expr[4])+" to "+show_verbal(s_expr[1])+" value "+show_value(n5)+" (copied "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}return show_verbal(s_expr[1])+" = "+show_verbal(s_expr[4])+" ("+show_value(n5)+", "+len+" bits, from bit "+poso+" of "+s_expr[4]+" to bit "+posd+" of "+s_expr[1]+"). "}};sim.poc.behaviors["EXT_SIG"]={nparameters:3,types:["E","I"],operation:function(s_expr){var n1=get_value(sim.poc.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}set_value(sim.poc.states[s_expr[1]],parseInt(n4,2))},verbal:function(s_expr){var n1=get_value(sim.poc.states[s_expr[1]]).toString(2);var n2="00000000000000000000000000000000".substring(0,32-n1.length)+n1;var n3=n2.substr(31-s_expr[2],31);var n4=n3;if("1"==n2[31-s_expr[2]]){n4="11111111111111111111111111111111".substring(0,32-n3.length)+n4}var n5=parseInt(n4,2);return"Sign Extension with value "+show_value(n5)+". "}};sim.poc.behaviors["MOVE_BITS"]={nparameters:5,types:["S","I","I","S"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=0;var len=parseInt(s_expr[3]);var n1=sim.poc.signals[s_expr[4]].value.toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.poc.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.poc.behaviors["MOVE_BITSE"]={nparameters:6,types:["S","I","I","E","I"],operation:function(s_expr){var posd=parseInt(s_expr[2]);var poso=parseInt(s_expr[5]);var len=parseInt(s_expr[3]);var n1=get_value(sim.poc.states[s_expr[4]]).toString(2);n1="00000000000000000000000000000000".substring(0,32-n1.length)+n1;n1=n1.substr(31-poso-len+1,len);var n2=sim.poc.signals[s_expr[1]].value.toString(2);n2="00000000000000000000000000000000".substring(0,32-n2.length)+n2;var m1=n2.substr(0,32-(posd+len));var m2=n2.substr(31-posd+1,posd);var n3=m1+n1+m2;set_value(sim.poc.signals[s_expr[1]],parseInt(n3,2))},verbal:function(s_expr){return""}};sim.poc.behaviors["DECO"]={nparameters:1,operation:function(s_expr){sim.poc.states["INEX"].value=0;var oi=decode_instruction(sim.poc.internal_states.FIRMWARE,sim.poc.ctrl_states.ir,get_value(sim.poc.states["REG_IR"]));if(null==oi.oinstruction){ws_alert("ERROR: undefined instruction code in IR ("+"co:"+oi.op_code.toString(2)+", "+"cop:"+oi.cop_code.toString(2)+")");sim.poc.states["ROM_MUXA"].value=0;sim.poc.states["INEX"].value=1;return-1}var rom_addr=oi.op_code<<6;if(typeof oi.oinstruction.cop!="undefined"){rom_addr=rom_addr+oi.cop_code}if(typeof sim.poc.internal_states["ROM"][rom_addr]=="undefined"){ws_alert("ERROR: undefined rom address "+rom_addr+" in firmware");sim.poc.states["ROM_MUXA"].value=0;return-1}sim.poc.states["ROM_MUXA"].value=sim.poc.internal_states["ROM"][rom_addr];var val=get_value(sim.poc.states["DECO_INS"]);set_value(sim.poc.states["DECO_INS"],val+1);var pc=get_value(sim.poc.states["REG_PC"])-4;var decins=get_deco_from_pc(pc);set_value(sim.poc.states["REG_IR_DECO"],decins);show_dbg_ir(get_value(sim.poc.states["REG_IR_DECO"]))},verbal:function(s_expr){return"Decode instruction. "}};sim.poc.behaviors["FIRE"]={nparameters:2,types:["S"],operation:function(s_expr){if(sim.poc.internal_states.fire_stack.indexOf(s_expr[1])!=-1){return}sim.poc.internal_states.fire_stack.push(s_expr[1]);update_draw(sim.poc.signals[s_expr[1]],sim.poc.signals[s_expr[1]].value);if("L"==sim.poc.signals[s_expr[1]].type){update_state(s_expr[1])}sim.poc.internal_states.fire_stack.pop(s_expr[1]);check_buses(s_expr[1])},verbal:function(s_expr){return""}};sim.poc.behaviors["FIRE_IFSET"]={nparameters:3,types:["S","I"],operation:function(s_expr){if(get_value(sim.poc.signals[s_expr[1]])!=parseInt(s_expr[2])){return}sim.poc.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.poc.behaviors["FIRE_IFCHANGED"]={nparameters:3,types:["S","X"],operation:function(s_expr){sim_elto=get_reference(s_expr[2]);if(sim_elto.changed==false)return;sim.poc.behaviors["FIRE"].operation(s_expr)},verbal:function(s_expr){return""}};sim.poc.behaviors["RESET_CHANGED"]={nparameters:2,types:["X"],operation:function(s_expr){sim_elto=get_reference(s_expr[1]);sim_elto.changed=false},verbal:function(s_expr){return""}};sim.poc.behaviors["CLOCK"]={nparameters:1,operation:function(s_expr){var new_maddr=null;var mcelto=null;var t0=performance.now();var val=get_value(sim.poc.states["CLK"]);set_value(sim.poc.states["CLK"],val+1);new_maddr=get_value(sim.poc.states["REG_MICROADDR"]);mcelto=sim.poc.internal_states["MC"][new_maddr];if(typeof mcelto!=="undefined"&&false==mcelto.is_native){for(var i=0;i>>0},set_value:function(elto,value){var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var valref=main_memory_set(sim.poc.internal_states.MP,elto,melto);show_main_memory(sim.poc.internal_states.MP,elto,typeof valref==="undefined",true);return value}};sim.poc.internal_states.segments={};sim.poc.internal_states.MP={};sim.poc.internal_states.MP_wc=0;sim.poc.signals.MRDY={name:"MRDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED MRDY C","FIRE_IFCHANGED MRDY C"],fire_name:["svg_p:tspan3916"],draw_data:[[],["svg_p:path3895","svg_p:path3541"]],draw_name:[[],[]]};sim.poc.signals.R={name:"R",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_READ BUS_AB BUS_DB BW MRDY CLK; FIRE M1; FIRE MRDY"],fire_name:["svg_p:text3533-5-2"],draw_data:[[],["svg_p:path3557","svg_p:path3571"]],draw_name:[[],[]]};sim.poc.signals.W={name:"W",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","MEM_WRITE BUS_AB BUS_DB BW MRDY CLK; FIRE M1; FIRE MRDY"],fire_name:["svg_p:text3533-5-08"],draw_data:[[],["svg_p:path3559","svg_p:path3575","svg_p:path3447-7"]],draw_name:[[],[]]};sim.poc.signals.BW={name:"BW",verbal:["Access to one byte from memory. ","Access to two bytes from memory. ","Access to three bytes from memory. ","Access to a word from memory. "],visible:true,type:"L",value:0,default_value:0,nbits:"2",behavior:["FIRE R; FIRE W","FIRE R; FIRE W","FIRE R; FIRE W","FIRE R; FIRE W"],fire_name:["svg_p:text3533-5-2-8"],draw_data:[["svg_p:path3557-0"]],draw_name:[[],[]]};sim.poc.behaviors.MEM_READ={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);sim.poc.signals[s_expr[4]].value=0;var remain=get_var(sim.poc.internal_states.MP_wc);if(typeof sim.poc.events.mem[clk-1]!="undefined"&&sim.poc.events.mem[clk-1]>0){remain=sim.poc.events.mem[clk-1]-1}sim.poc.events.mem[clk]=remain;if(remain>0){return}var wordress=address&4294967292;var value=main_memory_getvalue(sim.poc.internal_states.MP,wordress);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}dbvalue=main_memory_extractvalues(value,bw,address&3);sim.poc.states[s_expr[2]].value=dbvalue>>>0;sim.poc.signals[s_expr[4]].value=1;show_main_memory(sim.poc.internal_states.MP,wordress,full_redraw,false)},verbal:function(s_expr){var verbal="";var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);switch(bw){case 0:bw_type="byte";break;case 1:bw_type="half";break;case 2:bw_type="three bytes";break;case 3:bw_type="word";break}var value=main_memory_getvalue(sim.poc.internal_states.MP,address);if(typeof value==="undefined"){value=0}verbal="Try to read a "+bw_type+" from memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". ";return verbal}};sim.poc.behaviors.MEM_WRITE={nparameters:6,types:["E","E","S","S","E"],operation:function(s_expr){var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);sim.poc.signals[s_expr[4]].value=0;var remain=get_var(sim.poc.internal_states.MP_wc);if(typeof sim.poc.events.mem[clk-1]!="undefined"&&sim.poc.events.mem[clk-1]>0){remain=sim.poc.events.mem[clk-1]-1}sim.poc.events.mem[clk]=remain;if(remain>0){return}var wordress=address&4294967292;var value=main_memory_getvalue(sim.poc.internal_states.MP,wordress);var full_redraw=false;if(typeof value==="undefined"){value=0;full_redraw=true}value=main_memory_updatevalues(value,dbvalue,bw,address&3);var origin="";var r_value=main_memory_get_program_counter();if(r_value!=null){origin="PC=0x"+r_value.toString(16)}var melto={value:value>>>0,source_tracking:[origin],comments:null};var elto=main_memory_set(sim.poc.internal_states.MP,wordress,melto);sim.poc.signals[s_expr[4]].value=1;show_main_memory(sim.poc.internal_states.MP,wordress,full_redraw,true)},verbal:function(s_expr){var verbal="";var address=sim.poc.states[s_expr[1]].value;var dbvalue=sim.poc.states[s_expr[2]].value;var bw=sim.poc.signals[s_expr[3]].value;var clk=get_value(sim.poc.states[s_expr[5]].value);switch(bw){case 0:bw_type="byte";break;case 1:bw_type="half";break;case 2:bw_type="three bytes";break;case 3:bw_type="word";break}var value=main_memory_getvalue(sim.poc.internal_states.MP,address);if(typeof value==="undefined"){value=0}verbal="Try to write a "+bw_type+" to memory "+"at address 0x"+address.toString(16)+" with value "+value.toString(16)+". ";return verbal}};sim.poc.behaviors.MEMORY_RESET={nparameters:1,operation:function(s_expr){sim.poc.events.mem={}},verbal:function(s_expr){return"Reset the memory (all values will be zeroes). "}};sim.poc.components.IO={name:"IO",version:"1",abilities:["IO_TIMER"],details_name:["IO_STATS","IO_CONFIG"],details_fire:[["svg_p:text3775"],[]],write_state:function(vec){return vec},read_state:function(o,check){return false},get_state:function(reg){return null},get_value:function(elto){var associated_state=simhw_internalState_get("io_hash",elto);var value=get_value(simhw_sim_state(associated_state))>>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("IOR"),1);compute_behavior("FIRE IOR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("IOW"),1);compute_behavior("FIRE IOW");return value}};sim.poc.internal_states.io_int_factory=[];sim.poc.internal_states.io_int_factory[0]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[1]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[2]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[3]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[4]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[5]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[6]={period:0,probability:.5,accumulated:0,active:false};sim.poc.internal_states.io_int_factory[7]={period:0,probability:.5,accumulated:0,active:false};var IOSR_ID=4352;var IOCR_ID=4356;var IODR_ID=4360;sim.poc.internal_states.io_hash[IOSR_ID]="IOSR";sim.poc.internal_states.io_hash[IOCR_ID]="IOCR";sim.poc.internal_states.io_hash[IODR_ID]="IODR";sim.poc.states.IOSR={name:"IOSR",verbal:"IO State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.IOCR={name:"IOCR",verbal:"IO Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.IODR={name:"IODR",verbal:"IO Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals.INT={name:"INT",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE C","FIRE C"],fire_name:["svg_p:tspan4199"],draw_data:[[],["svg_p:path3809"]],draw_name:[[],[]]};sim.poc.signals.IORDY={name:"IORDY",visible:true,type:"L",value:0,default_value:0,nbits:"1",depends_on:["CLK"],behavior:["FIRE_IFCHANGED IORDY C","FIRE_IFCHANGED IORDY C"],fire_name:["svg_p:tspan4089","svg_p:path3793","svg_p:tspan4089"],draw_data:[[],["svg_p:path3897"]],draw_name:[[],[]]};sim.poc.signals.IO_IOR={name:"IO_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOR BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE M1"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.IO_IOW={name:"IO_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","IO_IOW BUS_AB BUS_DB IOSR IOCR IODR CLK; FIRE M1"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.IO_IE={name:"IO_IE",visible:true,type:"L",value:1,default_value:1,nbits:"1",behavior:["NOP","IO_CHK_I CLK INT INTV; FIRE C"],fire_name:[],draw_data:[[],[]],draw_name:[[],[]]};sim.poc.signals.INTA={name:"INTA",visible:true,type:"L",value:1,default_value:0,nbits:"1",behavior:["NOP","INTA CLK INT INTA BUS_DB INTV; FIRE M1; FIRE C"],fire_name:["svg_p:text3785-0-6-0-5-5-1-1"],draw_data:[[],["svg_p:path3807","svg_p:path3737"]],draw_name:[[],[]]};sim.poc.behaviors.IO_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==IOSR_ID)set_value(sim.poc.states[s_expr[2]],iosr);if(bus_ab==IOCR_ID)set_value(sim.poc.states[s_expr[2]],iocr);if(bus_ab==IODR_ID)set_value(sim.poc.states[s_expr[2]],iodr)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==IOSR_ID)verbal="I/O device read at IOSR of value "+iosr+". ";if(bus_ab==IOCR_ID)verbal="I/O device read at IOCR of value "+iocr+". ";if(bus_ab==IODR_ID)verbal="I/O device read at IODR of value "+iodr+". ";return verbal}};sim.poc.behaviors.IO_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab!=IOSR_ID&&bus_ab!=IOCR_ID&&bus_ab!=IODR_ID){return}if(bus_ab==IOSR_ID)set_value(sim.poc.states[s_expr[3]],bus_db);if(bus_ab==IOCR_ID)set_value(sim.poc.states[s_expr[4]],bus_db);if(bus_ab==IODR_ID)set_value(sim.poc.states[s_expr[5]],bus_db);var iocr_id=get_value(sim.poc.states[s_expr[4]]);var iodr_id=get_value(sim.poc.states[s_expr[5]]);if(iocr_id<0||iocr_id>7)return;set_var(sim.poc.internal_states.io_int_factory[iocr_id].period,iodr_id);set_var(sim.poc.internal_states.io_int_factory[iocr_id].probability,1);if(0==iodr_id)set_var(sim.poc.internal_states.io_int_factory[iocr_id].probability,0)},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab==IOSR_ID)verbal="I/O device write at IOSR with value "+bus_db+". ";if(bus_ab==IOCR_ID)verbal="I/O device write at IOCR with value "+bus_db+". ";if(bus_ab==IODR_ID)verbal="I/O device write at IODR with value "+bus_db+". ";return verbal}};sim.poc.behaviors.IO_CHK_I={nparameters:4,types:["E","S","E"],operation:function(s_expr){var clk=get_value(sim.poc.states[s_expr[1]]);for(var i=sim.poc.internal_states.io_int_factory.length-1;i>=0;i--){if(get_var(sim.poc.internal_states.io_int_factory[i].period)==0)continue;if(get_var(sim.poc.internal_states.io_int_factory[i].active)==true){set_value(sim.poc.signals[s_expr[2]],1);set_value(sim.poc.states[s_expr[3]],i)}if(clk%get_var(sim.poc.internal_states.io_int_factory[i].period)==0){if(Math.random()>get_var(sim.poc.internal_states.io_int_factory[i].probability))continue;set_var(sim.poc.internal_states.io_int_factory[i].accumulated,get_var(sim.poc.internal_states.io_int_factory[i].accumulated)+1);set_var(sim.poc.internal_states.io_int_factory[i].active,true);if(typeof sim.poc.events.io[clk]=="undefined")sim.poc.events.io[clk]=[];sim.poc.events.io[clk].push(i);set_value(sim.poc.signals[s_expr[2]],1);set_value(sim.poc.states[s_expr[3]],i)}}},verbal:function(s_expr){return"Check I/O Interruption. "}};sim.poc.behaviors.INTA={nparameters:6,types:["E","S","S","E","E"],operation:function(s_expr){var clk=get_value(sim.poc.states[s_expr[1]]);if(typeof sim.poc.events.io[clk]!="undefined"){set_value(sim.poc.states[s_expr[4]],sim.poc.events.io[clk][0]);return}set_value(sim.poc.signals[s_expr[2]],0);set_value(sim.poc.states[s_expr[5]],0);for(var i=0;i>>0;set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_signal("L3DR"),1);compute_behavior("FIRE L3DR");value=get_value(simhw_sim_state("BUS_DB"));return value},set_value:function(elto,value){var associated_state=simhw_internalState_get("io_hash",elto);set_value(simhw_sim_state(associated_state),value);set_value(simhw_sim_state("BUS_AB"),elto);set_value(simhw_sim_state("BUS_DB"),value);set_value(simhw_sim_signal("L3DW"),1);compute_behavior("FIRE L3DW");return value}};sim.poc.internal_states.l3d_dim=4;sim.poc.internal_states.l3d_neltos=Math.pow(sim.poc.internal_states.l3d_dim,3);sim.poc.internal_states.l3d_state=Array.from({length:sim.poc.internal_states.l3d_neltos},(()=>({active:false})));sim.poc.internal_states.l3d_frame="0".repeat(sim.poc.internal_states.l3d_neltos);var L3DSR_ID=8448;var L3DCR_ID=8452;var L3DDR_ID=8456;sim.poc.internal_states.io_hash[L3DSR_ID]="L3DSR";sim.poc.internal_states.io_hash[L3DCR_ID]="L3DCR";sim.poc.internal_states.io_hash[L3DDR_ID]="L3DDR";sim.poc.states.L3DSR={name:"L3DSR",verbal:"L3D State Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.L3DCR={name:"L3DCR",verbal:"L3D Control Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.states.L3DDR={name:"L3DDR",verbal:"L3D Data Register",visible:false,nbits:"32",value:0,default_value:0,draw_data:[]};sim.poc.signals.L3D_IOR={name:"L3D_IOR",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOR BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE M1"],fire_name:["svg_p:tspan4173"],draw_data:[[],["svg_p:path3795","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.signals.L3D_IOW={name:"L3D_IOW",visible:true,type:"L",value:0,default_value:0,nbits:"1",behavior:["NOP","L3D_IOW BUS_AB BUS_DB L3DSR L3DCR L3DDR CLK; FIRE M1; L3D_SYNC"],fire_name:["svg_p:text3785-0-6-0-5-5"],draw_data:[[],["svg_p:path3805","svg_p:path3733"]],draw_name:[[],[]]};sim.poc.behaviors.L3D_IOR={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==L3DCR_ID){set_value(sim.poc.states[s_expr[2]],iocr)}if(bus_ab==L3DDR_ID){set_value(sim.poc.states[s_expr[2]],iodr)}if(bus_ab==L3DCR_ID){var x=(iodr&4278190080)>>24;var y=(iodr&16711680)>>16;var z=(iodr&65280)>>8;var p=z*Math.pow(sim.poc.internal_states.l3d_dim,2)+y*sim.poc.internal_states.l3d_dim+x;var s=get_var(sim.poc.internal_states.l3d_state[p].active);set_value(sim.poc.states[s_expr[2]],s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var iosr=get_value(sim.poc.states[s_expr[3]]);var iocr=get_value(sim.poc.states[s_expr[4]]);var iodr=get_value(sim.poc.states[s_expr[5]]);if(bus_ab==L3DSR_ID)verbal="I/O device read at L3DSR of value "+iosr+". ";if(bus_ab==L3DCR_ID)verbal="I/O device read at L3DCR of value "+iocr+". ";if(bus_ab==L3DDR_ID)verbal="I/O device read at L3DDR of value "+iodr+". ";return verbal}};sim.poc.behaviors.L3D_IOW={nparameters:7,types:["E","E","E","E","E","E"],operation:function(s_expr){var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab!=L3DSR_ID&&bus_ab!=L3DCR_ID&&bus_ab!=L3DDR_ID){return}if(bus_ab==L3DSR_ID){set_value(sim.poc.states[s_expr[3]],bus_db)}if(bus_ab==L3DDR_ID){set_value(sim.poc.states[s_expr[5]],bus_db)}if(bus_ab==L3DCR_ID){set_value(sim.poc.states[s_expr[4]],bus_db);var x=(bus_db&4278190080)>>24;var y=(bus_db&16711680)>>16;var z=(bus_db&65280)>>8;var p=z*Math.pow(sim.poc.internal_states.l3d_dim,2)+y*sim.poc.internal_states.l3d_dim+x;var s=(bus_db&255)!=0;var l3dstates=sim.poc.internal_states.l3d_state;set_var(l3dstates[p].active,s)}},verbal:function(s_expr){var verbal="";var bus_ab=get_value(sim.poc.states[s_expr[1]]);var bus_db=get_value(sim.poc.states[s_expr[2]]);if(bus_ab==L3DSR_ID)verbal="I/O device write at L3DSR with value "+bus_db+". ";if(bus_ab==L3DCR_ID)verbal="I/O device write at L3DCR with value "+bus_db+". ";if(bus_ab==L3DDR_ID)verbal="I/O device write at L3DDR with value "+bus_db+". ";return verbal}};sim.poc.behaviors.L3D_RESET={nparameters:1,operation:function(s_expr){sim.poc.events.l3d={};for(var i=0;i0)line2=context.newlines[context.newlines.length-1]+1;var line1=0;if(context.newlines.length>1)line1=context.newlines[context.newlines.length-2]+1;var lowI=line1;var highI=Math.min(context.t-1,line2+32);for(;typeof context.text[highI+1]!="undefined"&&context.text[highI+1]!="\n";highI++);var line3=highI+2;highI++;for(;typeof context.text[highI+1]!="undefined"&&context.text[highI+1]!="\n";highI++);highI++;context.error="
    "+"
    "+"...\n";for(var i=lowI;i"+"(*) "+i18n_get_TagFor("compiler","PROBLEM AROUND LINE")+" "+context.line+": 
    "+msgError+".
    ";if(typeof ga!=="undefined"){ga("send","event","compile","compile.error","compile.error."+msgError)}return context}function getLabelContext(context){return{t:context.t,line:context.line,newlines:context.newlines.slice()}}function setLabelContext(context,labelContext){context.t=labelContext.t;context.line=labelContext.line;context.newlines=labelContext.newlines}function getComments(context){return context.comments.join("\n")}function resetComments(context){context.comments=[]}function nextNative(context){var first=context.t;var last=context.t;var braces=1;while(context.t",""":'"',"'":"'"};function treatHTMLSequences(text_with_html){var re=null;var key=null;for(key in html_sequences){re=new RegExp(key,"gi");text_with_html=text_with_html.replace(re,html_sequences[key])}return text_with_html}function read_microprg(context){var microprograma=[];var microcomments=[];resetComments(context);if(!isToken(context,"{")){return langError(context,i18n_get_TagFor("compiler","OPEN BRACE NOT FOUND"))}nextToken(context);while(!isToken(context,"}")){var microInstruccionAux={};if(!isToken(context,"(")){var newLabelName=getToken(context);newLabelName=newLabelName.substring(0,newLabelName.length-1);if("TAG"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","LABEL NOT FOUND")+"'"+newLabelName+"'")}for(var contadorMCAux in context.etiquetas){if(context.etiquetas[contadorMCAux]==newLabelName){return langError(context,i18n_get_TagFor("compiler","REPEATED LABEL")+"'"+getToken(context)+"'")}}context.etiquetas[context.contadorMC]=newLabelName;if(newLabelName.match("[a-zA-Z_0-9]*")[0]!=newLabelName){return langError(context,i18n_get_TagFor("compiler","INVALID LABEL FORMAT")+"'"+getToken(context)+"'")}nextToken(context)}if(!isToken(context,"(")){return langError(context,i18n_get_TagFor("compiler","OPEN PAREN. NOT FOUND"))}nextToken(context);while(!isToken(context,")")){var nombre_tok=getToken(context).toUpperCase();if(nombre_tok=="MADDR"){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);var labelsNotFoundAux={};labelsNotFoundAux.nombre=getToken(context);labelsNotFoundAux.cycle=microprograma.length;labelsNotFoundAux.index=context.i;labelsNotFoundAux.instruction=context.instrucciones.length;var etiquetaFounded=0;for(var k in context.etiquetas){if(isToken(context,context.etiquetas[k])){microInstruccionAux[nombre_tok]=k.toString();etiquetaFounded=1}}if(etiquetaFounded==0){context.labelsNotFound.push(labelsNotFoundAux)}nextToken(context);if(isToken(context,","))nextToken(context);continue}if(typeof simhw_sim_signal(nombre_tok)=="undefined"){return langError(context,i18n_get_TagFor("compiler","SIGNAL NOT EXISTS")+"'"+nombre_tok+"'")}if(typeof simhw_sim_signal(nombre_tok).forbidden!="undefined"){return langError(context,nombre_tok+" "+i18n_get_TagFor("compiler","SIGNAL NO DIRECTLY"))}microInstruccionAux[nombre_tok]=1;nextToken(context);if(isToken(context,"=")){nextToken(context);microInstruccionAux[nombre_tok]=parseInt(getToken(context),2);if(getToken(context).match("[01]*")[0]!=getToken(context)){return langError(context,i18n_get_TagFor("compiler","INCORRECT BIN. FORMAT")+"'"+getToken(context)+"'")}if(microInstruccionAux[nombre_tok]>=Math.pow(2,simhw_sim_signal(nombre_tok).nbits)){return langError(context,i18n_get_TagFor("compiler","OUT OF RANGE")+"'"+getToken(context)+"'")}nextToken(context)}if(isToken(context,",")){nextToken(context)}}var acc_cmt=getComments(context);microcomments.push(acc_cmt);resetComments(context);microprograma.push(microInstruccionAux);context.contadorMC++;nextToken(context);if(isToken(context,","))nextToken(context)}if(microprograma.length===0){return langError(context,i18n_get_TagFor("compiler","EMPTY MICROCODE"))}nextToken(context);return{NATIVE:"",microprograma:microprograma,microcomments:microcomments}}function read_native(context){var microprograma=[];var microcomments=[];if(!isToken(context,"{")){return langError(context,i18n_get_TagFor("compiler","OPEN BRACE NOT FOUND"))}nextNative(context);var native_code=getToken(context);microprograma.push({});microcomments.push("");nextToken(context);return{NATIVE:native_code,microprograma:microprograma,microcomments:microcomments}}function find_first_cocop(context,curr_instruction,first_co,last_co){var k=0;var m=0;var ret={};ret.label_co="";ret.label_cop="";var cop_overlaps=false;for(m=0;m100){return langError(context,i18n_get_TagFor("compiler","MORE 100 FIELDS"))}if(auxValue=="co"){return langError(context,i18n_get_TagFor("compiler","CO AS FIELD NAME"))}if(auxValue=="nwords"){return langError(context,i18n_get_TagFor("compiler","NW AS FIELD NAME"))}}if(isToken(context,"(")){firma=firma+",(";if(plus_found)firmaUsuario=firmaUsuario+"+(";else firmaUsuario=firmaUsuario+" (";nextToken(context);if(!isToken(context,",")&&!isToken(context,"(")&&!isToken(context,")")){var campoAux={};campoAux.name=getToken(context);campos.push(campoAux);numeroCampos++;firma=firma+getToken(context);firmaUsuario=firmaUsuario+getToken(context);nextToken(context)}else{return langError(context,i18n_get_TagFor("compiler","MISSING TOKEN ON")+"'"+context.co_cop[instruccionAux.co].signature+"'")}if(isToken(context,")")){firma=firma+")";firmaUsuario=firmaUsuario+")";nextToken(context)}else{return langError(context,i18n_get_TagFor("compiler","MISSING ) ON")+"'"+context.co_cop[instruccionAux.co].signature+"'")}}firma=firma+",";firmaUsuario=firmaUsuario+" "}firma=firma.substr(0,firma.length-1);firma=firma.replace(/,,/g,",");firmaUsuario=firmaUsuario.substr(0,firmaUsuario.length-1);firmaUsuario=firmaUsuario.replace(/ /g," ");instruccionAux.signature=firma;instruccionAux.signatureGlobal=firma;instruccionAux.signatureUser=firmaUsuario;instruccionAux.signatureRaw=firmaUsuario;nextToken(context);if(!isToken(context,"co")){return langError(context,i18n_get_TagFor("compiler","NO CO FIELD"))}nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.co=getToken(context);if(getToken(context).match("[01]*")[0]!=getToken(context)||getToken(context).length!==xr_info.ir.default_eltos.co.length){return langError(context,i18n_get_TagFor("compiler","INCORRECT CO BIN.")+"'"+getToken(context)+"'")}if(instruccionAux.co!=all_ones_co){if(typeof context.co_cop[instruccionAux.co]!=="undefined"&&context.co_cop[instruccionAux.co].cop===null){return langError(context,i18n_get_TagFor("compiler","CO ALREADY USED")+context.co_cop[instruccionAux.co].signature)}if(typeof context.co_cop[instruccionAux.co]=="undefined"){context.co_cop[instruccionAux.co]={};context.co_cop[instruccionAux.co].signature=instruccionAux.signature;context.co_cop[instruccionAux.co].cop=null}}nextToken(context);if(isToken(context,","))nextToken(context);if(isToken(context,"cop")){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.cop=getToken(context);if(getToken(context).match("[01]*")[0]!=getToken(context)){return langError(context,i18n_get_TagFor("compiler","INCORRECT COP BIN.")+"'"+getToken(context)+"'")}if(context.co_cop[instruccionAux.co].cop!=null&&typeof context.co_cop[instruccionAux.co].cop[instruccionAux.cop]!="undefined"){return langError(context,i18n_get_TagFor("compiler","CO+COP ALREADY USED")+"'"+context.co_cop[instruccionAux.co].cop[instruccionAux.cop]+"'")}if(context.co_cop[instruccionAux.co].cop==null)context.co_cop[instruccionAux.co].cop={};context.co_cop[instruccionAux.co].cop[instruccionAux.cop]=instruccionAux.signature;nextToken(context);if(isToken(context,",")){nextToken(context)}}if(!isToken(context,"nwords")){return langError(context,i18n_get_TagFor("compiler","NO NWORDS"))}nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.nwords=getToken(context);nextToken(context);if(isToken(context,","))nextToken(context);var camposInsertados=0;var overlapping={};while(camposInsertados32*parseInt(instruccionAux.nwords)-1){return langError(context,i18n_get_TagFor("compiler","STARTBIT OoR")+"'"+getToken(context)+"'")}nextToken(context);if(!isToken(context,",")){return langError(context,i18n_get_TagFor("compiler","COMMA NOT FOUND"))}nextToken(context);campos[camposInsertados].stopbit=getToken(context);var stop=parseInt(campos[camposInsertados].stopbit);if(stop>32*parseInt(instruccionAux.nwords)){return langError(context,i18n_get_TagFor("compiler","STOPBIT OoR")+"'"+getToken(context)+"'")}for(i=stop;i<=start;i++){if(typeof overlapping[i]!="undefined"){return langError(context,i18n_get_TagFor("compiler","OVERLAPPING FIELD")+campos[camposInsertados].name)}overlapping[i]=1}nextToken(context);if(!isToken(context,")")){return langError(context,i18n_get_TagFor("compiler","CLOSE PAREN. NOT FOUND"))}nextToken(context);if(campos[camposInsertados].type=="address"){if(getToken(context)!="abs"&&getToken(context)!="rel"){return langError(context,i18n_get_TagFor("compiler","INCORRECT ADDRESSING"))}campos[camposInsertados].address_type=getToken(context);nextToken(context)}if(isToken(context,",")){nextToken(context)}camposInsertados++}instruccionAux.fields=campos;instruccionAux.help="";if(isToken(context,"help")){nextToken(context);if(!isToken(context,"=")){return langError(context,i18n_get_TagFor("compiler","EQUAL NOT FOUND"))}nextToken(context);instruccionAux.help=getToken(context);if("STRING"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","UNKNOWN ESCAPE CHAR")+"'"+getToken(context)+"'")}nextToken(context);if(isToken(context,",")){nextToken(context)}}instruccionAux.is_native=false;if(isToken(context,"native")){instruccionAux["is_native"]=true;nextToken(context);if(isToken(context,","))nextToken(context)}if(instruccionAux["is_native"]===false&&typeof instruccionAux.cop!=="undefined"&&instruccionAux.cop.length!==xr_info.ir.default_eltos.cop.length){return langError(context,i18n_get_TagFor("compiler","BAD COP BIN. LEN.")+"'"+getToken(context)+"'")}ret={};if(true==instruccionAux.is_native)ret=read_native(context);else ret=read_microprg(context);if(typeof ret.error!="undefined")return ret;instruccionAux.NATIVE=ret.NATIVE;instruccionAux.microcode=ret.microprograma;instruccionAux.microcomments=ret.microcomments;context.instrucciones.push(instruccionAux);context.contadorMC=context.contadorMC+9;if(!isToken(context,"}")){return langError(context,i18n_get_TagFor("compiler","CLOSE BRACE NOT FOUND"))}nextToken(context)}if(context.stackRegister==null){return langError(context,i18n_get_TagFor("compiler","SP NOT DEFINED"))}var found=false;for(i=0;i=last_co){return langError(context,i18n_get_TagFor("compiler","NO CO CODES"))}first_co=parseInt(r.label_co,2);curr_instruction.co=r.label_co;context.co_cop[r.label_co].signature=curr_instruction.signature;if(r.label_cop!==""){curr_instruction.cop=r.label_cop;context.co_cop[r.label_co].cop[r.label_cop]=curr_instruction.signature;context.co_cop[r.label_co].withcop=true}}var labelsFounded=0;if(context.labelsNotFound.length>0){for(i=0;i0){for(var j=0;j0){file+="registers"+"\n{\n";for(i=0;i1&&n[0]=="0"){return ret}if(typeof n==="string"&&n.includes(".")){return ret}if(!isNaN(parseFloat(n))&&isFinite(n)){ret.isDecimal=true;ret.number=parseInt(n);return ret}return ret}function isOctal(n){var ret={number:0,isDecimal:false};if(n.substring(0,1)=="0"){var octal=n.substring(1).replace(/\b0+/g,"");ret.number=parseInt(octal,8);ret.isDecimal=ret.number.toString(8)===octal;return ret}return ret}function isHex(n){var ret={number:0,isDecimal:false};if(n.substring(0,2).toLowerCase()=="0x"){var hex=n.substring(2).toLowerCase().replace(/\b0+/g,"");if(hex==""){hex="0"}ret.number=parseInt(hex,16);ret.isDecimal=ret.number.toString(16)===hex;return ret}return ret}function isChar(n){var ret={number:0,isDecimal:false};var ret1=treatControlSequences(n);if(true==ret1.error){return ret}var possible_value=ret1.string;if(possible_value[0]=="'"&&possible_value[2]=="'"||possible_value[0]=='"'&&possible_value[2]=='"'){ret.number=possible_value.charCodeAt(1);ret.isDecimal=true;return ret}return ret}function isFloat(n){var ret={number:0,isFloat:false};var non_float=/[a-df-zA-DF-Z]+/;if(non_float.test(n)===true){return ret}ret.number=parseFloat(n);ret.isFloat=!isNaN(ret.number);return ret}function get_decimal_value(possible_value){var ret={number:0,isDecimal:true};ret=isOctal(possible_value);if(ret.isDecimal===false){ret=isHex(possible_value)}if(ret.isDecimal===false){ret=isDecimal(possible_value)}if(ret.isDecimal===false){ret=isChar(possible_value)}return ret}function decimal2binary(number,size){var num_bits=number.toString(2);if(num_bits.length>WORD_LENGTH){return[num_bits,size-num_bits.length]}num_bits=(number>>>0).toString(2);if(number>=0){return[num_bits,size-num_bits.length]}num_bits="1"+num_bits.replace(/^[1]+/g,"");if(num_bits.length>size){return[num_bits,size-num_bits.length]}num_bits="1".repeat(size-num_bits.length)+num_bits;return[num_bits,size-num_bits.length]}function float2binary(f,size){var buf=new ArrayBuffer(8);var float=new Float32Array(buf);var uint=new Uint32Array(buf);float[0]=f;return decimal2binary(uint[0],size)}function get_inm_value(value){var ret1={};var ret={number:0,isDecimal:false,isFloat:false};ret1=get_decimal_value(value);if(ret1.isDecimal==true){ret1.isFloat=false;return ret1}ret1=isFloat(value);if(ret1.isFloat==true){ret1.isDecimal=false;return ret1}return ret}function isValidTag(tag){if(tag.trim()==""){return false}var ret=isDecimal(tag[0]);if(ret.isDecimal==true){return false}var myRegEx=/[^a-z,_\d]/i;return!myRegEx.test(tag)}function sum_array(a){return a.reduce((function(a,b){return a+b}),0)}function get_candidate(advance,instruction){var candidate=false;var candidates={};var signatures={};for(i=0;icandidates[i]){min=candidates[i];candidate=i}}}return candidate?parseInt(candidate):candidate}function reset_assembly(nwords){return"0".repeat(WORD_LENGTH*nwords)}function assembly_replacement(machineCode,num_bits,startbit,stopbit,free_space){var machineCodeAux=machineCode.substring(0,machineCode.length-startbit+free_space);machineCode=machineCodeAux+num_bits+machineCode.substring(machineCode.length-stopbit);return machineCode}function assembly_co_cop(machineCode,co,cop){var xr_info=simhw_sim_ctrlStates_get();if(co!==false)machineCode=assembly_replacement(machineCode,co,WORD_LENGTH,WORD_LENGTH-6,0);if(cop!==false)machineCode=assembly_replacement(machineCode,cop,xr_info.ir.default_eltos.cop.length,0,0);return machineCode}function writememory_and_reset(mp,gen,nwords){if(gen.byteWord>=WORD_BYTES){var melto={value:gen.machineCode,source_tracking:gen.track_source,comments:gen.comments};main_memory_set(mp,"0x"+gen.seg_ptr.toString(16),melto);gen.seg_ptr=gen.seg_ptr+WORD_BYTES;gen.byteWord=0;gen.track_source=[];gen.comments=[];gen.machineCode=reset_assembly(nwords)}}function is_end_of_file(context){return""===getToken(context)&&context.t>=context.text.length}function read_data(context,datosCU,ret){var seg_name=getToken(context);var gen={};gen.byteWord=0;gen.track_source=[];gen.comments=[];gen.machineCode=reset_assembly(1);gen.seg_ptr=ret.seg[seg_name].begin;nextToken(context);while(!is_directive_segment(getToken(context))&&!is_end_of_file(context)){var possible_tag="";while(!is_directive_datatype(getToken(context))&&!is_end_of_file(context)){possible_tag=getToken(context);if("TAG"!=getTokenType(context)){if(""==possible_tag){possible_tag="[empty]"}return langError(context,i18n_get_TagFor("compiler","NO TAG OR DIRECTIVE")+"'"+possible_tag+"'")}var tag=possible_tag.substring(0,possible_tag.length-1);if(!isValidTag(tag)){return langError(context,i18n_get_TagFor("compiler","INVALID TAG FORMAT")+"'"+tag+"'")}if(context.firmware[tag]){return langError(context,i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+tag+"'")}if(ret.labels2[tag]){return langError(context,i18n_get_TagFor("compiler","REPEATED TAG")+"'"+tag+"'")}ret.labels2[tag]="0x"+(gen.seg_ptr+gen.byteWord).toString(16);nextToken(context)}if(is_end_of_file(context)){break}var possible_datatype=getToken(context);if(".word"==possible_datatype||".half"==possible_datatype||".byte"==possible_datatype||".float"==possible_datatype||".double"==possible_datatype){var size=get_datatype_size(possible_datatype);nextToken(context);var possible_value=getToken(context);while(!is_directive(getToken(context))&&!is_end_of_file(context)){var label_found=false;var ret1=get_inm_value(possible_value);var number=ret1.number;if(ret1.isDecimal==false&&ret1.isFloat==false){if(".word"!==possible_datatype){return langError(context,i18n_get_TagFor("compiler","NO NUMERIC DATATYPE")+"'"+possible_value+"'")}if(!isValidTag(possible_value)){return langError(context,i18n_get_TagFor("compiler","INVALID TAG FORMAT")+"'"+possible_value+"'")}if(context.firmware[possible_value]){return langError(context,i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+possible_value+"'")}number=0;label_found=true}if(ret1.isDecimal==true)a=decimal2binary(number,size*BYTE_LENGTH);else a=float2binary(number,size*BYTE_LENGTH);num_bits=a[0];free_space=a[1];if(free_space<0){return langError(context,i18n_get_TagFor("compiler","EXPECTED VALUE")+possible_datatype+"' ("+size*BYTE_LENGTH+" bits), "+i18n_get_TagFor("compiler","BUT INSERTED")+possible_value+"' ("+num_bits.length+" bits) "+i18n_get_TagFor("compiler","INSTEAD"))}writememory_and_reset(ret.mp,gen,1);while((gen.seg_ptr+gen.byteWord)%size!=0){gen.byteWord++;writememory_and_reset(ret.mp,gen,1)}if(""!=possible_tag){ret.labels2[possible_tag.substring(0,possible_tag.length-1)]="0x"+(gen.seg_ptr+gen.byteWord).toString(16);possible_tag=""}if(label_found){ret.labels["0x"+gen.seg_ptr.toString(16)]={name:possible_value,addr:gen.seg_ptr,startbit:31,stopbit:0,rel:undefined,nwords:1,labelContext:getLabelContext(context)}}gen.machineCode=assembly_replacement(gen.machineCode,num_bits,BYTE_LENGTH*(size+gen.byteWord),BYTE_LENGTH*gen.byteWord,free_space);gen.byteWord+=size;gen.track_source.push(possible_value);nextToken(context);if(","==getToken(context)){nextToken(context)}if(is_directive(getToken(context))||"TAG"==getTokenType(context)||"."==getToken(context)[0]){break}possible_value=getToken(context)}}else if(".space"==possible_datatype){nextToken(context);var possible_value=getToken(context);var ret1=isDecimal(possible_value);possible_value=ret1.number;if(ret1.isDecimal==false){return langError(context,i18n_get_TagFor("compiler","NO NUMBER OF BYTES")+"'"+possible_value+"'")}if(possible_value<0){return langError(context,i18n_get_TagFor("compiler","NO POSITIVE NUMBER")+"'"+possible_value+"'")}for(i=0;i=0){return langError(context,i18n_get_TagFor("compiler","INVALID ALIGN VALUE")+"'"+possible_value+"'. "+i18n_get_TagFor("compiler","REMEMBER ALIGN VAL"))}writememory_and_reset(ret.mp,gen,1);var align_offset=Math.pow(2,parseInt(possible_value));switch(align_offset){case 1:break;case 2:if(gen.byteWord&1==1)gen.byteWord++;break;default:writememory_and_reset(ret.mp,gen,1);while(gen.seg_ptr%align_offset!=0||gen.byteWord!=0){gen.byteWord++;writememory_and_reset(ret.mp,gen,1)}}nextToken(context)}else if(".ascii"==possible_datatype||".asciiz"==possible_datatype){nextToken(context);var possible_value=getToken(context);var ret1=treatControlSequences(possible_value);if(true==ret1.error){return langError(context,ret1.string)}possible_value=ret1.string;while(!is_directive(getToken(context))&&!is_end_of_file(context)){writememory_and_reset(ret.mp,gen,1);if('"'!==possible_value[0]){return langError(context,i18n_get_TagFor("compiler","NO QUOTATION MARKS")+"'"+possible_value+"'")}if('"'!==possible_value[possible_value.length-1]){return langError(context,i18n_get_TagFor("compiler","NOT CLOSED STRING"))}if(""==possible_value){return langError(context,i18n_get_TagFor("compiler","NOT CLOSED STRING"))}if("STRING"!=getTokenType(context)){return langError(context,i18n_get_TagFor("compiler","NO QUOTATION MARKS")+"'"+possible_value+"'")}for(i=0;i0){var melto={value:gen.machineCode,source_tracking:gen.track_source,comments:gen.comments};main_memory_set(ret.mp,"0x"+gen.seg_ptr.toString(16),melto);gen.seg_ptr=gen.seg_ptr+WORD_BYTES}ret.seg[seg_name].end=gen.seg_ptr}function read_text(context,datosCU,ret){var seg_name=getToken(context);var seg_ptr=ret.seg[seg_name].begin;var firmware=context.firmware;var pseudoInstructions=context.pseudoInstructions;var finish=[];var isPseudo=false;var pfinish=[];var npseudoInstructions=0;var pseudo_fields={};var counter=-1;var candidate;var error="";var registers={};for(i=0;i=signature_fields[j].length){if("TAG"!=getTokenType(context)&&!firmware[value]&&!is_end_of_file(context)){advance[j]=0}continue}var field=firmware[instruction][j].fields[i];var size=field.startbit-field.stopbit+1;var label_found=false;var sel_found=false;switch(field.type){case"address":case"inm":if(isPseudo&&"sel"==value){counter++;var start=pfinish[counter++];var stop=pfinish[counter++];var value=pseudo_fields[pfinish[counter++]];counter++;sel_found=true}var ret1=get_inm_value(value);converted=ret1.number;if(ret1.isDecimal==false&&ret1.isFloat==false){error=i18n_get_TagFor("compiler","NO NUMERIC DATATYPE")+"'"+value+"'";if(value[0]=="'"){advance[j]=0;break}if(!isValidTag(value)){advance[j]=0;break}if(firmware[value]){error=i18n_get_TagFor("compiler","TAG OR INSTRUCTION")+"'"+value+"'";advance[j]=0;break}label_found=true}if(sel_found){if(ret1.isDecimal==true)res=decimal2binary(converted,WORD_LENGTH);else res=float2binary(converted,WORD_LENGTH);if(res[1]<0){return langError(context,"'"+value+"' "+i18n_get_TagFor("compiler","BIGGER THAN")+WORD_LENGTH+" "+i18n_get_TagFor("compiler","BITS"))}converted="0".repeat(res[1])+res[0];converted=converted.substring(WORD_LENGTH-start-1,WORD_LENGTH-stop);converted=parseInt(converted,2);s[i+1]="0x"+converted.toString(16)}if(!label_found){if(ret1.isDecimal==true)var res=decimal2binary(converted,size);else var res=float2binary(converted,size);if(field.type=="address"&&"rel"==field.address_type){res=decimal2binary(converted-seg_ptr-WORD_BYTES,size)}}break;case"reg":if(typeof value==="undefined"){error=i18n_get_TagFor("compiler","INS. MISSING FIELD");advance[j]=0;break}var aux=false;if(value.startsWith("(")){if("(reg)"!=signature_fields[j][i]){error=i18n_get_TagFor("compiler","UNEXPECTED (REG)");advance[j]=0;break}if(counter==-1){nextToken(context);value=getToken(context)}else{value=pseudo_fields[pfinish[counter++]]}aux=true}else{if("(reg)"==signature_fields[j][i]){error=i18n_get_TagFor("compiler","EXPECTED (REG)")+"'"+value+"'";advance[j]=0;break}}if(typeof registers[value]==="undefined"){error=i18n_get_TagFor("compiler","EXPECTED REG")+"'"+value+"'";advance[j]=0;break}if(aux){s[i+1]="("+value+")";if(counter==-1){nextToken(context);aux=getToken(context)}else{aux=pfinish[counter++]}if(")"!=aux){error=i18n_get_TagFor("compiler","CLOSE PAREN. NOT FOUND");advance[j]=0;break}}var ret1=isDecimal(registers[value]);converted=ret1.number;var res=decimal2binary(converted,size);value=s[i+1];break;default:return langError(context,i18n_get_TagFor("compiler","UNKNOWN 1")+"'"+field.type+"'")}if(advance[j]==1&&!label_found){if(res[1]<0){if(field.type=="address"&&"rel"==field.address_type){error="Relative value ("+(converted-seg_ptr-WORD_BYTES)+" in decimal)"+i18n_get_TagFor("compiler","NEEDS")+res[0].length+i18n_get_TagFor("compiler","SPACE FOR # BITS")+size+" "+i18n_get_TagFor("compiler","BITS")}else{error="'"+value+"'"+i18n_get_TagFor("compiler","NEEDS")+res[0].length+i18n_get_TagFor("compiler","SPACE FOR # BITS")+size+" "+i18n_get_TagFor("compiler","BITS")}advance[j]=0}}if(advance[j]==1&&!(isPseudo&&counter==-1)){binaryAux[j][i]={num_bits:label_found?false:res[0],free_space:label_found?false:res[1],startbit:field.startbit,stopbit:field.stopbit,rel:label_found?field.address_type:false,islabel:label_found,field_name:value}}}if(sum_array(advance)==0){break}if("TAG"==getTokenType(context)||firmware[value]){break}}for(i=0;i0&&i0&&i==firmware[instruction].length-1){format+=" or "}format+="'"+firmware[instruction][i].signatureUser+"'"}if(format==""){format="'"+instruction+"' "+i18n_get_TagFor("compiler","UNKNOWN MC FORMAT")}var sum_res=sum_array(advance);if(sum_res==0){if(advance.length===1){return langError(context,error+".
    "+i18n_get_TagFor("compiler","REMEMBER I. FORMAT")+format)}return langError(context,i18n_get_TagFor("compiler","NOT MATCH MICRO")+"
    "+i18n_get_TagFor("compiler","REMEMBER I. FORMAT")+format+". "+i18n_get_TagFor("compiler","CHECK MICROCODE"))}if(sum_res>1){candidate=get_candidate(advance,firmware[instruction]);if(candidate===false){return langError(context,i18n_get_TagFor("compiler","SEVERAL CANDIDATES")+format)}}if(isPseudo){if(counter==-1){var s_ori=s.join(" ");s_ori=s_ori.trim();var key="";var val="";pseudo_fields={};for(i=0;i1){s_ori=" "}if(pfinish[counter]=="\n"){counter++}}var machineCode=reset_assembly(firmware[instruction][candidate].nwords);machineCode=assembly_co_cop(machineCode,firmware[instruction][candidate].co,firmware[instruction][candidate].cop);for(i=0;i=0;i--){if(icontext.text.length){break}}ret.seg[seg_name].end=seg_ptr}function simlang_compile(text,datosCU){var context={};context.line=1;context.error=null;context.i=0;context.contadorMC=0;context.etiquetas={};context.labelsNotFound=[];context.instrucciones=[];context.co_cop={};context.registers=[];context.text=text;context.tokens=[];context.token_types=[];context.t=0;context.newlines=[];context.pseudoInstructions=[];context.stackRegister=null;context.firmware={};context.comments=[];for(i=0;i=0;j--){var melto={value:machineCode.substring(j*WORD_LENGTH,(j+1)*WORD_LENGTH),source_tracking:null,comments:null};main_memory_set(ret.mp,"0x"+auxAddr.toString(16),melto);auxAddr+=WORD_BYTES}}if(text_found){if(typeof ret.labels2["main"]==="undefined"&&typeof ret.labels2["kmain"]==="undefined"){return langError(context,i18n_get_TagFor("compiler","NO MAIN OR KMAIN"))}}for(var key in ret.labels2){ret.revlabels2[ret.labels2[key]]=key}for(var skey in ret.seg){ret.revseg.push({begin:parseInt(ret.seg[skey].begin),name:skey})}return ret}var WSCFG={};function get_cfg(field){return WSCFG[field].value}function set_cfg(field,value){WSCFG[field].value=value}function update_cfg(field,value){WSCFG[field].value=value;simcore_record_append_new("Set configuration option "+field+" to "+value,'update_cfg("'+field+'","'+value+'");\n');ga("send","event","config","config."+WSCFG.version.value,"config."+WSCFG.version.value+"."+field+"."+value);save_cfg()}function is_cfg_empty(){return Object.keys(WSCFG).length===0}function save_cfg(){try{for(var item in WSCFG){localStorage.setItem("wepsim_"+item,get_cfg(item))}}catch(err){console.log("WepSIM can not save the configuration in a persistent way on this web browser,\n"+"found following error: \n"+err.message)}set_secondary_cfg()}function restore_cfg(){WSCFG=get_primary_cfg();set_secondary_cfg();if(localStorage===null){return}var default_value=null;var saved_value=null;for(var item in WSCFG){if(item==="version"){continue}default_value=get_cfg(item);set_cfg(item,localStorage.getItem("wepsim_"+item));if(WSCFG[item].type!="string"){try{saved_value=JSON.parse(get_cfg(item));set_cfg(item,saved_value)}catch(e){saved_value=null}}if(saved_value===null){set_cfg(item,default_value)}}set_secondary_cfg()}function reset_cfg(){WSCFG=get_primary_cfg();set_secondary_cfg();save_cfg()}function reset_cfg_values(){WSCFG=get_primary_cfg();set_secondary_cfg()}function upgrade_cfg(){var wscfg=get_primary_cfg();var item=null;for(item in wscfg){if(typeof WSCFG[item]==="undefined"){WSCFG[item]=wscfg[item]}if(WSCFG[item].value===null||WSCFG[item].value==="null"){WSCFG[item].value=wscfg[item].value}}if(wscfg.build.value!=WSCFG.build.value){for(item in wscfg){if(wscfg[item].upgrade){WSCFG[item]=wscfg[item]}}}set_secondary_cfg();save_cfg()}function is_mobile(){if(typeof navigator==="undefined"){return false}return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function is_cordova(){return document.URL.indexOf("http://")===-1&&document.URL.indexOf("https://")===-1}function get_primary_cfg(){var wscfg={version:{upgrade:false,type:"string",value:"2.1.5"},build:{upgrade:true,type:"string",value:"2.1.5.20201220A"},color_data_active:{upgrade:false,type:"string",value:"#0066FF"},color_data_inactive:{upgrade:false,type:"string",value:"rgb(0, 0, 0)"},color_name_active:{upgrade:false,type:"string",value:"red"},color_name_inactive:{upgrade:false,type:"string",value:"rgb(0, 0, 0)"},size_active:{upgrade:false,type:"float",value:1.25},size_inactive:{upgrade:false,type:"float",value:.02},is_byvalue:{upgrade:false,type:"boolean",value:false},RF_display_format:{upgrade:false,type:"string",value:"unsigned_16_fill"},RF_display_name:{upgrade:false,type:"string",value:"numerical"},MEM_display_format:{upgrade:true,type:"string",value:"unsigned_16_nofill"},MEM_show_segments:{upgrade:true,type:"boolean",value:false},MEM_show_source:{upgrade:true,type:"boolean",value:false},MEM_display_direction:{upgrade:true,type:"string",value:"h2l"},is_editable:{upgrade:false,type:"boolean",value:true},DBG_delay:{upgrade:false,type:"int",value:5},DBG_level:{upgrade:false,type:"string",value:"microinstruction"},DBG_limitins:{upgrade:false,type:"int",value:1e4},DBG_limitick:{upgrade:false,type:"int",value:1e3},ICON_theme:{upgrade:false,type:"string",value:"classic"},AS_enable:{upgrade:true,type:"boolean",value:true},AS_delay:{upgrade:true,type:"int",value:500},NOTIF_delay:{upgrade:false,type:"int",value:1e3},CPUCU_size:{upgrade:true,type:"int",value:7},C1C2_size:{upgrade:true,type:"int",value:8},SHOWCODE_label:{upgrade:false,type:"boolean",value:true},SHOWCODE_addr:{upgrade:false,type:"boolean",value:true},SHOWCODE_hex:{upgrade:false,type:"boolean",value:true},SHOWCODE_ins:{upgrade:false,type:"boolean",value:true},SHOWCODE_pins:{upgrade:false,type:"boolean",value:true},ws_mode:{upgrade:false,type:"string",value:"newbie"},ws_action:{upgrade:false,type:"string",value:"checkpoint"},is_interactive:{upgrade:false,type:"boolean",value:true},is_quick_interactive:{upgrade:false,type:"boolean",value:false},ws_idiom:{upgrade:false,type:"string",value:"en"},use_voice:{upgrade:false,type:"boolean",value:false},ws_skin_ui:{upgrade:false,type:"string",value:"classic"},ws_skin_user:{upgrade:false,type:"string",value:"only_asm:of:only_frequent:of"},ws_skin_dark_mode:{upgrade:false,type:"boolean",value:false},editor_theme:{upgrade:false,type:"string",value:"default"},editor_mode:{upgrade:false,type:"string",value:"default"},base_url:{upgrade:true,type:"string",value:"https://acaldero.github.io/wepsim/ws_dist/"},cfg_url:{upgrade:true,type:"string",value:"examples/configuration/default.json"},example_url:{upgrade:true,type:"string",value:"examples/examples_set/default.json"},hw_url:{upgrade:true,type:"string",value:"examples/hardware/hw.json"},max_json_size:{upgrade:true,type:"int",value:1*1024*1024},verbal_verbose:{upgrade:false,type:"string",value:"math"}};if(is_mobile()){wscfg.NOTIF_delay.value=2e3;wscfg.ICON_theme.value="cat1";wscfg.CPUCU_size.value=7;wscfg.C1C2_size.value=14;wscfg.ws_skin_ui.value="compact"}return wscfg}function set_secondary_cfg(){var dbg_delay=get_cfg("DBG_delay");if(dbg_delay<5){cfg_show_rf_delay=350;cfg_show_eltos_delay=350;cfg_show_main_memory_delay=450;cfg_show_control_memory_delay=360;cfg_show_dbg_ir_delay=300;cfg_show_rf_refresh_delay=120}else{cfg_show_rf_delay=100;cfg_show_eltos_delay=100;cfg_show_main_memory_delay=150;cfg_show_control_memory_delay=120;cfg_show_dbg_ir_delay=100;cfg_show_rf_refresh_delay=30}cfg_show_asmdbg_pc_delay=50;if(dbg_delay<3)cfg_show_asmdbg_pc_delay=150}var ws_cfg_hash={};var ws_cfg_set=[];function cfgset_init(){var url_list=get_cfg("cfg_url");ws_cfg_set=wepsim_url_getJSON(url_list);for(var i=0;i"+index+"/"+ws_records.length+" "+msg)}if(ws_record_pb_obj!==null){var next_pbval=100*index/ws_records.length;ws_record_pb_obj.css("width",next_pbval+"%").attr("aria-valuenow",next_pbval)}}function simcore_record_playAt(index_current,index_last){if(ws_is_playing===false){simcore_record_showMsg(ws_last_played,"Stopped by user.");return}ws_last_played=index_current;if(index_current>=index_last){simcore_record_showMsg(index_last,"Done.");return}if(ws_records[index_current].description==="_pending event_"){simcore_record_playAt(index_current+1,index_last);return}eval(ws_records[index_current].element);var index_next=index_current+1;simcore_record_showMsg(index_next,ws_records[index_current].description);var wait_time=500;if(index_next0&&ws_records[ws_records.length-1].description==="_pending event_"){distance=ws_glowing_time}simcore_record_pushElto("_pending event_",";",distance)}}function simcore_record_resolve_pending(description,elto){if(ws_is_recording===true){var last_pending=ws_records.length;while(last_pending>0){last_pending--;if(ws_records[last_pending].description==="_pending event_"){break}}if(last_pending===0){simcore_record_setTimeBeforeNow(0);simcore_record_append_new(description,elto);return}ws_records[last_pending].description=description;ws_records[last_pending].element=elto;simcore_record_showMsg(0,"Recording...")}}function simcore_record_setTimeBeforeNow(distance){ws_last_time=Date.now()-distance}function simcore_record_addTimeAfterLast(distance){ws_last_time=ws_last_time+distance}function get_simware(){var cf=simhw_internalState("FIRMWARE");if(typeof cf["firmware"]=="undefined")cf["firmware"]=[];if(typeof cf["mp"]=="undefined")cf["mp"]={};if(typeof cf["seg"]=="undefined")cf["seg"]={};if(typeof cf["labels"]=="undefined")cf["labels"]={};if(typeof cf["labels2"]=="undefined")cf["labels2"]={};if(typeof cf["labels_firm"]=="undefined")cf["labels_firm"]={};if(typeof cf["registers"]=="undefined")cf["registers"]={};if(typeof cf["pseudoInstructions"]=="undefined")cf["pseudoInstructions"]=[];if(typeof cf["stackRegister"]=="undefined")cf["stackRegister"]=null;if(typeof cf["cihash"]=="undefined")cf["cihash"]={};if(typeof cf["cocop_hash"]=="undefined")cf["cocop_hash"]={};if(typeof cf["revlabels"]=="undefined")cf["revlabels"]={};if(typeof cf["revlabels2"]=="undefined")cf["revlabels2"]={};if(typeof cf["revseg"]=="undefined")cf["revseg"]=[];return cf}function set_simware(preWARE){var cf=simhw_internalState("FIRMWARE");if(typeof preWARE["firmware"]!="undefined")cf["firmware"]=preWARE["firmware"];if(typeof preWARE["mp"]!="undefined")cf["mp"]=preWARE["mp"];if(typeof preWARE["registers"]!="undefined")cf["registers"]=preWARE["registers"];if(typeof preWARE["pseudoInstructions"]!="undefined")cf["pseudoInstructions"]=preWARE["pseudoInstructions"];if(typeof preWARE["seg"]!="undefined")cf["seg"]=preWARE["seg"];if(typeof preWARE["labels"]!="undefined")cf["labels"]=preWARE["labels"];if(typeof preWARE["revlabels"]!="undefined")cf["revlabels"]=preWARE["revlabels"];if(typeof preWARE["revlabels2"]!="undefined")cf["revlabels2"]=preWARE["revlabels2"];if(typeof preWARE["labels_firm"]!="undefined")cf["labels_firm"]=preWARE["labels_firm"];if(typeof preWARE["stackRegister"]!="undefined")cf["stackRegister"]=preWARE["stackRegister"];if(typeof preWARE["cihash"]!="undefined")cf["cihash"]=preWARE["cihash"];if(typeof preWARE["cocop_hash"]!="undefined")cf["cocop_hash"]=preWARE["cocop_hash"];if(typeof preWARE["labels2"]!="undefined")cf["labels2"]=preWARE["labels2"];if(typeof preWARE["revseg"]!="undefined")cf["revseg"]=preWARE["revseg"]}function array_includes(arr,val){if(typeof arr.includes!="undefined"){return arr.includes(val)}for(var i=0;i0)tri_name=tri_activated_name;if(tri_activated>1)break}if(tri_activated>0){update_draw(simhw_sim_signal(tri_name),1)}if(simhw_internalState_get("fire_visible","internalbus")==true){update_bus_visibility("internalbus_fire","hidden");simhw_internalState_set("fire_visible","internalbus",false)}if(tri_activated>1){update_bus_visibility("internalbus_fire","visible");simhw_internalState_set("fire_visible","internalbus",true);simhw_sim_state("BUS_IB").value=4294967295}}function fn_updateE_now(key){if("E"==simhw_sim_signal(key).type){update_state(key)}}function fn_updateE_future(key){if(jit_fire_ndep[key]<1)fn_updateE_now(key);else return new Promise((function(resolve,reject){fn_updateE_now(key)}))}function fn_updateL_now(key){update_draw(simhw_sim_signal(key),simhw_sim_signal(key).value);if("L"==simhw_sim_signal(key).type){update_state(key)}}function fn_updateL_future(key){if(jit_fire_ndep[key]<1)fn_updateL_now(key);else return new Promise((function(resolve,reject){fn_updateL_now(key)}))}function update_state(key){var index_behavior=0;switch(simhw_sim_signal(key).behavior.length){case 0:return;break;case 1:index_behavior=0;break;default:index_behavior=simhw_sim_signal(key).value;if(simhw_sim_signal(key).behavior.lengthreg_maddr){break}assoc_i=i}if(-1==assoc_i){ws_alert("A new 'unknown' instruction is inserted,\n"+"please edit it (co, nwords, etc.) in the firmware textarea.");var new_ins=new Object;new_ins["name"]="unknown";new_ins["signature"]="unknown";new_ins["signatureGlobal"]="unknown";new_ins["co"]=0;new_ins["nwords"]=0;new_ins["mc-start"]=0;new_ins["fields"]=new Array;new_ins["microcode"]=new Array;new_ins["microcomments"]=new Array;SIMWARE["firmware"].push(new_ins);assoc_i=SIMWARE["firmware"].length-1}var pos=reg_maddr-parseInt(SIMWARE["firmware"][assoc_i]["mc-start"]);if(typeof SIMWARE["firmware"][assoc_i]["microcode"][pos]=="undefined"){SIMWARE["firmware"][assoc_i]["microcode"][pos]=new Object;SIMWARE["firmware"][assoc_i]["microcomments"][pos]=""}SIMWARE["firmware"][assoc_i]["microcode"][pos][key]=simhw_sim_signal(key).value;if(simhw_sim_signal(key).default_value==simhw_sim_signal(key).value){delete SIMWARE["firmware"][assoc_i]["microcode"][pos][key]}var bits=get_value(simhw_sim_state("REG_IR")).toString(2);bits="00000000000000000000000000000000".substring(0,32-bits.length)+bits;show_memories_values()}function propage_signal_update(key){if(true===get_cfg("is_interactive")){if(simhw_sim_signal(key).value!=simhw_sim_signal(key).default_value)simhw_sim_state("REG_MICROINS").value[key]=simhw_sim_signal(key).value;else delete simhw_sim_state("REG_MICROINS").value[key];var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var curr_maddr=get_value(simhw_sim_state(maddr_name));var mc_obj=simhw_internalState("MC");var mcelto=control_memory_get(mc_obj,curr_maddr);if(typeof mcelto==="undefined"){mcelto={}}mcelto.value[key]=simhw_sim_signal(key).value;mcelto.comments=[];control_memory_set(mc_obj,curr_maddr,mcelto);update_signal_firmware(key);var SIMWARE=get_simware();document.getElementById("inputFirmware").value=saveFirmware(SIMWARE)}compute_behavior("FIRE "+key)}function update_memories(preSIMWARE){var i=0;set_simware(preSIMWARE);var SIMWARE=get_simware();simhw_internalState_reset("MC",{});var mc_obj=simhw_internalState("MC");var mcelto=null;for(i=0;i>23&255)-127;var mantissa=1+(hexvalue&8388607)/8388608;var valuef=sign*mantissa*Math.pow(2,exponent);if(-127===exponent)if(1===mantissa)valuef=sign===1?"+0":"-0";else valuef=sign*((hexvalue&8388607)/8388607)*Math.pow(2,-126);if(128===exponent)if(1===mantissa)valuef=sign===1?"+Inf":"-Inf";else valuef="NaN";return valuef}function hex2char8(hexvalue){var valuec=[];valuec[0]=String.fromCharCode((hexvalue&4278190080)>>24);valuec[1]=String.fromCharCode((hexvalue&16711680)>>16);valuec[2]=String.fromCharCode((hexvalue&65280)>>8);valuec[3]=String.fromCharCode((hexvalue&255)>>0);return valuec}function simcoreui_pack(val,pack_size){var base_str="0".repeat(pack_size);return base_str.substring(0,pack_size-val.length)+val}function hex2bin(hexvalue){var valuebin=hexvalue.toString(2);valuebin=simcoreui_pack(valuebin,32);valuebin=valuebin.substring(0,4)+" "+valuebin.substring(4,8)+" "+valuebin.substring(8,12)+" "+valuebin.substring(12,16)+"
    "+valuebin.substring(16,20)+" "+valuebin.substring(20,24)+" "+valuebin.substring(24,28)+" "+valuebin.substring(28,32);return valuebin}function value2string(format,value){var fmt_value="";var fmt=format.split("_");switch(fmt[0]){case"unsigned":fmt_value=value.toString(fmt[1]).toUpperCase();break;case"float":fmt_value=hex2float(value);break;case"char":fmt_value="'"+String.fromCharCode(value)+"'";break;default:fmt_value=value.toString()}if(fmt[2]==="fill"){fmt_value=simcoreui_pack(fmt_value,8)}return fmt_value}function get_deco_from_pc(pc){var mp_obj=simhw_internalState("MP");if(typeof mp_obj==="undefined"||typeof mp_obj[pc]==="undefined"||typeof mp_obj[pc].source==="undefined"){return""}return mp_obj[pc].source}function get_verbal_from_current_mpc(){var active_signals="";var active_verbal="";var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var curr_maddr=get_value(simhw_sim_state(maddr_name));var mcelto=simhw_internalState_get("MC",curr_maddr);var mins=get_value(mcelto);for(var key in mins){if("MADDR"===key){active_verbal=active_verbal+"MADDR is "+mins[key]+". ";continue}active_signals=active_signals+key+" ";active_verbal=active_verbal+compute_signal_verbals(key,mins[key])}active_signals=active_signals.trim();if(active_signals==="")active_signals="";if(active_verbal.trim()==="")active_verbal="";return"Activated signals are: "+active_signals+". Associated actions are: "+active_verbal}function get_verbal_from_current_pc(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=get_value(simhw_sim_state(pc_name));var pc=parseInt(reg_pc)-4;var decins=get_deco_from_pc(pc);if(""==decins.trim()){decins="not jet defined"}return"Current instruction is: "+decins+" and PC points to "+show_value(pc)+". "}function ko_observable(initial_value){if(typeof ko==="undefined"){return initial_value}if(typeof cfg_show_rf_refresh_delay==="undefined"){cfg_show_rf_refresh_delay=120}return ko.observable(initial_value).extend({rateLimit:cfg_show_rf_refresh_delay})}function ko_rebind_state(state,id_elto){if(typeof ko==="undefined"){return}if(typeof cfg_show_rf_refresh_delay==="undefined"){cfg_show_rf_refresh_delay=120}var state_obj=simhw_sim_state(state);if(typeof state_obj.value!=="function"){state_obj.value=ko.observable(state_obj.value).extend({rateLimit:cfg_show_rf_refresh_delay})}var ko_context=document.getElementById(id_elto);ko.cleanNode(ko_context);ko.applyBindings(simhw_sim_state(state),ko_context)}function show_rf_names(){return simcore_action_ui("CPU",0,"show_rf_names")()}function get_screen_content(){return simcore_action_ui("SCREEN",0,"get_screen_content")()}function set_screen_content(screen){simcore_action_ui("SCREEN",0,"set_screen_content")(screen)}function get_keyboard_content(){return simcore_action_ui("KBD",0,"get_keyboard_content")()}function set_keyboard_content(keystrokes){simcore_action_ui("KBD",0,"set_keyboard_content")(keystrokes)}function show_main_memory(memory,index,redraw,updates){return simcore_action_ui("MEMORY",0,"show_main_memory")(memory,index,redraw,updates)}function show_control_memory(memory,index,redraw){return simcore_action_ui("MEMORY",0,"show_control_memory")(memory,index,redraw)}function show_memories_values(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=get_value(simhw_sim_state(pc_name));show_main_memory(simhw_internalState("MP"),reg_pc,true,true);var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var reg_maddr=get_value(simhw_sim_state(maddr_name));show_control_memory(simhw_internalState("MC"),reg_maddr,true)}function update_draw(obj,value){return simcore_action_ui("CPU",1,"update_draw")(obj,value)}function update_bus_visibility(bus_name,value){return simcore_action_ui("CPU",1,"update_bus_visibility")(bus_name,value)}function refresh(){for(var key in simhw_sim_signals()){update_draw(simhw_sim_signals()[key],simhw_sim_signals()[key].value);check_buses(key)}show_dbg_ir(get_value(simhw_sim_state("REG_IR_DECO")))}function show_dbg_ir(value){return simcore_action_ui("MEMORY",0,"show_dbg_ir")(value)}function show_dbg_mpc(){return simcore_action_ui("MEMORY",0,"show_dbg_mpc")()}function show_asmdbg_pc(){return simcore_action_ui("MEMORY",0,"show_asmdbg_pc")()}function ws_alert(msg){if(typeof document==="undefined"){console.log(msg);return true}alert(msg);return true}function element_scroll_get(list_id){var offset=0;var obj_byid=$(list_id);if(obj_byid.length>0){offset=obj_byid[0].scrollTop}return offset}function element_scroll_set(list_id,offset){var obj_byid=$(list_id);if(obj_byid.length>0){obj_byid[0].scrollTop=offset}}function element_scroll_setRelative(list_id,obj_id,offset){var obj_byid=$(obj_id);if(obj_byid.length>0){var topPos=obj_byid[0].offsetTop;element_scroll_set(list_id,topPos+offset)}}function simcore_init(with_ui){var ret={};ret.msg="";ret.ok=true;if(with_ui){restore_cfg()}else{reset_cfg_values()}return ret}function simcore_init_hw(simhw_name){var ret={};ret.msg="";ret.ok=true;var hwid=simhw_getIdByName(simhw_name);if(hwid<0){ret.msg="ERROR: unknown hardware: "+simhw_name+".
    \n";ret.ok=false;return ret}simhw_setActive(hwid);var ret1=simcore_init_ui({});if(false===ret1.ok){ret.msg=ret.msg;ret.ok=false;return ret}return ret}function simcore_welcome(){var ret={};ret.msg="";ret.ok=true;console.log("");console.log("██╗ ██╗███████╗██████╗ ███████╗██╗███╗ ███╗");console.log("██║ ██║██╔════╝██╔══██╗██╔════╝██║████╗ ████║");console.log("██║ █╗ ██║█████╗ ██████╔╝███████╗██║██╔████╔██║");console.log("██║███╗██║██╔══╝ ██╔═══╝ ╚════██║██║██║╚██╔╝██║");console.log("╚███╔███╔╝███████╗██║ ███████║██║██║ ╚═╝ ██║");console.log(" ╚══╝╚══╝ ╚══════╝╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝");console.log("");console.log("Stable: https://github.com/wepsim/wepsim");console.log("Beta: https://github.com/acaldero/wepsim");console.log("");return ret}function simcore_init_ui(hash_detail2init){var ret={};ret.msg="";ret.ok=true;var detail_id=0;var sim_components=simhw_sim_components();for(var elto in sim_components){sim_components[elto].details_ui=[];for(var index in sim_components[elto].details_name){sim_components[elto].details_ui[index]={};detail_id=sim_components[elto].details_name[index];if(typeof hash_detail2init[detail_id]!=="undefined"){sim_components[elto].details_ui[index]=hash_detail2init[detail_id];sim_components[elto].details_ui[index].init()}}}return ret}function simcore_action_ui(component_name,detail_id,action_name){var sim_components=simhw_sim_components();if(typeof sim_components[component_name].details_ui[detail_id][action_name]==="undefined"){return simcore_do_nothing_handler}return sim_components[component_name].details_ui[detail_id][action_name]}function simcore_init_eventlistener(context,hash_detail2action,hash_signal2action){var context_obj=null;var r=[];var o=null;context_obj=document.getElementById(context).contentDocument;if(null==context_obj){console.log('warning: unreferenced graphic element context named "'+r[0]+'".');return}var sim_signals=simhw_sim_signals();for(var key in sim_signals){if(typeof hash_signal2action[key+"click"]==="undefined"){hash_signal2action[key+"click"]=function(key_value){return function(){hash_signal2action[""](key_value,"click")}}(key)}if(typeof hash_signal2action[key+"dblclick"]==="undefined"){hash_signal2action[key+"dblclick"]=function(key_value){return function(){hash_signal2action[""](key_value,"dblclick")}}(key)}for(var j=0;j\n"+"Please load some assembly code.
    ";ret.ok=false;return ret}var SIMWARE=get_simware();if(!(typeof curr_segments[".ktext"]!="undefined"&&SIMWARE.labels2.kmain)&&!(typeof curr_segments[".text"]!="undefined"&&SIMWARE.labels2.main)){ret.msg="labels 'kmain' (in .ktext) or 'main' (in .text) do not exist!";ret.ok=false;return ret}return ret}function simcore_check_if_can_continue2(reg_maddr,reg_pc){var ret={};ret.ok=true;ret.msg="";var curr_MC=simhw_internalState("MC");var mcelto=control_memory_get(curr_MC,reg_maddr);if(typeof mcelto==="undefined"){var hex_maddr="0x"+parseInt(reg_maddr).toString(16);ret.ok=false;ret.msg="Error: undefined microinstruction at "+hex_maddr+".";return ret}var curr_segments=simhw_internalState("segments");if(reg_pc=curr_segments[".ktext"].begin){return ret}if(reg_pc=curr_segments[".text"].begin){return ret}if(mcelto.is_native&&0===reg_maddr){return ret}if(0!==reg_maddr){if(reg_pc==curr_segments[".ktext"].end||reg_pc==curr_segments[".text"].end){return ret}}ret.ok=false;ret.msg="The program has finished because the PC register points outside .ktext/.text code segments";return ret}function simcore_check_if_can_continue(){var pc_name=simhw_sim_ctrlStates_get().pc.state;var reg_pc=parseInt(get_value(simhw_sim_state(pc_name)));var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var reg_maddr=get_value(simhw_sim_state(maddr_name));return simcore_check_if_can_continue2(reg_maddr,reg_pc)}function simcore_reset(){var ret={};ret.msg="";ret.ok=true;var SIMWARE=get_simware();var curr_firm=simhw_internalState("FIRMWARE");var curr_segments=simhw_internalState("segments");var curr_MC=simhw_internalState("MC");var sim_components=simhw_sim_components();var ctrl_states=simhw_sim_ctrlStates_get();var pc_name=ctrl_states.pc.state;var pc_state=simhw_sim_state(pc_name);var sp_name=ctrl_states.sp.state;var sp_state=simhw_sim_state(sp_name);if(curr_firm.stackRegister!=null){sp_name=curr_firm.stackRegister;sp_state=simhw_sim_states().BR[sp_name];ctrl_states.sp.state="BR."+curr_firm.stackRegister}for(var elto in sim_components){var reset_signal_name=sim_components[elto].name+"_RESET";compute_general_behavior(reset_signal_name)}if(typeof curr_segments[".ktext"]!=="undefined"&&SIMWARE.labels2.kmain){set_value(pc_state,parseInt(SIMWARE.labels2.kmain));show_asmdbg_pc()}else if(typeof curr_segments[".text"]!=="undefined"&&SIMWARE.labels2.main){set_value(pc_state,parseInt(SIMWARE.labels2.main));show_asmdbg_pc()}if(typeof curr_segments[".stack"]!=="undefined"&&typeof sp_state!=="undefined"){set_value(sp_state,parseInt(curr_segments[".stack"].end)&4294967292)}var new_maddr=get_value(simhw_sim_state("MUXA_MICROADDR"));var mcelto=control_memory_get(curr_MC,new_maddr);if(typeof mcelto==="undefined"){mcelto={value:simhw_sim_state("REG_MICROINS").default_value,is_native:false}}var new_mins=get_value(mcelto);if(false==mcelto.is_native){compute_general_behavior("CLOCK")}show_dbg_ir(get_value(simhw_sim_state("REG_IR_DECO")));for(elto in sim_components){for(var index in sim_components[elto].details_name){if(typeof sim_components[elto].details_ui[index].reset!=="undefined"){sim_components[elto].details_ui[index].reset()}}}return ret}function simcore_execute_microinstruction(){var ret=simcore_check_if_can_continue();if(false===ret.ok){return ret}compute_general_behavior("CLOCK");show_dbg_mpc();return ret}function simcore_execute_microinstruction2(reg_maddr,reg_pc){var ret=simcore_check_if_can_continue2(reg_maddr,reg_pc);if(false===ret.ok){return ret}compute_general_behavior("CLOCK");show_dbg_mpc();return ret}function simcore_execute_microprogram(options){var ret=simcore_check_if_can_continue();if(false===ret.ok){return ret}var before_state=null;var after_state=null;var curr_mpc="";var curr_MC=simhw_internalState("MC");var maddr_name=simhw_sim_ctrlStates_get().mpc.state;var maddr_state=simhw_sim_state(maddr_name);if(typeof options.before_microinstruction==="undefined"){options.before_microinstruction=simcore_do_nothing_handler}if(typeof options.after_microinstruction==="undefined"){options.after_microinstruction=simcore_do_nothing_handler}var i_clks=0;var limitless=options.cycles_limit<0;var cur_addr=0;var mcelto=null;do{options.before_microinstruction(curr_MC,cur_addr);compute_general_behavior("CLOCK");i_clks++;options.after_microinstruction(curr_MC,cur_addr);if(limitless===false&&i_clks>=options.cycles_limit){ret.msg="Warning: clock cycles limit reached in a single instruction.";ret.ok=false;break}cur_addr=get_value(maddr_state);mcelto=control_memory_get(curr_MC,cur_addr);if(typeof mcelto==="undefined"){ret.msg="Error: undefined microinstruction at "+cur_addr+".";ret.ok=false;break}}while(i_clks=code_begin||reg_pc=kcode_begin){options.before_instruction(SIMWARE,reg_pc);ret1=simcore_execute_microprogram(options);if(false===ret1.ok){return ret1}options.after_instruction(SIMWARE,reg_pc);ins_executed++;if(ins_executed>options.instruction_limit){ret.ok=false;ret.msg="more than "+options.instruction_limit+" instructions executed before application ends.";return ret}reg_pc_before=reg_pc;reg_pc=get_value(pc_state)}return ret}function simcore_do_nothing_handler(){return null}function simcore_compile_firmware(textToMCompile){var ret={};ret.msg="";ret.ok=true;if(""==textToMCompile){ret.msg="Empty Firmware";ret.ok=false;return ret}var preSM=null;try{preSM=loadFirmware(textToMCompile);ret.simware=preSM}catch(e){ret.msg="ERROR: at line: "+e.lineNumber+" and column: "+e.columnNumber;ret.ok=false;return ret}if(preSM.error!=null){ret.msg=preSM.error;ret.ok=false;return ret}update_memories(preSM);simcore_reset();return ret}function simcore_compile_assembly(textToCompile){var ret={};ret.msg="";ret.ok=true;var SIMWARE=get_simware();if(SIMWARE.firmware.length===0){ret.msg="Empty microcode, please load the microcode first.";ret.ok=false;return ret}var SIMWAREaddon=simlang_compile(textToCompile,SIMWARE);ret.simware=SIMWAREaddon;if(SIMWAREaddon.error!=null){ret.msg=SIMWAREaddon.error;ret.ok=false;return ret}set_simware(SIMWAREaddon);update_memories(SIMWARE);simcore_reset();return ret}function simcore_hardware_export(hw_name){var ret={};ret.msg="{}";ret.ok=false;var hw_obj=simhw_getObjByName(hw_name);if(null===hw_obj){return ret}ret.ok=true;ret.msg=JSON.stringify(hw_obj,(function(key,value){if(typeof value==="function"){return"/Function("+value.toString()+")/"}return value}));return ret}function simcore_hardware_import(hw_json){var ret={};ret.msg="";ret.ok=true;hw_obj=JSON.parse(hw_json,(function(key,value){if(typeof value==="string"&&value.startsWith("/Function(")&&value.endsWith(")/")){value=value.substring(10,value.length-2);return eval("("+value+")")}return value}));simhw_add(hw_obj);return ret}function simcore_native_get_signal(elto){return get_value(simhw_sim_signal(elto))>>>0}function simcore_native_set_signal(elto,value){set_value(simhw_sim_signal(elto),value);compute_behavior("FIRE "+elto);return value}function simcore_native_get_value(component,elto){var index=0;var sim_components=simhw_sim_components();var compo_index=component;if("BR"===component)compo_index="CPU";if("DEVICE"===component)compo_index="IO";if(typeof sim_components[compo_index].get_value!=="undefined"){return sim_components[compo_index].get_value(elto)}return false}function simcore_native_set_value(component,elto,value){var index=0;var sim_components=simhw_sim_components();var compo_index=component;if("BR"===component)compo_index="CPU";if("DEVICE"===component)compo_index="IO";if(typeof sim_components[compo_index].set_value!=="undefined"){return sim_components[compo_index].set_value(elto,value)}return false}function simcore_native_get_fields(signature_raw){var SIMWARE=get_simware();for(var key in SIMWARE.firmware){if(SIMWARE.firmware[key].signatureRaw===signature_raw){return SIMWARE.firmware[key].fields}}}function simcore_native_get_field_from_ir(fields,index){if(typeof fields[index]==="undefined"){ws_alert("simcore_native_get_field_from_ir: index ("+index+") out of range.");return false}var value=get_value(simhw_sim_state("REG_IR"));var left_shift=31-parseInt(fields[index].startbit);var right_shift=parseInt(fields[index].stopbit);value=value<>>left_shift;value=value>>>right_shift;return value}function simcore_native_deco(){compute_behavior("DECO")}function simcore_native_go_maddr(maddr){set_value(simhw_sim_state("MUXA_MICROADDR"),maddr)}function simcore_native_go_opcode(){var maddr=get_value(simhw_sim_state("ROM_MUXA"));set_value(simhw_sim_state("MUXA_MICROADDR"),maddr)}function simcore_native_go_instruction(signature_raw){var SIMWARE=get_simware();for(var key in SIMWARE.firmware){if(SIMWARE.firmware[key].signatureRaw===signature_raw){var maddr=SIMWARE.firmware[key]["mc-start"];set_value(simhw_sim_state("MUXA_MICROADDR"),maddr);return}}}function simcore_simstate_checklist2state(checklist){var o={};var ret=false;checklist=checklist.replace(/;|==|!=|>=|<=|=|>|v!=""));for(var i=0;i"===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)>parseInt(diff.expected);else if("<"===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)="===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)>=parseInt(diff.expected);else if("<="===expected_result[compo][elto].op)diff.fulfill=parseInt(diff.obtained)<=parseInt(diff.expected);else if("=="===expected_result[compo][elto].op)diff.fulfill=diff.expected==diff.obtained;else if("!="===expected_result[compo][elto].op)diff.fulfill=diff.expected!=diff.obtained;d.result.push(diff);if(diff.fulfill===false)d.errors++}}if(newones_too&&typeof obtained_result[compo]!="undefined"){for(elto in obtained_result[compo]){d.neltos_obtained++;if(typeof expected_result[compo]!="undefined"&&typeof expected_result[compo][elto]!="undefined"){continue}diff={};diff.expected=obtained_result[compo][elto].default_value;diff.obtained=obtained_result[compo][elto].value;diff.fulfill=diff.expected===diff.obtained;diff.elto_type=compo.toLowerCase();diff.elto_id=obtained_result[compo][elto].id;diff.elto_op="=";d.result.push(diff);if(diff.fulfill===false)d.errors++}}}return d}function simcore_simstate_diff_results(expected_result,obtained_result){return simcore_simstate_check_results(expected_result,obtained_result,true)}function simcore_simstate_diff_states(before_state_obj,after_state_obj){var before_arr=simcore_simstate_state2checklist(before_state_obj,"").split(";");var after_arr=simcore_simstate_state2checklist(after_state_obj,"").split(";");return after_arr.filter((function(elto){return!before_arr.includes(elto)})).join(";").trim()}function simcore_simstate_checkreport2txt(checklist){var o="";for(var i=0;i"+""+""+"Type"+"IdentificationId."+"Values in the clipboard state"+"Values in the selected state"+""+""+"";for(var i=0;i"+""+checklist[i].elto_type+""+""+checklist[i].elto_id+""+""+checklist[i].elto_op+" "+checklist[i].expected+""+""+checklist[i].obtained+""+""}o+=""+"";return o}function simcore_voice_canSpeak(){if(typeof window.speechSynthesis=="undefined"){return false}if(false===get_cfg("use_voice")){return false}return true}function simcore_voice_speak(msg){var ssu=null;if(simcore_voice_canSpeak()){ssu=new SpeechSynthesisUtterance(msg);ssu.lang="es-ES";if("en"==get_cfg("ws_idiom"))ssu.lang="en-US";if("es"==get_cfg("ws_idiom"))ssu.lang="es-EN";window.speechSynthesis.speak(ssu)}}function simcore_voice_stopSpeak(){if(simcore_voice_canSpeak()){window.speechSynthesis.cancel()}}var simcore_rest={};function simcore_rest_reset(){simcore_rest={}}function simcore_rest_add(name,description){simcore_rest[name]={endpoint:description.endpoint,user:description.user,pass:description.pass,last_request:null}}function simcore_rest_list(){return simcore_rest}function simcore_rest_get(name){return simcore_rest[name]}function simcore_rest_call(name,method,uri,data){var rest_info=simcore_rest[name];if(typeof rest_info==="undefined"){return false}var api_endpoint=rest_info.endpoint;if(typeof api_endpoint=="function"){api_endpoint=api_endpoint()}if(api_endpoint.trim()===""){return false}var basic_auth="Basic "+btoa(rest_info.user+":"+rest_info.pass);var enc_data=JSON.stringify(data);var request={url:api_endpoint+uri,type:method,contentType:"application/json",accepts:"application/json",cache:false,dataType:"json",data:enc_data,beforeSend:function(xhr){if(rest_info.user.trim()!==""){xhr.setRequestHeader("Authorization",basic_auth)}},error:function(jqXHR){console.log("ajax error "+jqXHR.status)}};rest_info.last_request=$.ajax(request);return true}var simcore_notifications=[];function simcore_notifications_get(){return simcore_notifications}function simcore_notifications_reset(){simcore_notifications=[]}function simcore_notifications_add2(ntf){simcore_notifications.push({title:ntf.title,message:ntf.message,type:ntf.type,date:ntf.date})}function simcore_notifications_add(ntf_title,ntf_message,ntf_type,ntf_delay){simcore_notifications.push({title:$("

    ").html(ntf_title).text(),message:$("

    ").html(ntf_message).text(),type:ntf_type,date:(new Date).getTime()})}function get_value(sim_obj){if(typeof sim_obj.value=="function"){return sim_obj.value()}return sim_obj.value}function set_value(sim_obj,value){if(typeof sim_obj.value=="function"){if(sim_obj.value()!=value)sim_obj.changed=true;sim_obj.value(value)}else{if(sim_obj.value!=value)sim_obj.changed=true;sim_obj.value=value}}function reset_value(sim_obj){if(typeof sim_obj.value=="function"){if(sim_obj.value()!=sim_obj.default_value)sim_obj.changed=true;set_value(sim_obj,sim_obj.default_value)}else if(typeof sim_obj.default_value=="object"){sim_obj.changed=true;sim_obj.value=Object.create(sim_obj.default_value)}else if(sim_obj instanceof Array){sim_obj.changed=true;for(var i=0;i1;melto.breakpoint=melto.breakpoint||comments_str.trim().split("break:").length>1;melto.notify=comments_str.trim().split("notify:");for(var k=0;k1;melto.breakpoint=melto.breakpoint||comments_str.trim().split("break:").length>1;melto.notify=comments_str.trim().split("notify:");for(var k=0;k>8;if(2==filter_elto)dbvalue=(value&16711680)>>16;if(3==filter_elto)dbvalue=(value&4278190080)>>24;break;case 1:if(0==filter_elto)dbvalue=value&65535;if(1==filter_elto)dbvalue=value&65535;if(2==filter_elto)dbvalue=(value&4294901760)>>16;if(3==filter_elto)dbvalue=(value&4294901760)>>16;break;case 2:if(0==filter_elto)dbvalue=value&16777215;if(1==filter_elto)dbvalue=value&4294967040;break;case 3:dbvalue=value;break}return dbvalue}function main_memory_updatevalues(value,dbvalue,filter_size,filter_elto){switch(filter_size){case 0:if(0==filter_elto)value=value&4294967040|dbvalue&255;if(1==filter_elto)value=value&4294902015|(dbvalue&255)<<8;if(2==filter_elto)value=value&4278255615|(dbvalue&255)<<16;if(3==filter_elto)value=value&16777215|(dbvalue&255)<<24;break;case 1:if(0==filter_elto)value=value&4294901760|dbvalue&65535;if(1==filter_elto)value=value&4294901760|dbvalue&65535;if(2==filter_elto)value=value&65535|(dbvalue&65535)<<16;if(3==filter_elto)value=value&65535|(dbvalue&65535)<<16;break;case 2:if(0==filter_elto)value=value&4278190080|dbvalue&16777215;if(1==filter_elto)value=value&255|dbvalue&4294967040;break;case 3:value=dbvalue;break}return value}function main_memory_get_program_counter(){var r_ref=simhw_sim_ctrlStates_get().pc;var r_value=null;if(typeof r_ref!=="undefined"){r_ref=simhw_sim_state(r_ref.state)}if(typeof r_ref!=="undefined"){r_value=get_value(r_ref)}return r_value}function main_memory_get_baseaddr(){var r_ref=simhw_sim_ctrlStates_get();if(typeof r_ref==="undefined"){return null}var parts=null;var r_value=0;var r_ref2=null;var all_baseaddr={};for(var elto in r_ref){if(r_ref[elto].is_pointer==false){continue}parts=r_ref[elto].state.split(".");if(parts[0]=="BR"){r_value=4294967292;r_ref2=simhw_sim_states().BR[parts[1]]}else{r_value=0;r_ref2=simhw_sim_state(r_ref[elto].state)}if(typeof r_ref2!=="undefined"){r_value=get_value(r_ref2)}all_baseaddr[elto]=r_value}return all_baseaddr}var i18n={lang:{en:"English",es:"Español",it:"L'italiano - Google-translate",kr:"한국어 - Google-translate",hi:"हिन्दी - Google-translate",fr:"Français - Google-translate",pt:"Português - Google-translate",ja:"日本語 - Google-translate",zh_cn:"汉语 - Google-translate",ru:"русский язык - Google-translate",sv:"Svenska - Google-translate",de:"Deutsch - Google-translate"},eltos:{gui:{},cfg:{},examples:{},states:{},help:{},dialogs:{},compiler:{},tutorial_welcome:{},tutorial_simpleusage:{},tour_intro:{}}};function i18n_init(){for(var l in i18n.lang){for(var e in i18n.eltos){i18n.eltos[e][l]={}}}return true}i18n_init();function i18n_update_tags(component){var ws_idiom=get_cfg("ws_idiom");i18n_update_tagsFor(component,ws_idiom)}function i18n_update_tagsFor(component,lang){if(typeof i18n.eltos[component]=="undefined"){return}var tags=document.querySelectorAll("span");Array.from(tags).forEach((function(value,index){var key=value.dataset.langkey;if(i18n.eltos[component][lang][key]){value.innerHTML=i18n.eltos[component][lang][key]}}))}function i18n_get(component,lang,key){if(typeof i18n.eltos[component]==="undefined"){return key}var translation=i18n.eltos[component][lang][key];if(typeof translation==="undefined"){return key}return translation}function i18n_get_TagFor(component,key){var ws_idiom;try{ws_idiom=get_cfg("ws_idiom")}catch(e){ws_idiom="en"}var translation=key+" ";if(typeof i18n.eltos[component][ws_idiom][key]!=="undefined"){translation=i18n.eltos[component][ws_idiom][key]}return translation}function i18n_get_select(div_name,str_onchange){var curr_val=get_cfg("ws_idiom");var o=" ";return o}function i18n_get_selectcfg(){var o=" ";return o}function i18n_get_welcome(){var o='

    '+'';for(var key in i18n.lang){o+='"+i18n_get("gui",key,"Welcome")+""}o+=""+"
    ";return o}i18n.eltos.gui.es={"Loading WepSIM...":"Cargando WepSIM...",Configuration:"Configuración",MicroCode:"MicroCódigo",Assembly:"Ensamblador",Simulator:"Simulador",Examples:"Ejemplos",Load:"Cargar",Save:"Guardar","Load/Save":"Cargar/Guardar",Restore:"Restaurar",Help:"Ayuda",Notifications:"Notificaciones",RecordBar:"Grabación",Input:"Entrada",Output:"Salida",Reload:"Reload",Checkpoint:"Checkpoint","Help Index":"Índice ayuda",Processor:"Procesador","Assembly Debugger":"Depurador de Ensamblador",Reset:"Reiniciar",microInstruction:"µInstrucción",Instruction:"Instrucción",Run:"Ejecutar","Hardware Summary":"Hardware Resumido",processor:"procesador",details:"detalles",microcode:"microcódigo",Signals:"Señales",Behaviors:"Comportamientos",States:"Estados","Control States":"Estados de Control",Dependencies:"Dependencias",Close:"Cerrar",Description:"Descripción",Show:"Mostrar","Show Main Memory":"Mostrar Memoria Principal",compile:"compilar",Compile:"Compilar","Please write the file name":"Por favor indique el nombre de fichero","Load from this File":"Cargar de este fichero",labels:"etiquetas",addr:"dir",ess:"ección",content:"contenido",assembly:"ensamblador",instructions:"instrucciones","simulator intro 1":"Puede seleccionar el hardware que se utilizará. El predeterminado es el hardware EP (Elemental Processor).
    Puede usar el selector de modo para cambiar el hardware utilizado","simulator intro 2":"A continuación necesita cargar el microcódigo (define el conjunto de instrucciones) y el código de ensamblador.
    Puede usar un ejemplo, cargarlo desde un archivo, o puede editar un nuevo microcódigo y un nuevo código de ensamblador.","simulator intro 3":"Finalmente, en el simulador puede ejecutar el microcódigo más el ensamblador cargado antes.
    Puede ejecutar ambos, en el nivel de microinstrucción o en el nivel de instrucción de ensamblador.","Prev.":"Anterior",Next:"Siguiente",End:"Fin","Disable tutorial mode":"Deshabilitar modo tutorial",Comment:"Comentar",Pause:"Pausar",Play:"Reproducir",Stop:"Parar",Record:"Grabar",Registers:"Registros","Control Memory":"Memoria de Control",Stats:"Estadísticas",Memory:"Memoria","Keyboard+Display":"Teclado+Pantalla","I/O Stats":"E/S Estadísticas","I/O Configuration":"E/S Configuración",Recent:"Reciente",Refresh:"Refrescar",Welcome:"Bienvenido+a","Microcode & Assembly":"WepSIM hardware","Pick firm/soft":"Firm/soft desde",Information:"Información",Native:"Nativo","MIPS32-like":"Basado en MIPS32",RISCV32:"RISCV32","Z80-like":"Basado en Z80",Actions:"Acciones",Utilities:"Utilidades","Information from":"Información de","Pick firm/soft from":"Cargar firm/soft desde","Welcome tutorial":"Tutorial de bienvenida",idiom:"idioma","Assembly only":"Solo ensamblador","Micro & Assembly":"Micro y ensamblador",_last_:"_last_"};i18n.eltos.tutorial_welcome.es={title_0:"¡Bienvenidos al simulador WepSIM!",message_0:"
    wepsim screenshot
    "+"

    "+"

    "+"Este breve tutorial le mostrará:"+"
      "+"
    1. Carga de un ejemplo.
    2. "+"
    3. Ejecución de ejemplo.
    4. "+"
    5. Configuración del simulador.
    6. "+"
    7. Obtener ayuda.
    8. "+"
    "+"
    ",title_1:"Cómo cargar algunos ejemplos.",message_1:"
    wepsim screenshot
    "+"

    "+"

    "+"Haga click en el botón de 'examples' y haga click en el 'título' del ejemplo que desea cargar."+"
    "+"
    ",title_2:"Cómo cargar algunos ejemplos.",message_2:"
    wepsim screenshot
    "+"

    "+"

    "+"Haga click en next instruction/microinstruction para ejecutar paso a paso.
    "+"Haga click en run para ejecutar hasta el primer punto de ruptura o el fin del programa en ensamblador."+"
    "+"
    ",title_3:"Cómo configurar WepSIM.",message_3:"
    wepsim screenshot
    "+"

    "+"

    "+"Haga click en el botón de configuración para configurar diversos aspectos de WepSIM para su comididad."+"
    "+"
    ",title_4:"Cómo conseguir la ayuda básica.",message_4:"
    wepsim screenshot
    "+"

    "+"

    "+"Haga click en el botón verde de ayuda 'help'.
    "+"Puede obtener la ayuda en Spanish/English, ir al índice de la ayuda o cerrar la pantalla de ayuda."+"
    "+"
    ",title_5:"¡Bienvenido a WepSIM!",message_5:"
    wepsim screenshot
    "+"

    "+"

    "+"Por favor explorer las secciones de la ayuda para más información.
    "+"Si hace click en el botón 'end' del tutorial entonces WepSIM cargará el primer ejemplo por usted. ¡Diviertase aprendiendo!"+"
    "+"
    "};i18n.eltos.tutorial_simpleusage.es={title_0:"WepSIM: microprogramar, ensamblar y simular",message_0:"
    wepsim screenshot
    "+"

    "+"

    "+"Este breve tutorial le mostrará:"+"
      "+"
    1. La edición de microcódigo.
    2. "+"
    3. La edición de código ensamblador.
    4. "+"
    5. Ejecución del anterior ensamblador definido anteriormente.
    6. "+"
    "+"
    ",title_1:"WepSIM: microprogramar, ensamblar y simular",message_1:"
    wepsim screenshot
    "+"

    "+"

    "+"El primer paso es microprogramar el firmware a ser usado. "+"Por favor use el botón de 'Microcode' para ir a la pantalla de trabajo del microcódigo."+"
    ",title_2:"WepSIM: microprogramar, ensamblar y simular",message_2:"
    wepsim screenshot
    "+"

    "+"

    "+"La pantalla de microprogramación ofrece:"+"
      "+"
    • El editor de microcródigo.
    • "+"
    • El microcompilador.
    • "+"
    • El resumen del hardware y la ayuda.
    • "+"
    "+"Una vez que el microcódigo esté listo (editado y compile sin errores) el siguiente paso el el código ensamblador."+"
    ",title_3:"WepSIM: microprogramar, ensamblar y simular",message_3:"
    wepsim screenshot
    "+"

    "+"

    "+"El segundo paso es programar el ensamblador a ser ejecutado. "+"Por favor use el botón de 'Assembly' para ir a la pantalla de ensamblador."+"
    ",title_4:"WepSIM: microprogramar, ensamblar y simular",message_4:"
    wepsim screenshot
    "+"

    "+"

    "+"La pantalla de programación en ensamblador ofrece:"+"
      "+"
    • El editor para el código ensamblador.
    • "+"
    • El compilador de ensamblador.
    • "+"
    • El visualizador de mapa de memoria y ayuda.
    • "+"
    "+"Asegure antes de ir a la pantalla del simulador que su código este listo (editado y compilado sin errores)."+"
    ",title_5:"WepSIM: microprogramar, ensamblar y simular",message_5:"
    wepsim screenshot
    "+"

    "+"

    "+"El tercer paso es ejecutar el código ensamblador en el ensamblador.
    "+"La pantalla de simulación ofrece:"+"
      "+"
    • Las vista de ensamblador y hardware.
    • "+"
    • Los detalles de registros, memoria de control, memoria principal, etc.
    • "+"
    • Las acciones de reinicio, ejecución paso a paso o hasta punto de ruptura (o fin).
    • "+"
    "+"Este tutorial ha introducido el uso típico de WepSIM para estudiantes y profesores. ¡Disfrute con WepSIM!."+"
    "};i18n.eltos.tour_intro.es={step1:"WepSIM ayudará a entender mejor cómo funciona un computador: "+"es visual, interactivo, integra interrupciones, llamadas al sistema, etc.
    "+"
    "+"Nosotros realmente creemos que WepSIM es una herramienta revolucionaria. "+"Este breve tour le muestra las partes clave de la interfaz de WepSIM.",step2:"En la esquina superior derecha está el selector de 'modo de ejecución'.
    "+"
    "+"Los usuarios pueden seleccionar:"+"
      "+"
    • El hardware con el que trabajar (ejemplo: procesador EP, POC, etc.)
    • "+"
    • El modo solo ensamblador, con instrucciones MIPS32 de enteros o RISC-V32
    • "+"
    ",step3:"En la esquina superior derecha el botón de ayuda abre el panel de ayuda asociado.
    "+"
    "+"El cuadro de diálogo permite el acceso a tutoriales, información, etc.",step4:"En la esquina superior izquierda, el botón de 'ejemplos' abre el panel asociado.
    "+"
    "+"Hay muchos ejemplos muy útiles para el aprendizaje incremental.",step5:"En la esquina superior izquierda está el botón de configuracion que abre el cuadro de diálogo de la configuración.
    "+"
    "+"Con la configuracióón se puede adaptar distintos aspectos de ejecución, interfaz de usuario/a, preferencias, etc.",step6:"¡Felicidades!. Ya conoce las partes clave de la interfaz de WepSIM.
    "+"Desde el panel de 'Ayuda' puede acceder al 'Tutorial de bienvenida'. para continuar aprendiendo.
    "};i18n.eltos.cfg.es={General:"General","Idiom for help, examples, etc.":"Idioma para ayuda, ejemplos, etc.","Notification speed: time before disapear":"Velocidad en notificaciones: tiempo en desaparecer",Editor:"Editor","Editor theme: light or dark":"Tema de editor: claro u oscuro",Light:"Claro",Dark:"Oscuro","Editor mode: vim, emacs, etc.":"Modo de edición: vim, emacs, etc.",Execution:"Ejecución","Running speed: execution speed":"Velocidad de ejecución",Slow:"Lento",Normal:"Normal",Fast:"Veloz","Step-by-step: element in run mode":"Paso-a-paso: elemento a ejecutar de uno a uno",Instructions:"Instrucciones",Instruction:"Instrucción","µinstructions":"µinstrucciones",microInstruction:"µInstrucción","Breakpoint icon: icon to be used for breakpoints":"Icono a ser usado en puntos de ruptura","Limit instructions: number of instructions to be executed":"Límite instrucciones: número de instrucciones a ser ejecutadas","Limit instruction ticks: to limit clock ticks":"Límite ticks: limitación de ticks de reloj por instrucción","Register file":"Banco de registros","Display format":"Formato de presentación","Register file names":"Nombre de los registros",Numbers:"Números",Labels:"Etiquetas","Editable registers: edit register file values":"Registros editables: editar los valores de los registros","Circuitry simulation":"Circuitería","Data-path color":"Color del camino de datos","Signal color":"Color de las seńales activas","Show by value or by activation":"Mostrar por valor o por activación",Value:"Valor",Activation:"Activación","Interactive mode: signal value can be updated":"Modo interactivo: valores de las seńales puede actualizarse","Quick interactive mode: quick update of signal value":"Modo interactivo-rápido: actualización rápida de valores de seńales","(example)":"(ejemplo)",Accesibility:"Accesibilidad","Beginner view":"Vista principiante","Auto-scroll while executing":"Auto-scroll mientras en ejecución","Active voice: external voice control":"Activar voz: control por voz (externo)","Verbalization: textual or mathematical":"Tipo de verbalizar: texto o matem&aacutre;tica","WepSIM User Interface views":"Vistas de la Interfaz de Usuarios+as"};i18n.eltos.help.es={"Welcome tutorial":"Tutorial de bienvenida",help_01_01:"Abre el tutorial de bienvenida","Simple usage tutorial":"Tutorial simple de uso",help_01_02:"Tutorial de uso simple, ejemplo básico para microprogramar y programar en ensamblador","Execute example":"Ejecución de ejemplo",help_01_03:"Reproduce el tutorial de ejecución de ejemplo","Simulator: firmware":"Simulador: microcódigo",help_02_01:"Descripción de cómo trabajar en el simulador con el microcódigo","Microcode format":"Formato del microcódigo",help_02_02:"Sintáxis del microcódigo usado","Simulator: assembly":"Simulador: ensamblador",help_02_03:"Descripción de cómo trabajar en el simulador con el ensamblador","Assembly format":"Formato del ensamblador",help_02_04:"Sintáxis del ensamblador","Simulator: execution":"Simulador: ejecución",help_02_05:"Descripción de cómo ejecutar en el simulador el ensamblador y microcódigo","Simulated architecture":"Arquitectura del simulador",help_03_01:"Descripción de la arquitectura del procesador simulado","Simulated signals":"Señales simuladas",help_03_02:"Resumen de las señales principales del procesador elemental","Hardware summary":"Resumen del Hardware",help_03_03:"Resumen del hardware del procesador elemental simulado","License, platforms, etc.":"Licencia, plataformas, etc.",help_04_01:"Licencia de WepSIM, plataformas disponibles, tecnologías usadas",Authors:"Autores",help_04_02:"Autores de WepSIM"};i18n.eltos.states.es={States:"Estados",Current:"Actual","Current State":"Estado Actual",History:"Historia",None:"Ninguno","Empty history":"Historia vacía","Empty (only modified values are shown)":"Vacío (solo se muestra los valores modificados)",Differences:"Diferencias","differences with clipboard state":"diferencias con estado en portapapeles","Meets the specified requirements":"Iguales (cumple los requisitos)",history:"historial",Add:"Añadir","'Current State' to History":"'Estado Actual' al historial",Check:"Comprobar",Copy:"Copiar","to clipboard":"al portapapeles",Checkpoint:"Checkpoint","File name":"Nombre de fichero","Tag for checkpoint":"Etiqueta para checkpoint","File to be loaded":"Fichero a cargar","Save to File":"Guardar a fichero","State(s) to checkpoint":"Estados para checkpoint","Record to checkpoint":"Grabación para checkpoint","Browser cache":"Cache navegador","Session to be restore":"Sesión a restaurar",_last_:"_last_"};i18n.eltos.examples.es={"addv + seqv.":"addv + seqv.","Alloc.s":"Alloc.s","Dummy instruction":"Instrucción vacía",Exception:"Excepción",Instructions:"Instrucciones",Interruptions:"Interrupciones","Int. + syscall + except.":"Int. + syscall + excep.","I/O":"E/S",Looping:"Blucles","madd, mmul, mxch":"madd, mmul, mxch","Masks & shift":"Máscaras y desplazamientos",Matrix:"Matriz","Memory access":"Acceso a memoria","SC 1, 4-5, 8, 11-12":"SC 1, 4-5, 8, 11-12","strlen_2 + skipasciicode_2":"strlen_2 + skipasciicode_2",Subrutine:"Subrutina","syscall 1, 4-5, 8, 11-12":"syscall 1, 4-5, 8, 11-12","System call":"Llamada a systema",Threads:"Hilos",Vector:"Vector","Compiler Explorer":"Compiler Explorer",example_04_01:"Ejemplo avanzado con interrupciones, llamada al sistema y excepciones.",example_05_01:"Extensiones Específicas de Aplicación: addv + seqv.",example_05_03:"Extensiones Específicas de Aplicación: madd + mmul + mxch.",example_05_02:"Extensiones Específicas de Aplicación: strlen_2 + skipasciicode_2.",example_03_01:"Ejemplo Instructive con excepción de coma flotante.",example_03_02:"Ejemplo Instructive con interrupciones: fetch, RETI y .ktext/.kdata.",example_03_03:"Ejemplo Instructive con llamada al sistema.",example_03_04:"Ejemplo Instructive con convenio simple de pila.",example_04_04:"Examplo de malloc + free.",example_04_02:"Examplo de llamada a sistema para imprimir/leer enteros y string.",example_04_03:"Examplo de hilos.",example_03_01b:"Examplo con excepción de coma flotante.",example_03_02b:"Examplo con interrupciones: fetch, RETI y .ktext/.kdata.",example_02_01:"Examplo con acceso con E/S programada y segmento de .text/.data básico.",example_03_03b:"Examplo con llamada a sistema.",example_02_02:"Ejemplo extendido con más instrucciones y E/S (teclado y pantalla).",example_02_04:"Ejemplo extendido con subrutina y matriz.",example_02_03:"Ejemplo extendido con máscaras, desplazamiento y segmentos básicos.",example_01_01:"Ejemplo simple con fetch, instrucciones artiméticas y segmentos básicos.",example_01_04:"Ejemplo simple con fetch, salto y segmento básico de .text/.data.",example_01_03:"Ejemplo simple con fetch, salto y segmento básico de .text.",example_01_02:"Ejemplo simple con fetch, acceso a memoria, y segmento básico de .text/.data.",example_06_01:"Ejemplo de prueba.",example_06_02:"Ejemplo simple con Compiler Explorer.",Advanced:"Avanzado",Initial:"Inicial",Intermediate:"Intermedio",Laboratory:"Laboratorio","Operating Systems":"Sistemas Operativos",Special:"Especial","Load example":"Cargar ejemplo","Load Assembly only":"Cargar Ensamblador solo","Load Firmware only":"Cargar Firmware solo","Copy reference to clipboard":"Copiar referencia al portapapeles",Share:"Compartir","No examples available...":"No examples are available for the selected hardware","Simple example":"Ejemplo simple."};i18n.eltos.compiler.es={"PROBLEM AROUND LINE":"Problema entorno a la línea","NO TAG OR DIRECTIVE":"No es una etiqueta (ej.: tag1:) o directiva (ej.: .data) válida, se encontró: ","NO TAG, DIR OR INS":"No es una etiqueta (ej.: tag1:) directiva (ej.: .data) o instrucción válida, se encontró: ","INVALID TAG FORMAT":"Una etiqueta debe seguir un formato alfanumérico (comenzando con una letra o un guión bajo): ","TAG OR INSTRUCTION":"Una etiqueta no puede tener el mismo nombre que una instrucción: ","REPEATED TAG":"Etiqueta repetida: ","NO NUMERIC DATATYPE":"Se esperaba un valor para el tipo de datos numéricos, pero se encontró: ","NO POSITIVE NUMBER":"Se esperaba un número positivo, pero se encontró: ","NO NUMBER OF BYTES":"Se esperaba un número natural para los bytes a reservar en .space, pero se encontró: ","INVALID ALIGN VALUE":"Se esperaba que el parámetro align sea un número positivo, pero se encontró: ","REMEMBER ALIGN VAL":"Recuerde que el número para .align será una potencia de dos, consulte la documentación de MIPS","NOT CLOSED STRING":"La cadena de caracteres no está cerrada (posiblemente se olvidó de terminar con comillas)","NO QUOTATION MARKS":"Cadena prevista entre comillas, pero encontrado: ","UNEXPECTED DATATYPE":"Inesperada nombre de tipo de datos: ","INVALID SEGMENT NAME":"Se espera un segmento .data/.text/..., pero se encontró: ","NO MAIN OR KMAIN":"Tags 'main' o 'kmain' no están definidos en el segmento de texto (s). Es obligatorio para definir al menos una de esas etiquetas con el fin de ejecutar un programa","UNKNOWN 1":"Se produjo un error desconocido (1)","UNKNOWN 2":"Error inesperado (2)","REMEMBER I. FORMAT":"Recuerde que el formato de instrucción se ha definido como: ","SEVERAL CANDIDATES":"Instrucción y campos coincide con más de una instrucción posible. Por favor, compruebe el microcódigo. En la actualidad, el formato de la instrucción puede ser: ","NOT MATCH MICRO":"Instrucción y campos no coinciden con el formato de instrucción definido","CHECK MICROCODE":"Por favor, compruebe el microcódigo. Probablemente se olvidó de agregar un campo, un número no encaja en su rango, o simplemente usa una instrucción equivocada","LABEL NOT DEFINED":"Label used but not defined in the assembly code: ","INS. MISSING FIELD":"Falta un campo en la instrucción","UNEXPECTED (REG)":"Se esperaba un registro pero se encontró un registro entre paréntesis.","EXPECTED (REG)":"Registro esperado entre paréntesis, pero se encontró: ","EXPECTED REG":"Se esperaba un registro (e.g.: $1/$a0/...) pero se encontró: ","UNKNOWN ESCAPE CHAR":"Secuencia de escape desconocida","SPACE FOR # BITS":" bits en binario pero hay espacio para solo ",NEEDS:" necesita ","UNKNOWN MC FORMAT":"(unknown format in microcode)","LABEL NOT FOUND":"Esperada ':' no encontrada, se encontró: ","REPEATED LABEL":"Etiqueta repetida: ","INVALID LABEL FORMAT":"Formato de etiqueta no válido para: ","OPEN BRACE NOT FOUND":"Esperado '{' no encontrado","CLOSE BRACE NOT FOUND":"Esperado '}' no encontrado","OPEN PAREN. NOT FOUND":"Esperado '(' no encontrado","CLOSE PAREN. NOT FOUND":"Esperado ')' no encontrado","COMMA NOT FOUND":"Esperado ',' no encontrado","EQUAL NOT FOUND":"Esperado '=' no encontrado","SIGNAL NOT EXISTS":"Señal no existente: ","SIGNAL NO DIRECTLY":" no puede usarse directamente, por favor use las señales de la Unidad de Control en su lugar para generarlas.","INCORRECT BIN. FORMAT":"Formato binario incorrecto: ","OUT OF RANGE":"Valor fuera de rango: ","EMPTY MICROCODE":"No hay microcódigo","EMPTY NAME LIST":"Lista vacía de nombres asociada al registro: x=[]","DUPLICATE SP":"Definición de puntero de pila duplicada","NO SP":"Esperado token stack_pointer no encontrado","UNDEF. INSTR.":"Instrucción no definida: ","MORE 100 FIELDS":"Más de 100 campos en una sola instrucción.","CO AS FIELD NAME":"Campo de instrucción tiene 'co' como nombre.","NW AS FIELD NAME":"Campo de instrucción tiene 'nwords' como nombre.","NO CO FIELD":"Esperada palabra clave 'co' no encontrada","INCORRECT CO BIN.":"Formato binary incorrecto en 'co': ","INCORRECT COP BIN.":"Formato binary incorrecto en 'cop': ","INVALID PARAMETER":"Parámetro invalido: ","ALLOWED PARAMETER":"Solo se permite los siguientes campos: reg, num, inm, addr, address","MISSING TOKEN ON":"'token' no está despues de '(' en: ","MISSING ) ON":"')' no se encuentra en: ","CO ALREADY USED":"'co' ya se está usando por: ","CO+COP ALREADY USED":"'co+cop' is already been used by: ","NO NWORDS":"Palabra clave 'nwords' esperado no encontrada","INCORRECT ADDRESSING":"Tipo de direccionamiento incorrecto (abs o rel)","UNEXPECTED FIELD":"Encontrado un campo no esperado: ","CHECK ORDER":"Por favor compruebe el orden de los campos","STARTBIT OoR":"startbit fuera de rango: ","STOPBIT OoR":"stopbit fuera de rango: ","OVERLAPPING FIELD":"Campos que se solapan: ","BAD COP BIN. LEN.":"Longitud binaria incorrecta para 'cop': ","SP NOT DEFINED":"Registro puntero de pila no definido","NO LABEL FETCH":"Etiqueta 'fetch' no definida","NO LABEL BEGIN":"'begin' no encontrado","NO CO CODES":"No hay códigos suficientes en 'co' para instrucciones","NO LABEL MADDR":"Etiqueta MADDR no encontrada: ","INS. NAME":"Nombre de instrucción: '","NOT VALID FOR":"' no es válido para: ","BIGGER THAN":"es mayor que ",BITS:" bits","EXPECTED VALUE":"Valor se esperaba que quepa en un '","BUT INSERTED":"pero insertado ",INSTEAD:"en su lugar",_last_:"_last_"};i18n.eltos.dialogs.es={"Show/Hide ActionBar":"Mostrar/Ocultar barra","Show/Hide Slider":"Mostrar/Ocultar sliders","WepSIM User Interface skin":"Variante de Interfaz de Usuario para WepSIM","Initial intro":"Intro inicial","About WepSIM":"Sobre WepSIM",Title:"Título",Message:"Mensaje",Duration:"Duración","Confirm remove record...":"¿Seguro que quiere borrar la grabación actual?","Close or Reset...":"Por favor haga click en Cerrar para mantener la grabación o en Reiniciar para borrarla.","Sure Control Memory...":"¿Seguro que quiere salvar el contenido actual de la memoria de control en lugar del contenido del editor?.","Show/Hide labels":"Mostrar/Ocultar etiquetas","Show/Hide content":"Mostrar/Ocultar hexadecimal","Show/Hide assembly":"Mostrar/Ocultar ensamblador","Show/Hide pseudo-instructions":"Mostrar/Ocultar pseudo-instrucciones",Close:"Cerrar",details:"detalles",idiom:"idioma",_last_:"_last_"};i18n.eltos.gui.en={"Loading WepSIM...":"Loading WepSIM...",Configuration:"Configuration",MicroCode:"MicroCode",Assembly:"Assembly",Simulator:"Simulator",Examples:"Examples",Load:"Load",Save:"Save","Load/Save":"Load/Save",Restore:"Restore",Help:"Help",Notifications:"Notifications",RecordBar:"RecordBar",Input:"Input",Output:"Output",Reload:"Reload",Checkpoint:"Checkpoint","Help Index":"Help Index",Processor:"Processor","Assembly Debugger":"Assembly Debugger",Reset:"Reset",microInstruction:"µInstruction",Instruction:"Instruction",Run:"Run","Hardware Summary":"Hardware Summary",processor:"processor",details:"details",microcode:"microcode",Signals:"Signals",Behaviors:"Behaviors",States:"States","Control States":"Control States",Dependencies:"Dependencies",Close:"Close",Description:"Description",Show:"Show","Show Main Memory":"Show Main Memory",compile:"compile",Compile:"Compile","Please write the file name":"Please write the file name","Load from this File":"Load from this File",labels:"labels",addr:"addr",ess:"ess",content:"content",assembly:"assembly",instructions:"instructions","simulator intro 1":"You can select the hardware to be used. The default one is the EP (Elemental Processor) hardware.
    "+"You can use the mode selector to change the hardware used.","simulator intro 2":"Then you need to load the microcode (defines the instruction set) and the assembly code.
    "+"You can use an example, "+"load it from a file, "+"or you can edit a new microcode "+" and a new assembly code.","simulator intro 3":"Finally, in the simulator you are able to execute the microcode plus assembly loaded before.
    "+"You can execute it both, at microinstruction level or assembly instruction level.","Prev.":"Prev.",Next:"Next",End:"End","Disable tutorial mode":"Disable tutorial mode",Comment:"Comment",Pause:"Pause",Play:"Play",Stop:"Stop",Record:"Record",Registers:"Registers","Control Memory":"Control Memory",Stats:"Stats",Memory:"Memory","Keyboard+Display":"Keyboard+Display","I/O Stats":"I/O Stats","I/O Configuration":"I/O Configuration",Recent:"Recent",Refresh:"Refresh",Welcome:"Welcome","Microcode & Assembly":"Microcode & Assembly","Pick firm/soft":"Pick firm/soft from",Information:"Information",Native:"Native","MIPS32-like":"MIPS32-like",RISCV32:"RISCV32","Z80-like":"Z80-like",Actions:"Actions",Utilities:"Utilities","Information from":"Information from","Pick firm/soft from":"Pick firm/soft from","Welcome tutorial":"Welcome tutorial",idiom:"idiom","Assembly only":"Assembly only","Micro & Assembly":"Micro & Assembly",_last_:"_last_"};i18n.eltos.tutorial_welcome.en={title_0:"Welcome to the WepSIM simulator!",message_0:"
    wepsim screenshot
    "+"

    "+"

    "+"This brief tutorial is going to show you how to:"+"
      "+"
    1. Load an example.
    2. "+"
    3. Execute an example.
    4. "+"
    5. Configure the simulation.
    6. "+"
    7. Get help.
    8. "+"
    "+"
    ",title_1:"How to load some example.",message_1:"
    wepsim screenshot
    "+"

    "+"

    "+"Click in the 'example' button, then click in the example 'title' name.
    "+"Then the example for microcode and assembly is loaded and microcompiled and compiled.
    "+"
    "+"
    ",title_2:"How to execute an example.",message_2:"
    wepsim screenshot
    "+"

    "+"

    "+"Click on next instruction/microinstruction to execute step by step.
    "+"Click on run button to execute until the first breakpoint or the end of the assembly program."+"
    "+"
    ",title_3:"How to configure WepSIM.",message_3:"
    wepsim screenshot
    "+"

    "+"

    "+"Click in the 'configuration' button and users are able to customize different parts of WepSIM."+"
    "+"
    ",title_4:"How to get the basic help.",message_4:"
    wepsim screenshot
    "+"

    "+"

    "+"Please click in the green 'help' button to reach the help dialog.
    "+"You are able to switch idiom (Spanish/English), go to the help index, or close the help dialog."+"
    "+"
    ",title_5:"Welcome to WepSIM!",message_5:"
    wepsim screenshot
    "+"

    "+"

    "+"Please explorer the help sections for more information.
    "+"If you click on the end button of this tutorial, WepSIM is going to load the first example for you. Enjoy!"+"
    "+"
    "};i18n.eltos.tutorial_simpleusage.en={title_0:"Simple WepSIM experience: microprogramming and programming",message_0:"
    wepsim screenshot
    "+"

    "+"

    "+"This brief tutorial is going to show you how to:"+"
      "+"
    1. Edit your microcode.
    2. "+"
    3. Edit your assembly (based on the previous microcode).
    4. "+"
    5. Execute the assembly+microcode in the simulation.
    6. "+"
    "+"
    ",title_1:"Simple WepSIM experience: microprogramming and programming",message_1:"
    wepsim screenshot
    "+"

    "+"

    "+"The first step is to microprogramming the firmware to be used. "+"Please use the 'Microcode' button to switch to the microcode screen."+"
    ",title_2:"Simple WepSIM experience: microprogramming and programming",message_2:"
    wepsim screenshot
    "+"

    "+"

    "+"The microprogramming screen provides:"+"
      "+"
    • The editor for the microcode.
    • "+"
    • The microcompiler.
    • "+"
    • The hardware summary and help.
    • "+"
    "+"Once your code is ready (compiled without errors), next step is to go to the assembly screen."+"
    ",title_3:"Simple WepSIM experience: microprogramming and programming",message_3:"
    wepsim screenshot
    "+"

    "+"

    "+"The second step is to programming the assembly to be executed. "+"Please use the 'Assembly' button from both, the simulator screen or the microcode screen."+"
    ",title_4:"Simple WepSIM experience: microprogramming and programming",message_4:"
    wepsim screenshot
    "+"

    "+"

    "+"The programming screen provides:"+"
      "+"
    • The editor for the assembly code.
    • "+"
    • The assembly compiler.
    • "+"
    • The memory map viewer and help.
    • "+"
    "+"Once your assebly code is ready (edited and compiled without errors) next step is to go into the simulation screen."+"
    ",title_5:"Simple WepSIM experience: microprogramming and programming",message_5:"
    wepsim screenshot
    "+"

    "+"

    "+"The third step is to execute the assembly code in the simulator.
    "+"The simulator screen provides:"+"
      "+"
    • The assembly and hardware view.
    • "+"
    • The detail view of registers, control memory, main memory, etc.
    • "+"
    • The reset, step by step or run until breakpoint/end actions.
    • "+"
    "+"This tutorial has introduced the typical usage of WepSIM for students and teachers. Enjoy WepSIM!"+"
    "};i18n.eltos.tour_intro.en={step1:"WepSIM helps to better understand how a computer works: "+"it is visual, interactive, integrates from signals up to interruptions, system calls, exceptions, etc.
    "+"
    "+"We really believe WepSIM is a revolutionary teaching tool. "+"This brief tour introduces the key elements of its interface.",step2:"This button on the top-right is a quick access menu to differents 'work modes'.
    "+"
    "+"Users might select:"+"
      "+"
    • The hardware to work with (e.g. EP processor, etc.)
    • "+"
    • Assembly only mode, with integer MIPS32 or RISC-V32 instructions
    • "+"
    ",step3:"On the top-right, the 'help' button opens the associated dialog.
    "+"
    "+"The help dialog summarizes the tutorials, descriptions, information, etc.",step4:"And on the left, the 'examples' button open the example dialog.
    "+"
    "+"There are many examples that can be used to learn incrementally.",step5:"On the top-left, the 'configuration' button opens the configuration dialog.
    "+"
    "+"It allows users to adapt several aspects of the execution, user interface, preferences, etc.",step6:"Congrats! You know the key elements in the WepSIM interface.
    "+"From the 'Help' dialog you can access the 'Welcome tutorial' to continue learning.
    "};i18n.eltos.cfg.en={General:"General","Idiom for help, examples, etc.":"Idiom for help, examples, etc.","Notification speed: time before disapear":"Notification speed: time before disapear",Editor:"Editor","Editor theme: light or dark":"Editor theme: light or dark",Light:"Light",Dark:"Dark","Editor mode: vim, emacs, etc.":"Editor mode: vim, emacs, etc.",Execution:"Execution","Running speed: execution speed":"Running speed: execution speed",Slow:"Slow",Normal:"Normal",Fast:"Fast","Step-by-step: element in run mode":"Step-by-step: element in run mode",Instructions:"Instructions",Instruction:"Instruction","µinstructions":"µinstructions",microInstruction:"µInstruction","Breakpoint icon: icon to be used for breakpoints":"Breakpoint icon: icon to be used for breakpoints","Limit instructions: number of instructions to be executed":"Limit instructions: number of instructions to be executed","Limit instruction ticks: to limit clock ticks":"Limit instruction ticks: clock ticks limit per instruction","Register file":"Register file","Display format":"Display format","Register file names":"Register file names",Numbers:"Numbers",Labels:"Labels","Editable registers: edit register file values":"Editable registers: edit register file values","Circuitry simulation":"Circuitry simulation","Data-path color":"Data-path color","Signal color":"Signal color","Show by value or by activation":"Show by value or by activation",Value:"Value",Activation:"Activation","Interactive mode: signal value can be updated":"Interactive mode: signal value can be updated","Quick interactive mode: quick update of signal value":"Quick interactive mode: quick update of signal value","(example)":"(example)",Accesibility:"Accesibility","Beginner view":"Beginner view","Auto-scroll while executing":"Auto-scroll while executing","Active voice: external voice control":"Active voice: external voice control","Verbalization: textual or mathematical":"Verbalization: textual or mathematical","WepSIM User Interface views":"WepSIM User Interface views"};i18n.eltos.help.en={"Welcome tutorial":"Welcome tutorial",help_01_01:"Open the welcome tutorial","Simple usage tutorial":"Simple usage tutorial",help_01_02:"Open the simple usage tutorial, for microprogramming and assembly programming","Execute example":"Execute example",help_01_03:"Play the execute example tutorial","Simulator: firmware":"Simulator: firmware",help_02_01:"How to work with the firmware to be loaded into the control memory","Microcode format":"Microcode format",help_02_02:"Syntax of the microcode used","Simulator: assembly":"Simulator: assembly",help_02_03:"How to work with the assembly that use the aforementioned firmware","Assembly format":"Assembly format",help_02_04:"Syntax of the assembly elements","Simulator: execution":"Simulator: execution",help_02_05:"How the simulator can execute the assembly and firmware","Simulated architecture":"Simulated architecture",help_03_01:"Description of the simulated processor architecture","Simulated signals":"Simulated signals",help_03_02:"Main signals summary of the simulated elemental processor","Hardware summary":"Hardware summary",help_03_03:"Reference card for the simulated elemental processor hardware","License, platforms, etc.":"License, platforms, etc.",help_04_01:"WepSIM license, supported platforms, technologies used",Authors:"Authors",help_04_02:"Authors of WepSIM"};i18n.eltos.states.en={States:"States",Current:"Current","Current State":"Current State",History:"History",None:"None","Empty history":"Empty history","Empty (only modified values are shown)":"Empty (only modified values are shown)",Differences:"Differences","differences with clipboard state":"differences with clipboard state","Meets the specified requirements":"Meets the specified requirements",history:"history",Add:"Add","'Current State' to History":"'Current State' to History",Check:"Check",Copy:"Copy","to clipboard":"to clipboard",Checkpoint:"Checkpoint","File name":"File name","Tag for checkpoint":"Tag for checkpoint","File to be loaded":"File to be loaded","Save to File":"Save to File","State(s) to checkpoint":"State(s) to checkpoint","Record to checkpoint":"Record to checkpoint","Browser cache":"Browser cache","Session to be restore":"Session to be restore",_last_:"_last_"};i18n.eltos.examples.en={"addv + seqv.":"addv + seqv.","Alloc.s":"Alloc.s","Dummy instruction":"Dummy instruction",Exception:"Exception",Instructions:"Instructions",Interruptions:"Interruptions","Int. + syscall + except.":"Int. + syscall + except.","I/O":"I/O",Looping:"Looping","madd, mmul, mxch":"madd, mmul, mxch","Masks & shift":"Masks & shift",Matrix:"Matrix","Memory access":"Memory access","SC 1, 4-5, 8, 11-12":"SC 1, 4-5, 8, 11-12","strlen_2 + skipasciicode_2":"strlen_2 + skipasciicode_2",Subrutine:"Subrutine","syscall 1, 4-5, 8, 11-12":"syscall 1, 4-5, 8, 11-12","System call":"System call",Threads:"Threads",Vector:"Vector","Compiler Explorer":"Compiler Explorer",example_04_01:"Advanced example with interruption, system call, and exception.",example_05_01:"Application-specific extension: addv + seqv.",example_05_03:"Application-specific extension: madd + mmul + mxch.",example_05_02:"Application-specific extension: strlen_2 + skipasciicode_2.",example_03_01:"Instructive example with floating point exception.",example_03_02:"Instructive example with interruptions support: fetch, RETI, and .ktext/.kdata.",example_03_03:"Instructive example with system call support.",example_03_04:"Instructive example with simple stack convention.",example_04_04:"Example of malloc + free.",example_04_02:"Example of syscall for printing/reading integer and string.",example_04_03:"Example of threads.",example_03_01b:"Example with floating point exception.",example_03_02b:"Example with interruptions support: fetch, RETI, and .ktext/.kdata.",example_02_01:"Example with programmed I/O access, and basic .text/.data segment.",example_03_03b:"Example with system call support.",example_02_02:"Extended example with more instructions and I/O (keyboard, display).",example_02_04:"Extended example with subrutine and matrix.",example_02_03:"More extended example with masks, shift, and basic .text/.data segment.",example_01_01:"Simple example with fetch, arithmetic instructions, and basic .text segment.",example_01_04:"Simple example with fetch, branch, and basic .text/.data segment.",example_01_03:"Simple example with fetch, branch, and basic .text segment.",example_01_02:"Simple example with fetch, memory access, and basic .text/.data segment.",example_06_01:"Test example.",example_06_02:"Simple Compiler Explorer example.",Advanced:"Advanced",Initial:"Initial",Intermediate:"Intermediate",Laboratory:"Laboratory","Operating Systems":"Operating Systems",Special:"Special","Load example":"Load example","Load Assembly only":"Load Assembly only","Load Firmware only":"Load Firmware only","Copy reference to clipboard":"Copy reference to clipboard",Share:"Share","No examples available...":"No examples are available for the selected hardware","Simple example":"Simple example."};i18n.eltos.compiler.en={"PROBLEM AROUND LINE":"Problem around line","NO TAG OR DIRECTIVE":"Not a valid tag (e.g.: tag1:) or directive (e.g.: .data), found ","NO TAG, DIR OR INS":"Not a valid tag (e.g.: tag1:) directive (e.g.: .data) or instruction, found ","INVALID TAG FORMAT":"A tag must follow an alphanumeric format, starting with a letter or underscore (e.g.: _tag1:) but found ","TAG OR INSTRUCTION":"A tag can not have the same name as an instruction ","REPEATED TAG":"Repeated tag ","NO NUMERIC DATATYPE":"Expected value for numeric datatype but found ","NO POSITIVE NUMBER":"Expected a positive number but found ","NO NUMBER OF BYTES":"Expected number of bytes to reserve in .space but found ","INVALID ALIGN VALUE":"Expected the align parameter as positive number but found ","REMEMBER ALIGN VAL":"Remember that number is the power of two for alignment, see MIPS documentation.","NOT CLOSED STRING":"String is not closed (forgot to end it with quotation marks)","NO QUOTATION MARKS":"Expected string between quotation marks but found ","UNEXPECTED DATATYPE":"Unexpected datatype name ","INVALID SEGMENT NAME":"Expected segment name (e.g.: .data/.text/...) but found ","NO MAIN OR KMAIN":"Tags 'main' or 'kmain' are not defined in the text segment(s). "+"It is compulsory to define at least one of those tags in order to execute a program","UNKNOWN 1":"An unknown error ocurred (1) for field type ","UNKNOWN 2":"Unexpected error (2)","REMEMBER I. FORMAT":"Remember that the instruction format has been defined as ","SEVERAL CANDIDATES":"Instruction and fields match with more than one instruction in microcode. "+"Please check the microcode. Currently, the instruction format can be ","NOT MATCH MICRO":"Instruction and fields don't match with microprogram. ","CHECK MICROCODE":"Please check the microcode. Probably you forgot to add a field, a number is out of range, or you just used a wrong instruction","LABEL NOT DEFINED":"Label used but not defined in the assembly code ","INS. MISSING FIELD":"Missing field in the instruction","UNEXPECTED (REG)":"Expected register but found register between parenthesis.","EXPECTED (REG)":"Expected register between parenthesis but found ","EXPECTED REG":"Expected valid register (e.g.: $1/$a0/...) but found ","UNKNOWN ESCAPE CHAR":"Unknown escape char","SPACE FOR # BITS":" bits in binary but there is space for only ",NEEDS:" needs ","UNKNOWN MC FORMAT":"(unknown format in microcode)","LABEL NOT FOUND":"Expected '