diff --git a/src/sap2_mini.v b/src/sap2_mini.v index 0e55faa..7c9cc3e 100644 --- a/src/sap2_mini.v +++ b/src/sap2_mini.v @@ -102,7 +102,7 @@ module ctrl(output[29:0] con, output hlt, input clk,clr,am,az,xm,xz, input[7:0] assign con[24] = sc[0] & q; // ES assign con[23] = sc[0] | (sc[3] & (LDA|ADD|SUB|STA|LDB|LDX)); // LM assign con[22] = sc[5] & STA; // WE - assign con[21] = (sc[4] & (LDA|ADD|SUB|LDB|LDX)) | (sc[5] & STA) | sc[2]; // CE sta-t6 + assign con[21] = (sc[4] & (LDA|ADD|SUB|LDB|LDX)) | (sc[5] & STA) | sc[2]; // CE assign con[20] = (sc[3] & XCH) | (sc[4] & STA); // LD assign con[19] = sc[5] & XCH; // ED assign con[18] = sc[2]; // LI @@ -117,7 +117,7 @@ module ctrl(output[29:0] con, output hlt, input clk,clr,am,az,xm,xz, input[7:0] assign con[9] = (sc[3] & (CLA|CMB|AND|NOR)) | (sc[5] & ADD); // S0 assign con[8] = sc[3] & (CLA|CMA|CMB|IOR|AND|NOR|NAN|XOR); // M assign con[7] = sc[5] & ADD; // CI - assign con[6] = (sc[3] & (CMA|CMB|IOR|AND|NOR|NAN|XOR|CLA)) | (sc[5] & ADD); // EU + assign con[6] = (sc[3] & (CMA|CMB|IOR|AND|NOR|NAN|XOR|CLA)) | (sc[5] & (ADD|SUB)); // EU assign con[5] = (sc[3] & CMB) | (sc[4] & (ADD|SUB|CMB)); // LB assign con[4] = (sc[4] & LDX) | (sc[5] & XCH); // LX assign con[3] = sc[3] & INX; // INX diff --git a/src/tb_sap2_mini.v b/src/tb_sap2_mini.v index cdc6c8c..ffe1cbc 100644 --- a/src/tb_sap2_mini.v +++ b/src/tb_sap2_mini.v @@ -22,6 +22,8 @@ module tb_sap2_mini; #4 clr = 1; #4 clr = 0; #4 prog = 1; + + // 1 + 2 + 3 - 4 = 2 #4 a = 8'h0; d = 12'h007; // LDA 07H #4 a = 8'h1; d = 12'h108; // ADD 08H #4 a = 8'h2; d = 12'h109; // ADD 09H @@ -33,6 +35,7 @@ module tb_sap2_mini; #4 a = 8'h8; d = 12'h002; // 002H #4 a = 8'h9; d = 12'h003; // 003H #4 a = 8'ha; d = 12'h004; // 004H + #4 prog = 0; clr = 1; #4 clr = 0; end