public void TestMethod10() { // testing vv_div RegisterFile <Vector4> vRF = new RegisterFile <Vector4>(32); RegisterFile <Scalar> sRF = new RegisterFile <Scalar>(32); Memory m = new Memory(5000); Memory m_ic = new Memory(5000); IntersectionCore ic = new IntersectionCore(m_ic); vRF[2] = new Vector4(5, 6, 7, 8); vRF[1] = new Vector4(1, 2, 3, 4); vv_div vd = new vv_div(0, 1, 2); Vector4 ans = new Vector4((float)1 / 5, (float)1 / 3, (float)3 / 7, (float)4 / 8); vd.Process(vRF, sRF, m, ic); Assert.AreEqual <float>(ans.X, vRF[0].X); Assert.AreEqual <float>(ans.Y, vRF[0].Y); Assert.AreEqual <float>(ans.Z, vRF[0].Z); Assert.AreEqual <float>(ans.W, vRF[0].W); }
public void TestMethod33() { // ToString test and and = new and(1, 2, 3); Assert.AreEqual("and r1 r2 r3", and.ToString()); bne bne = new bne(1); Assert.AreEqual("bne 1", bne.ToString()); bg bg = new bg(1); Assert.AreEqual("bg 1", bg.ToString()); bl bl = new bl(1); Assert.AreEqual("bl 1", bl.ToString()); bge_rt bge_rt = new bge_rt(1); Assert.AreEqual("bge_rt 1", bge_rt.ToString()); ble_rt ble_rt = new ble_rt(1); Assert.AreEqual("ble_rt 1", ble_rt.ToString()); cmp_i cmpi = new cmp_i(1, 2); Assert.AreEqual("cmp_i r1 r2", cmpi.ToString()); cmp_f cmpf = new cmp_f(1, 2); Assert.AreEqual("cmp_f r1 r2", cmpf.ToString()); cmp_v cmpv = new cmp_v(1, 2); Assert.AreEqual("cmp_v r1 r2", cmpv.ToString()); ff_add ff_add = new ff_add(1, 2, 3); Assert.AreEqual("ff_add r1 r2 r3", ff_add.ToString()); ff_sub ff_sub = new ff_sub(1, 2, 3); Assert.AreEqual("ff_sub r1 r2 r3", ff_sub.ToString()); ff_mul ff_mul = new ff_mul(1, 2, 3); Assert.AreEqual("ff_mul r1 r2 r3", ff_mul.ToString()); ff_div ff_div = new ff_div(1, 2, 3); Assert.AreEqual("ff_div r1 r2 r3", ff_div.ToString()); fin fin = new fin(); Assert.AreEqual("fin", fin.ToString()); ftoi ftoi = new ftoi(1, 2); Assert.AreEqual("ftoi r1 r2", ftoi.ToString()); ii_add ii_add = new ii_add(1, 2, 3); Assert.AreEqual("ii_add r1 r2 r3", ii_add.ToString()); ii_addi ii_addi = new ii_addi(1, 2, 3); Assert.AreEqual("ii_addi r1 r2 3", ii_addi.ToString()); ii_sub ii_sub = new ii_sub(1, 2, 3); Assert.AreEqual("ii_sub r1 r2 r3", ii_sub.ToString()); ii_subi ii_subi = new ii_subi(1, 2, 3); Assert.AreEqual("ii_subi r1 r2 3", ii_subi.ToString()); ii_mul ii_mul = new ii_mul(1, 2, 3); Assert.AreEqual("ii_mul r1 r2 r3", ii_mul.ToString()); ii_muli ii_muli = new ii_muli(1, 2, 3); Assert.AreEqual("ii_muli r1 r2 3", ii_muli.ToString()); ii_div ii_div = new ii_div(1, 2, 3); Assert.AreEqual("ii_div r1 r2 r3", ii_div.ToString()); ii_divi ii_divi = new ii_divi(1, 2, 3); Assert.AreEqual("ii_divi r1 r2 3", ii_divi.ToString()); itof itof = new itof(1, 2); Assert.AreEqual("itof r1 r2", itof.ToString()); real_jmp real_jmp = new real_jmp(1); Assert.AreEqual("real_jmp 1", real_jmp.ToString()); jmp_link jmp_link = new jmp_link(1); Assert.AreEqual("jmp_link 1", jmp_link.ToString()); not not = new not(1, 2); Assert.AreEqual("not r1 r2", not.ToString()); or or = new or(1, 2, 3); Assert.AreEqual("or r1 r2 r3", or.ToString()); ret ret = new ret(); Assert.AreEqual("ret", ret.ToString()); s_get_from_v sgfv = new s_get_from_v(1, 2, 3); Assert.AreEqual("s_get_from_v r1 r2 3", sgfv.ToString()); s_load_4byte sl4b = new s_load_4byte(1, 2, 3); Assert.AreEqual("s_load_4byte r1 r2 3", sl4b.ToString()); s_store_4byte ss4b = new s_store_4byte(1, 2, 3); Assert.AreEqual("s_store_4byte r1 r2 3", ss4b.ToString()); s_write_high swh = new s_write_high(1, 5); Assert.AreEqual("s_write_high r1 5", swh.ToString()); s_write_low swl = new s_write_low(1, 5); Assert.AreEqual("s_write_low r1 5", swl.ToString()); s_push s_push = new s_push(1); Assert.AreEqual("s_push r1", s_push.ToString()); s_pop s_pop = new s_pop(1); Assert.AreEqual("s_pop r1", s_pop.ToString()); v_push v_push = new v_push(1); Assert.AreEqual("v_push r1", v_push.ToString()); v_pop v_pop = new v_pop(1); Assert.AreEqual("v_pop r1", v_pop.ToString()); v_get_from_s vgfs = new v_get_from_s(1, 2, 3); Assert.AreEqual("v_get_from_s r1 r2 3", vgfs.ToString()); v_load_16byte vl16 = new v_load_16byte(1, 2, 3); Assert.AreEqual("v_load_16byte r1 r2 3", vl16.ToString()); v_magn v_magn = new v_magn(1, 2); Assert.AreEqual("v_magn r1 r2", v_magn.ToString()); v_store_16byte vs16 = new v_store_16byte(1, 2, 3); Assert.AreEqual("v_store_16byte r1 r2 3", vs16.ToString()); vf_add vf_add = new vf_add(1, 2, 3); Assert.AreEqual("vf_add r1 r2 r3", vf_add.ToString()); vf_sub vf_sub = new vf_sub(1, 2, 3); Assert.AreEqual("vf_sub r1 r2 r3", vf_sub.ToString()); vf_mul vf_mul = new vf_mul(1, 2, 3); Assert.AreEqual("vf_mul r1 r2 r3", vf_mul.ToString()); vf_div vf_div = new vf_div(1, 2, 3); Assert.AreEqual("vf_div r1 r2 r3", vf_div.ToString()); vi_add vi_add = new vi_add(1, 2, 3); Assert.AreEqual("vi_add r1 r2 r3", vi_add.ToString()); vi_sub vi_sub = new vi_sub(1, 2, 3); Assert.AreEqual("vi_sub r1 r2 r3", vi_sub.ToString()); vi_mul vi_mul = new vi_mul(1, 2, 3); Assert.AreEqual("vi_mul r1 r2 r3", vi_mul.ToString()); vi_div vi_div = new vi_div(1, 2, 3); Assert.AreEqual("vi_div r1 r2 r3", vi_div.ToString()); vv_add vv_add = new vv_add(1, 2, 3); Assert.AreEqual("vv_add r1 r2 r3", vv_add.ToString()); vv_sub vv_sub = new vv_sub(1, 2, 3); Assert.AreEqual("vv_sub r1 r2 r3", vv_sub.ToString()); vv_mul_ele vv_mul_ele = new vv_mul_ele(1, 2, 3); Assert.AreEqual("vv_mul_ele r1 r2 r3", vv_mul_ele.ToString()); vv_mul_dot vv_mul_dot = new vv_mul_dot(1, 2, 3); Assert.AreEqual("vv_mul_dot r1 r2 r3", vv_mul_dot.ToString()); vv_div vv_div = new vv_div(1, 2, 3); Assert.AreEqual("vv_div r1 r2 r3", vv_div.ToString()); xor xor = new xor(1, 2, 3); Assert.AreEqual("xor r1 r2 r3", xor.ToString()); }