diff --git a/src/lib/netlist/generated/static_solvers.cpp b/src/lib/netlist/generated/static_solvers.cpp index 3c4a445b6b3..3b06b7e2c45 100644 --- a/src/lib/netlist/generated/static_solvers.cpp +++ b/src/lib/netlist/generated/static_solvers.cpp @@ -325,6 +325,860 @@ static void nl_gcr_105d3ecb773843b6_49_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// dpatrol +static void nl_gcr_10d27c48eccd37d0_22_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A0 += gt[3]; + m_A2 += go[0]; + m_A2 += go[1]; + m_A1 += go[2]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 += Idr[3]; + RHS0 -= go[3] * *cnV[3]; + m_A3 += gt[4]; + m_A3 += gt[5]; + m_A3 += gt[6]; + m_A3 += gt[7]; + m_A5 += go[4]; + m_A5 += go[5]; + m_A4 += go[6]; + double RHS1 = Idr[4]; + RHS1 += Idr[5]; + RHS1 += Idr[6]; + RHS1 += Idr[7]; + RHS1 -= go[7] * *cnV[7]; + m_A6 += gt[8]; + m_A6 += gt[9]; + m_A6 += gt[10]; + m_A7 += go[8]; + double RHS2 = Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 -= go[9] * *cnV[9]; + RHS2 -= go[10] * *cnV[10]; + m_A10 += gt[11]; + m_A10 += gt[12]; + m_A10 += gt[13]; + m_A12 += go[11]; + m_A9 += go[12]; + m_A8 += go[13]; + double RHS3 = Idr[11]; + RHS3 += Idr[12]; + RHS3 += Idr[13]; + m_A16 += gt[14]; + m_A16 += gt[15]; + m_A16 += gt[16]; + m_A16 += gt[17]; + m_A16 += gt[18]; + m_A17 += go[14]; + m_A14 += go[15]; + m_A14 += go[16]; + m_A13 += go[17]; + m_A13 += go[18]; + double RHS4 = Idr[14]; + RHS4 += Idr[15]; + RHS4 += Idr[16]; + RHS4 += Idr[17]; + RHS4 += Idr[18]; + m_A21 += gt[19]; + m_A21 += gt[20]; + m_A21 += gt[21]; + m_A18 += go[19]; + m_A20 += go[20]; + m_A19 += go[21]; + double RHS5 = Idr[19]; + RHS5 += Idr[20]; + RHS5 += Idr[21]; + const double f0 = 1.0 / m_A0; + const double f0_3 = -f0 * m_A8; + m_A10 += m_A1 * f0_3; + m_A11 += m_A2 * f0_3; + RHS3 += f0_3 * RHS0; + const double f0_4 = -f0 * m_A13; + m_A15 += m_A1 * f0_4; + m_A16 += m_A2 * f0_4; + RHS4 += f0_4 * RHS0; + const double f1 = 1.0 / m_A3; + const double f1_3 = -f1 * m_A9; + m_A10 += m_A4 * f1_3; + m_A11 += m_A5 * f1_3; + RHS3 += f1_3 * RHS1; + const double f1_4 = -f1 * m_A14; + m_A15 += m_A4 * f1_4; + m_A16 += m_A5 * f1_4; + RHS4 += f1_4 * RHS1; + const double f2 = 1.0 / m_A6; + const double f2_5 = -f2 * m_A18; + m_A21 += m_A7 * f2_5; + RHS5 += f2_5 * RHS2; + const double f3 = 1.0 / m_A10; + const double f3_4 = -f3 * m_A15; + m_A16 += m_A11 * f3_4; + m_A17 += m_A12 * f3_4; + RHS4 += f3_4 * RHS3; + const double f3_5 = -f3 * m_A19; + m_A20 += m_A11 * f3_5; + m_A21 += m_A12 * f3_5; + RHS5 += f3_5 * RHS3; + const double f4 = 1.0 / m_A16; + const double f4_5 = -f4 * m_A20; + m_A21 += m_A17 * f4_5; + RHS5 += f4_5 * RHS4; + V[5] = RHS5 / m_A21; + double tmp4 = 0.0; + tmp4 += m_A17 * V[5]; + V[4] = (RHS4 - tmp4) / m_A16; + double tmp3 = 0.0; + tmp3 += m_A11 * V[4]; + tmp3 += m_A12 * V[5]; + V[3] = (RHS3 - tmp3) / m_A10; + double tmp2 = 0.0; + tmp2 += m_A7 * V[5]; + V[2] = (RHS2 - tmp2) / m_A6; + double tmp1 = 0.0; + tmp1 += m_A4 * V[3]; + tmp1 += m_A5 * V[4]; + V[1] = (RHS1 - tmp1) / m_A3; + double tmp0 = 0.0; + tmp0 += m_A1 * V[3]; + tmp0 += m_A2 * V[4]; + V[0] = (RHS0 - tmp0) / m_A0; +} + +// gunfight +static void nl_gcr_14360daccbfc23c0_112_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + double m_A89(0.0); + double m_A90(0.0); + double m_A91(0.0); + double m_A92(0.0); + double m_A93(0.0); + double m_A94(0.0); + double m_A95(0.0); + double m_A96(0.0); + double m_A97(0.0); + double m_A98(0.0); + double m_A99(0.0); + double m_A100(0.0); + double m_A101(0.0); + double m_A102(0.0); + double m_A103(0.0); + double m_A104(0.0); + double m_A105(0.0); + double m_A106(0.0); + double m_A107(0.0); + double m_A108(0.0); + double m_A109(0.0); + double m_A110(0.0); + double m_A111(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A3 += go[2]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + RHS1 -= go[3] * *cnV[3]; + m_A4 += gt[4]; + m_A4 += gt[5]; + m_A5 += go[4]; + double RHS2 = Idr[4]; + RHS2 += Idr[5]; + RHS2 -= go[5] * *cnV[5]; + m_A6 += gt[6]; + m_A6 += gt[7]; + m_A7 += go[6]; + double RHS3 = Idr[6]; + RHS3 += Idr[7]; + RHS3 -= go[7] * *cnV[7]; + m_A8 += gt[8]; + m_A8 += gt[9]; + m_A9 += go[8]; + double RHS4 = Idr[8]; + RHS4 += Idr[9]; + RHS4 -= go[9] * *cnV[9]; + m_A10 += gt[10]; + m_A10 += gt[11]; + m_A12 += go[10]; + m_A11 += go[11]; + double RHS5 = Idr[10]; + RHS5 += Idr[11]; + m_A13 += gt[12]; + m_A13 += gt[13]; + m_A15 += go[12]; + m_A14 += go[13]; + double RHS6 = Idr[12]; + RHS6 += Idr[13]; + m_A17 += gt[14]; + m_A17 += gt[15]; + m_A17 += gt[16]; + m_A16 += go[14]; + m_A18 += go[15]; + double RHS7 = Idr[14]; + RHS7 += Idr[15]; + RHS7 += Idr[16]; + RHS7 -= go[16] * *cnV[16]; + m_A21 += gt[17]; + m_A21 += gt[18]; + m_A21 += gt[19]; + m_A20 += go[17]; + m_A22 += go[18]; + double RHS8 = Idr[17]; + RHS8 += Idr[18]; + RHS8 += Idr[19]; + RHS8 -= go[19] * *cnV[19]; + m_A25 += gt[20]; + m_A25 += gt[21]; + m_A25 += gt[22]; + m_A24 += go[20]; + m_A26 += go[21]; + double RHS9 = Idr[20]; + RHS9 += Idr[21]; + RHS9 += Idr[22]; + RHS9 -= go[22] * *cnV[22]; + m_A29 += gt[23]; + m_A29 += gt[24]; + m_A29 += gt[25]; + m_A28 += go[23]; + m_A30 += go[24]; + double RHS10 = Idr[23]; + RHS10 += Idr[24]; + RHS10 += Idr[25]; + RHS10 -= go[25] * *cnV[25]; + m_A32 += gt[26]; + m_A32 += gt[27]; + m_A32 += gt[28]; + m_A34 += go[26]; + m_A33 += go[27]; + double RHS11 = Idr[26]; + RHS11 += Idr[27]; + RHS11 += Idr[28]; + RHS11 -= go[28] * *cnV[28]; + m_A35 += gt[29]; + m_A35 += gt[30]; + m_A35 += gt[31]; + m_A37 += go[29]; + m_A36 += go[30]; + double RHS12 = Idr[29]; + RHS12 += Idr[30]; + RHS12 += Idr[31]; + RHS12 -= go[31] * *cnV[31]; + m_A40 += gt[32]; + m_A40 += gt[33]; + m_A38 += go[32]; + m_A39 += go[33]; + double RHS13 = Idr[32]; + RHS13 += Idr[33]; + m_A44 += gt[34]; + m_A44 += gt[35]; + m_A42 += go[34]; + m_A43 += go[35]; + double RHS14 = Idr[34]; + RHS14 += Idr[35]; + m_A47 += gt[36]; + m_A47 += gt[37]; + m_A47 += gt[38]; + m_A46 += go[36]; + m_A48 += go[37]; + double RHS15 = Idr[36]; + RHS15 += Idr[37]; + RHS15 += Idr[38]; + RHS15 -= go[38] * *cnV[38]; + m_A50 += gt[39]; + m_A50 += gt[40]; + m_A49 += go[39]; + m_A51 += go[40]; + double RHS16 = Idr[39]; + RHS16 += Idr[40]; + m_A52 += gt[41]; + m_A52 += gt[42]; + m_A52 += gt[43]; + m_A52 += gt[44]; + m_A52 += gt[45]; + m_A53 += go[41]; + m_A54 += go[42]; + m_A54 += go[43]; + double RHS17 = Idr[41]; + RHS17 += Idr[42]; + RHS17 += Idr[43]; + RHS17 += Idr[44]; + RHS17 += Idr[45]; + RHS17 -= go[44] * *cnV[44]; + RHS17 -= go[45] * *cnV[45]; + m_A56 += gt[46]; + m_A56 += gt[47]; + m_A56 += gt[48]; + m_A56 += gt[49]; + m_A57 += go[46]; + m_A58 += go[47]; + m_A55 += go[48]; + double RHS18 = Idr[46]; + RHS18 += Idr[47]; + RHS18 += Idr[48]; + RHS18 += Idr[49]; + RHS18 -= go[49] * *cnV[49]; + m_A60 += gt[50]; + m_A60 += gt[51]; + m_A60 += gt[52]; + m_A60 += gt[53]; + m_A61 += go[50]; + m_A62 += go[51]; + m_A59 += go[52]; + double RHS19 = Idr[50]; + RHS19 += Idr[51]; + RHS19 += Idr[52]; + RHS19 += Idr[53]; + RHS19 -= go[53] * *cnV[53]; + m_A63 += gt[54]; + m_A63 += gt[55]; + m_A63 += gt[56]; + m_A63 += gt[57]; + m_A63 += gt[58]; + m_A64 += go[54]; + m_A65 += go[55]; + m_A65 += go[56]; + double RHS20 = Idr[54]; + RHS20 += Idr[55]; + RHS20 += Idr[56]; + RHS20 += Idr[57]; + RHS20 += Idr[58]; + RHS20 -= go[57] * *cnV[57]; + RHS20 -= go[58] * *cnV[58]; + m_A66 += gt[59]; + m_A66 += gt[60]; + m_A66 += gt[61]; + m_A66 += gt[62]; + m_A67 += go[59]; + m_A68 += go[60]; + m_A68 += go[61]; + double RHS21 = Idr[59]; + RHS21 += Idr[60]; + RHS21 += Idr[61]; + RHS21 += Idr[62]; + RHS21 -= go[62] * *cnV[62]; + m_A71 += gt[63]; + m_A71 += gt[64]; + m_A71 += gt[65]; + m_A71 += gt[66]; + m_A71 += gt[67]; + m_A69 += go[63]; + m_A70 += go[64]; + m_A72 += go[65]; + m_A72 += go[66]; + double RHS22 = Idr[63]; + RHS22 += Idr[64]; + RHS22 += Idr[65]; + RHS22 += Idr[66]; + RHS22 += Idr[67]; + RHS22 -= go[67] * *cnV[67]; + m_A76 += gt[68]; + m_A76 += gt[69]; + m_A76 += gt[70]; + m_A76 += gt[71]; + m_A76 += gt[72]; + m_A73 += go[68]; + m_A75 += go[69]; + m_A78 += go[70]; + m_A78 += go[71]; + m_A74 += go[72]; + double RHS23 = Idr[68]; + RHS23 += Idr[69]; + RHS23 += Idr[70]; + RHS23 += Idr[71]; + RHS23 += Idr[72]; + m_A82 += gt[73]; + m_A82 += gt[74]; + m_A82 += gt[75]; + m_A82 += gt[76]; + m_A82 += gt[77]; + m_A79 += go[73]; + m_A81 += go[74]; + m_A83 += go[75]; + m_A83 += go[76]; + m_A80 += go[77]; + double RHS24 = Idr[73]; + RHS24 += Idr[74]; + RHS24 += Idr[75]; + RHS24 += Idr[76]; + RHS24 += Idr[77]; + m_A90 += gt[78]; + m_A90 += gt[79]; + m_A90 += gt[80]; + m_A90 += gt[81]; + m_A90 += gt[82]; + m_A90 += gt[83]; + m_A90 += gt[84]; + m_A90 += gt[85]; + m_A89 += go[78]; + m_A89 += go[79]; + m_A88 += go[80]; + m_A88 += go[81]; + m_A85 += go[82]; + m_A87 += go[83]; + double RHS25 = Idr[78]; + RHS25 += Idr[79]; + RHS25 += Idr[80]; + RHS25 += Idr[81]; + RHS25 += Idr[82]; + RHS25 += Idr[83]; + RHS25 += Idr[84]; + RHS25 += Idr[85]; + RHS25 -= go[84] * *cnV[84]; + RHS25 -= go[85] * *cnV[85]; + m_A103 += gt[86]; + m_A103 += gt[87]; + m_A103 += gt[88]; + m_A103 += gt[89]; + m_A103 += gt[90]; + m_A103 += gt[91]; + m_A103 += gt[92]; + m_A103 += gt[93]; + m_A99 += go[86]; + m_A99 += go[87]; + m_A98 += go[88]; + m_A98 += go[89]; + m_A92 += go[90]; + m_A93 += go[91]; + double RHS26 = Idr[86]; + RHS26 += Idr[87]; + RHS26 += Idr[88]; + RHS26 += Idr[89]; + RHS26 += Idr[90]; + RHS26 += Idr[91]; + RHS26 += Idr[92]; + RHS26 += Idr[93]; + RHS26 -= go[92] * *cnV[92]; + RHS26 -= go[93] * *cnV[93]; + m_A111 += gt[94]; + m_A111 += gt[95]; + m_A111 += gt[96]; + m_A111 += gt[97]; + m_A111 += gt[98]; + m_A111 += gt[99]; + m_A111 += gt[100]; + m_A111 += gt[101]; + m_A109 += go[94]; + m_A109 += go[95]; + m_A108 += go[96]; + m_A108 += go[97]; + m_A105 += go[98]; + m_A107 += go[99]; + double RHS27 = Idr[94]; + RHS27 += Idr[95]; + RHS27 += Idr[96]; + RHS27 += Idr[97]; + RHS27 += Idr[98]; + RHS27 += Idr[99]; + RHS27 += Idr[100]; + RHS27 += Idr[101]; + RHS27 -= go[100] * *cnV[100]; + RHS27 -= go[101] * *cnV[101]; + const double f0 = 1.0 / m_A0; + const double f0_15 = -f0 * m_A46; + m_A47 += m_A1 * f0_15; + RHS15 += f0_15 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_13 = -f1 * m_A38; + m_A40 += m_A3 * f1_13; + RHS13 += f1_13 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_14 = -f2 * m_A42; + m_A44 += m_A5 * f2_14; + RHS14 += f2_14 * RHS2; + const double f3 = 1.0 / m_A6; + const double f3_18 = -f3 * m_A55; + m_A56 += m_A7 * f3_18; + RHS18 += f3_18 * RHS3; + const double f4 = 1.0 / m_A8; + const double f4_19 = -f4 * m_A59; + m_A60 += m_A9 * f4_19; + RHS19 += f4_19 * RHS4; + const double f5 = 1.0 / m_A10; + const double f5_7 = -f5 * m_A16; + m_A17 += m_A11 * f5_7; + m_A19 += m_A12 * f5_7; + RHS7 += f5_7 * RHS5; + const double f5_26 = -f5 * m_A92; + m_A94 += m_A11 * f5_26; + m_A103 += m_A12 * f5_26; + RHS26 += f5_26 * RHS5; + const double f6 = 1.0 / m_A13; + const double f6_8 = -f6 * m_A20; + m_A21 += m_A14 * f6_8; + m_A23 += m_A15 * f6_8; + RHS8 += f6_8 * RHS6; + const double f6_26 = -f6 * m_A93; + m_A95 += m_A14 * f6_26; + m_A103 += m_A15 * f6_26; + RHS26 += f6_26 * RHS6; + const double f7 = 1.0 / m_A17; + const double f7_9 = -f7 * m_A24; + m_A25 += m_A18 * f7_9; + m_A27 += m_A19 * f7_9; + RHS9 += f7_9 * RHS7; + const double f7_26 = -f7 * m_A94; + m_A96 += m_A18 * f7_26; + m_A103 += m_A19 * f7_26; + RHS26 += f7_26 * RHS7; + const double f8 = 1.0 / m_A21; + const double f8_10 = -f8 * m_A28; + m_A29 += m_A22 * f8_10; + m_A31 += m_A23 * f8_10; + RHS10 += f8_10 * RHS8; + const double f8_26 = -f8 * m_A95; + m_A97 += m_A22 * f8_26; + m_A103 += m_A23 * f8_26; + RHS26 += f8_26 * RHS8; + const double f9 = 1.0 / m_A25; + const double f9_23 = -f9 * m_A73; + m_A76 += m_A26 * f9_23; + m_A77 += m_A27 * f9_23; + RHS23 += f9_23 * RHS9; + const double f9_26 = -f9 * m_A96; + m_A100 += m_A26 * f9_26; + m_A103 += m_A27 * f9_26; + RHS26 += f9_26 * RHS9; + const double f10 = 1.0 / m_A29; + const double f10_24 = -f10 * m_A79; + m_A82 += m_A30 * f10_24; + m_A84 += m_A31 * f10_24; + RHS24 += f10_24 * RHS10; + const double f10_26 = -f10 * m_A97; + m_A101 += m_A30 * f10_26; + m_A103 += m_A31 * f10_26; + RHS26 += f10_26 * RHS10; + const double f11 = 1.0 / m_A32; + const double f11_13 = -f11 * m_A39; + m_A40 += m_A33 * f11_13; + m_A41 += m_A34 * f11_13; + RHS13 += f11_13 * RHS11; + const double f11_27 = -f11 * m_A105; + m_A106 += m_A33 * f11_27; + m_A111 += m_A34 * f11_27; + RHS27 += f11_27 * RHS11; + const double f12 = 1.0 / m_A35; + const double f12_14 = -f12 * m_A43; + m_A44 += m_A36 * f12_14; + m_A45 += m_A37 * f12_14; + RHS14 += f12_14 * RHS12; + const double f12_25 = -f12 * m_A85; + m_A86 += m_A36 * f12_25; + m_A90 += m_A37 * f12_25; + RHS25 += f12_25 * RHS12; + const double f13 = 1.0 / m_A40; + const double f13_27 = -f13 * m_A106; + m_A111 += m_A41 * f13_27; + RHS27 += f13_27 * RHS13; + const double f14 = 1.0 / m_A44; + const double f14_25 = -f14 * m_A86; + m_A90 += m_A45 * f14_25; + RHS25 += f14_25 * RHS14; + const double f15 = 1.0 / m_A47; + const double f15_16 = -f15 * m_A49; + m_A50 += m_A48 * f15_16; + RHS16 += f15_16 * RHS15; + const double f16 = 1.0 / m_A50; + const double f16_22 = -f16 * m_A69; + m_A71 += m_A51 * f16_22; + RHS22 += f16_22 * RHS16; + const double f17 = 1.0 / m_A52; + const double f17_22 = -f17 * m_A70; + m_A71 += m_A53 * f17_22; + m_A72 += m_A54 * f17_22; + RHS22 += f17_22 * RHS17; + const double f17_26 = -f17 * m_A98; + m_A99 += m_A53 * f17_26; + m_A103 += m_A54 * f17_26; + RHS26 += f17_26 * RHS17; + const double f18 = 1.0 / m_A56; + const double f18_23 = -f18 * m_A74; + m_A76 += m_A57 * f18_23; + m_A78 += m_A58 * f18_23; + RHS23 += f18_23 * RHS18; + const double f18_27 = -f18 * m_A107; + m_A109 += m_A57 * f18_27; + m_A111 += m_A58 * f18_27; + RHS27 += f18_27 * RHS18; + const double f19 = 1.0 / m_A60; + const double f19_24 = -f19 * m_A80; + m_A82 += m_A61 * f19_24; + m_A83 += m_A62 * f19_24; + RHS24 += f19_24 * RHS19; + const double f19_25 = -f19 * m_A87; + m_A89 += m_A61 * f19_25; + m_A90 += m_A62 * f19_25; + RHS25 += f19_25 * RHS19; + const double f20 = 1.0 / m_A63; + const double f20_23 = -f20 * m_A75; + m_A76 += m_A64 * f20_23; + m_A78 += m_A65 * f20_23; + RHS23 += f20_23 * RHS20; + const double f20_27 = -f20 * m_A108; + m_A109 += m_A64 * f20_27; + m_A111 += m_A65 * f20_27; + RHS27 += f20_27 * RHS20; + const double f21 = 1.0 / m_A66; + const double f21_24 = -f21 * m_A81; + m_A82 += m_A67 * f21_24; + m_A83 += m_A68 * f21_24; + RHS24 += f21_24 * RHS21; + const double f21_25 = -f21 * m_A88; + m_A89 += m_A67 * f21_25; + m_A90 += m_A68 * f21_25; + RHS25 += f21_25 * RHS21; + const double f22 = 1.0 / m_A71; + const double f22_26 = -f22 * m_A99; + m_A103 += m_A72 * f22_26; + RHS26 += f22_26 * RHS22; + const double f23 = 1.0 / m_A76; + const double f23_26 = -f23 * m_A100; + m_A103 += m_A77 * f23_26; + m_A104 += m_A78 * f23_26; + RHS26 += f23_26 * RHS23; + const double f23_27 = -f23 * m_A109; + m_A110 += m_A77 * f23_27; + m_A111 += m_A78 * f23_27; + RHS27 += f23_27 * RHS23; + const double f24 = 1.0 / m_A82; + const double f24_25 = -f24 * m_A89; + m_A90 += m_A83 * f24_25; + m_A91 += m_A84 * f24_25; + RHS25 += f24_25 * RHS24; + const double f24_26 = -f24 * m_A101; + m_A102 += m_A83 * f24_26; + m_A103 += m_A84 * f24_26; + RHS26 += f24_26 * RHS24; + const double f25 = 1.0 / m_A90; + const double f25_26 = -f25 * m_A102; + m_A103 += m_A91 * f25_26; + RHS26 += f25_26 * RHS25; + const double f26 = 1.0 / m_A103; + const double f26_27 = -f26 * m_A110; + m_A111 += m_A104 * f26_27; + RHS27 += f26_27 * RHS26; + V[27] = RHS27 / m_A111; + double tmp26 = 0.0; + tmp26 += m_A104 * V[27]; + V[26] = (RHS26 - tmp26) / m_A103; + double tmp25 = 0.0; + tmp25 += m_A91 * V[26]; + V[25] = (RHS25 - tmp25) / m_A90; + double tmp24 = 0.0; + tmp24 += m_A83 * V[25]; + tmp24 += m_A84 * V[26]; + V[24] = (RHS24 - tmp24) / m_A82; + double tmp23 = 0.0; + tmp23 += m_A77 * V[26]; + tmp23 += m_A78 * V[27]; + V[23] = (RHS23 - tmp23) / m_A76; + double tmp22 = 0.0; + tmp22 += m_A72 * V[26]; + V[22] = (RHS22 - tmp22) / m_A71; + double tmp21 = 0.0; + tmp21 += m_A67 * V[24]; + tmp21 += m_A68 * V[25]; + V[21] = (RHS21 - tmp21) / m_A66; + double tmp20 = 0.0; + tmp20 += m_A64 * V[23]; + tmp20 += m_A65 * V[27]; + V[20] = (RHS20 - tmp20) / m_A63; + double tmp19 = 0.0; + tmp19 += m_A61 * V[24]; + tmp19 += m_A62 * V[25]; + V[19] = (RHS19 - tmp19) / m_A60; + double tmp18 = 0.0; + tmp18 += m_A57 * V[23]; + tmp18 += m_A58 * V[27]; + V[18] = (RHS18 - tmp18) / m_A56; + double tmp17 = 0.0; + tmp17 += m_A53 * V[22]; + tmp17 += m_A54 * V[26]; + V[17] = (RHS17 - tmp17) / m_A52; + double tmp16 = 0.0; + tmp16 += m_A51 * V[22]; + V[16] = (RHS16 - tmp16) / m_A50; + double tmp15 = 0.0; + tmp15 += m_A48 * V[16]; + V[15] = (RHS15 - tmp15) / m_A47; + double tmp14 = 0.0; + tmp14 += m_A45 * V[25]; + V[14] = (RHS14 - tmp14) / m_A44; + double tmp13 = 0.0; + tmp13 += m_A41 * V[27]; + V[13] = (RHS13 - tmp13) / m_A40; + double tmp12 = 0.0; + tmp12 += m_A36 * V[14]; + tmp12 += m_A37 * V[25]; + V[12] = (RHS12 - tmp12) / m_A35; + double tmp11 = 0.0; + tmp11 += m_A33 * V[13]; + tmp11 += m_A34 * V[27]; + V[11] = (RHS11 - tmp11) / m_A32; + double tmp10 = 0.0; + tmp10 += m_A30 * V[24]; + tmp10 += m_A31 * V[26]; + V[10] = (RHS10 - tmp10) / m_A29; + double tmp9 = 0.0; + tmp9 += m_A26 * V[23]; + tmp9 += m_A27 * V[26]; + V[9] = (RHS9 - tmp9) / m_A25; + double tmp8 = 0.0; + tmp8 += m_A22 * V[10]; + tmp8 += m_A23 * V[26]; + V[8] = (RHS8 - tmp8) / m_A21; + double tmp7 = 0.0; + tmp7 += m_A18 * V[9]; + tmp7 += m_A19 * V[26]; + V[7] = (RHS7 - tmp7) / m_A17; + double tmp6 = 0.0; + tmp6 += m_A14 * V[8]; + tmp6 += m_A15 * V[26]; + V[6] = (RHS6 - tmp6) / m_A13; + double tmp5 = 0.0; + tmp5 += m_A11 * V[7]; + tmp5 += m_A12 * V[26]; + V[5] = (RHS5 - tmp5) / m_A10; + double tmp4 = 0.0; + tmp4 += m_A9 * V[19]; + V[4] = (RHS4 - tmp4) / m_A8; + double tmp3 = 0.0; + tmp3 += m_A7 * V[18]; + V[3] = (RHS3 - tmp3) / m_A6; + double tmp2 = 0.0; + tmp2 += m_A5 * V[14]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[13]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[15]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // breakout static void nl_gcr_15a4e7fbe5facb3a_7_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -9257,659 +10111,6 @@ static void nl_gcr_a1806410e32baeb_26_double_double(double * __restrict V, const V[0] = (RHS0 - tmp0) / m_A0; } -// gunfight -static void nl_gcr_a479712c277f2ba4_108_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) - -{ - - double m_A0(0.0); - double m_A1(0.0); - double m_A2(0.0); - double m_A3(0.0); - double m_A4(0.0); - double m_A5(0.0); - double m_A6(0.0); - double m_A7(0.0); - double m_A8(0.0); - double m_A9(0.0); - double m_A10(0.0); - double m_A11(0.0); - double m_A12(0.0); - double m_A13(0.0); - double m_A14(0.0); - double m_A15(0.0); - double m_A16(0.0); - double m_A17(0.0); - double m_A18(0.0); - double m_A19(0.0); - double m_A20(0.0); - double m_A21(0.0); - double m_A22(0.0); - double m_A23(0.0); - double m_A24(0.0); - double m_A25(0.0); - double m_A26(0.0); - double m_A27(0.0); - double m_A28(0.0); - double m_A29(0.0); - double m_A30(0.0); - double m_A31(0.0); - double m_A32(0.0); - double m_A33(0.0); - double m_A34(0.0); - double m_A35(0.0); - double m_A36(0.0); - double m_A37(0.0); - double m_A38(0.0); - double m_A39(0.0); - double m_A40(0.0); - double m_A41(0.0); - double m_A42(0.0); - double m_A43(0.0); - double m_A44(0.0); - double m_A45(0.0); - double m_A46(0.0); - double m_A47(0.0); - double m_A48(0.0); - double m_A49(0.0); - double m_A50(0.0); - double m_A51(0.0); - double m_A52(0.0); - double m_A53(0.0); - double m_A54(0.0); - double m_A55(0.0); - double m_A56(0.0); - double m_A57(0.0); - double m_A58(0.0); - double m_A59(0.0); - double m_A60(0.0); - double m_A61(0.0); - double m_A62(0.0); - double m_A63(0.0); - double m_A64(0.0); - double m_A65(0.0); - double m_A66(0.0); - double m_A67(0.0); - double m_A68(0.0); - double m_A69(0.0); - double m_A70(0.0); - double m_A71(0.0); - double m_A72(0.0); - double m_A73(0.0); - double m_A74(0.0); - double m_A75(0.0); - double m_A76(0.0); - double m_A77(0.0); - double m_A78(0.0); - double m_A79(0.0); - double m_A80(0.0); - double m_A81(0.0); - double m_A82(0.0); - double m_A83(0.0); - double m_A84(0.0); - double m_A85(0.0); - double m_A86(0.0); - double m_A87(0.0); - double m_A88(0.0); - double m_A89(0.0); - double m_A90(0.0); - double m_A91(0.0); - double m_A92(0.0); - double m_A93(0.0); - double m_A94(0.0); - double m_A95(0.0); - double m_A96(0.0); - double m_A97(0.0); - double m_A98(0.0); - double m_A99(0.0); - double m_A100(0.0); - double m_A101(0.0); - double m_A102(0.0); - double m_A103(0.0); - double m_A104(0.0); - double m_A105(0.0); - double m_A106(0.0); - double m_A107(0.0); - m_A0 += gt[0]; - m_A0 += gt[1]; - m_A1 += go[0]; - double RHS0 = Idr[0]; - RHS0 += Idr[1]; - RHS0 -= go[1] * *cnV[1]; - m_A2 += gt[2]; - m_A2 += gt[3]; - m_A3 += go[2]; - double RHS1 = Idr[2]; - RHS1 += Idr[3]; - RHS1 -= go[3] * *cnV[3]; - m_A4 += gt[4]; - m_A4 += gt[5]; - m_A5 += go[4]; - double RHS2 = Idr[4]; - RHS2 += Idr[5]; - RHS2 -= go[5] * *cnV[5]; - m_A6 += gt[6]; - m_A6 += gt[7]; - m_A7 += go[6]; - double RHS3 = Idr[6]; - RHS3 += Idr[7]; - RHS3 -= go[7] * *cnV[7]; - m_A8 += gt[8]; - m_A8 += gt[9]; - m_A9 += go[8]; - double RHS4 = Idr[8]; - RHS4 += Idr[9]; - RHS4 -= go[9] * *cnV[9]; - m_A10 += gt[10]; - m_A10 += gt[11]; - m_A10 += gt[12]; - m_A10 += gt[13]; - m_A11 += go[10]; - m_A12 += go[11]; - double RHS5 = Idr[10]; - RHS5 += Idr[11]; - RHS5 += Idr[12]; - RHS5 += Idr[13]; - RHS5 -= go[12] * *cnV[12]; - RHS5 -= go[13] * *cnV[13]; - m_A13 += gt[14]; - m_A13 += gt[15]; - m_A15 += go[14]; - m_A14 += go[15]; - double RHS6 = Idr[14]; - RHS6 += Idr[15]; - m_A16 += gt[16]; - m_A16 += gt[17]; - m_A18 += go[16]; - m_A17 += go[17]; - double RHS7 = Idr[16]; - RHS7 += Idr[17]; - m_A20 += gt[18]; - m_A20 += gt[19]; - m_A20 += gt[20]; - m_A19 += go[18]; - m_A21 += go[19]; - double RHS8 = Idr[18]; - RHS8 += Idr[19]; - RHS8 += Idr[20]; - RHS8 -= go[20] * *cnV[20]; - m_A24 += gt[21]; - m_A24 += gt[22]; - m_A24 += gt[23]; - m_A23 += go[21]; - m_A25 += go[22]; - double RHS9 = Idr[21]; - RHS9 += Idr[22]; - RHS9 += Idr[23]; - RHS9 -= go[23] * *cnV[23]; - m_A28 += gt[24]; - m_A28 += gt[25]; - m_A28 += gt[26]; - m_A27 += go[24]; - m_A30 += go[25]; - double RHS10 = Idr[24]; - RHS10 += Idr[25]; - RHS10 += Idr[26]; - RHS10 -= go[26] * *cnV[26]; - m_A32 += gt[27]; - m_A32 += gt[28]; - m_A32 += gt[29]; - m_A31 += go[27]; - m_A33 += go[28]; - double RHS11 = Idr[27]; - RHS11 += Idr[28]; - RHS11 += Idr[29]; - RHS11 -= go[29] * *cnV[29]; - m_A35 += gt[30]; - m_A35 += gt[31]; - m_A35 += gt[32]; - m_A35 += gt[33]; - m_A37 += go[30]; - m_A36 += go[31]; - double RHS12 = Idr[30]; - RHS12 += Idr[31]; - RHS12 += Idr[32]; - RHS12 += Idr[33]; - RHS12 -= go[32] * *cnV[32]; - RHS12 -= go[33] * *cnV[33]; - m_A38 += gt[34]; - m_A38 += gt[35]; - m_A38 += gt[36]; - m_A40 += go[34]; - m_A39 += go[35]; - double RHS13 = Idr[34]; - RHS13 += Idr[35]; - RHS13 += Idr[36]; - RHS13 -= go[36] * *cnV[36]; - m_A41 += gt[37]; - m_A41 += gt[38]; - m_A41 += gt[39]; - m_A43 += go[37]; - m_A42 += go[38]; - double RHS14 = Idr[37]; - RHS14 += Idr[38]; - RHS14 += Idr[39]; - RHS14 -= go[39] * *cnV[39]; - m_A44 += gt[40]; - m_A44 += gt[41]; - m_A44 += gt[42]; - m_A46 += go[40]; - m_A45 += go[41]; - double RHS15 = Idr[40]; - RHS15 += Idr[41]; - RHS15 += Idr[42]; - RHS15 -= go[42] * *cnV[42]; - m_A49 += gt[43]; - m_A49 += gt[44]; - m_A47 += go[43]; - m_A48 += go[44]; - double RHS16 = Idr[43]; - RHS16 += Idr[44]; - m_A53 += gt[45]; - m_A53 += gt[46]; - m_A51 += go[45]; - m_A52 += go[46]; - double RHS17 = Idr[45]; - RHS17 += Idr[46]; - m_A56 += gt[47]; - m_A56 += gt[48]; - m_A56 += gt[49]; - m_A55 += go[47]; - m_A57 += go[48]; - double RHS18 = Idr[47]; - RHS18 += Idr[48]; - RHS18 += Idr[49]; - RHS18 -= go[49] * *cnV[49]; - m_A59 += gt[50]; - m_A59 += gt[51]; - m_A58 += go[50]; - m_A60 += go[51]; - double RHS19 = Idr[50]; - RHS19 += Idr[51]; - m_A62 += gt[52]; - m_A62 += gt[53]; - m_A62 += gt[54]; - m_A62 += gt[55]; - m_A64 += go[52]; - m_A63 += go[53]; - m_A61 += go[54]; - double RHS20 = Idr[52]; - RHS20 += Idr[53]; - RHS20 += Idr[54]; - RHS20 += Idr[55]; - RHS20 -= go[55] * *cnV[55]; - m_A67 += gt[56]; - m_A67 += gt[57]; - m_A67 += gt[58]; - m_A67 += gt[59]; - m_A66 += go[56]; - m_A65 += go[57]; - m_A68 += go[58]; - double RHS21 = Idr[56]; - RHS21 += Idr[57]; - RHS21 += Idr[58]; - RHS21 += Idr[59]; - RHS21 -= go[59] * *cnV[59]; - m_A70 += gt[60]; - m_A70 += gt[61]; - m_A70 += gt[62]; - m_A70 += gt[63]; - m_A72 += go[60]; - m_A71 += go[61]; - m_A69 += go[62]; - double RHS22 = Idr[60]; - RHS22 += Idr[61]; - RHS22 += Idr[62]; - RHS22 += Idr[63]; - RHS22 -= go[63] * *cnV[63]; - m_A77 += gt[64]; - m_A77 += gt[65]; - m_A77 += gt[66]; - m_A77 += gt[67]; - m_A77 += gt[68]; - m_A77 += gt[69]; - m_A78 += go[64]; - m_A73 += go[65]; - m_A74 += go[66]; - m_A76 += go[67]; - double RHS23 = Idr[64]; - RHS23 += Idr[65]; - RHS23 += Idr[66]; - RHS23 += Idr[67]; - RHS23 += Idr[68]; - RHS23 += Idr[69]; - RHS23 -= go[68] * *cnV[68]; - RHS23 -= go[69] * *cnV[69]; - m_A83 += gt[70]; - m_A83 += gt[71]; - m_A83 += gt[72]; - m_A83 += gt[73]; - m_A83 += gt[74]; - m_A83 += gt[75]; - m_A84 += go[70]; - m_A79 += go[71]; - m_A80 += go[72]; - m_A82 += go[73]; - double RHS24 = Idr[70]; - RHS24 += Idr[71]; - RHS24 += Idr[72]; - RHS24 += Idr[73]; - RHS24 += Idr[74]; - RHS24 += Idr[75]; - RHS24 -= go[74] * *cnV[74]; - RHS24 -= go[75] * *cnV[75]; - m_A89 += gt[76]; - m_A89 += gt[77]; - m_A89 += gt[78]; - m_A89 += gt[79]; - m_A85 += go[76]; - m_A86 += go[77]; - m_A88 += go[78]; - m_A87 += go[79]; - double RHS25 = Idr[76]; - RHS25 += Idr[77]; - RHS25 += Idr[78]; - RHS25 += Idr[79]; - m_A100 += gt[80]; - m_A100 += gt[81]; - m_A100 += gt[82]; - m_A100 += gt[83]; - m_A100 += gt[84]; - m_A100 += gt[85]; - m_A98 += go[80]; - m_A91 += go[81]; - m_A92 += go[82]; - m_A93 += go[83]; - double RHS26 = Idr[80]; - RHS26 += Idr[81]; - RHS26 += Idr[82]; - RHS26 += Idr[83]; - RHS26 += Idr[84]; - RHS26 += Idr[85]; - RHS26 -= go[84] * *cnV[84]; - RHS26 -= go[85] * *cnV[85]; - m_A107 += gt[86]; - m_A107 += gt[87]; - m_A107 += gt[88]; - m_A107 += gt[89]; - m_A102 += go[86]; - m_A103 += go[87]; - m_A105 += go[88]; - m_A104 += go[89]; - double RHS27 = Idr[86]; - RHS27 += Idr[87]; - RHS27 += Idr[88]; - RHS27 += Idr[89]; - const double f0 = 1.0 / m_A0; - const double f0_18 = -f0 * m_A55; - m_A56 += m_A1 * f0_18; - RHS18 += f0_18 * RHS0; - const double f1 = 1.0 / m_A2; - const double f1_16 = -f1 * m_A47; - m_A49 += m_A3 * f1_16; - RHS16 += f1_16 * RHS1; - const double f2 = 1.0 / m_A4; - const double f2_17 = -f2 * m_A51; - m_A53 += m_A5 * f2_17; - RHS17 += f2_17 * RHS2; - const double f3 = 1.0 / m_A6; - const double f3_22 = -f3 * m_A69; - m_A70 += m_A7 * f3_22; - RHS22 += f3_22 * RHS3; - const double f4 = 1.0 / m_A8; - const double f4_20 = -f4 * m_A61; - m_A62 += m_A9 * f4_20; - RHS20 += f4_20 * RHS4; - const double f5 = 1.0 / m_A10; - const double f5_21 = -f5 * m_A65; - m_A67 += m_A11 * f5_21; - m_A68 += m_A12 * f5_21; - RHS21 += f5_21 * RHS5; - const double f5_26 = -f5 * m_A91; - m_A98 += m_A11 * f5_26; - m_A100 += m_A12 * f5_26; - RHS26 += f5_26 * RHS5; - const double f6 = 1.0 / m_A13; - const double f6_8 = -f6 * m_A19; - m_A20 += m_A14 * f6_8; - m_A22 += m_A15 * f6_8; - RHS8 += f6_8 * RHS6; - const double f6_26 = -f6 * m_A92; - m_A94 += m_A14 * f6_26; - m_A100 += m_A15 * f6_26; - RHS26 += f6_26 * RHS6; - const double f7 = 1.0 / m_A16; - const double f7_9 = -f7 * m_A23; - m_A24 += m_A17 * f7_9; - m_A26 += m_A18 * f7_9; - RHS9 += f7_9 * RHS7; - const double f7_26 = -f7 * m_A93; - m_A95 += m_A17 * f7_26; - m_A100 += m_A18 * f7_26; - RHS26 += f7_26 * RHS7; - const double f8 = 1.0 / m_A20; - const double f8_10 = -f8 * m_A27; - m_A28 += m_A21 * f8_10; - m_A29 += m_A22 * f8_10; - RHS10 += f8_10 * RHS8; - const double f8_26 = -f8 * m_A94; - m_A96 += m_A21 * f8_26; - m_A100 += m_A22 * f8_26; - RHS26 += f8_26 * RHS8; - const double f9 = 1.0 / m_A24; - const double f9_11 = -f9 * m_A31; - m_A32 += m_A25 * f9_11; - m_A34 += m_A26 * f9_11; - RHS11 += f9_11 * RHS9; - const double f9_26 = -f9 * m_A95; - m_A97 += m_A25 * f9_26; - m_A100 += m_A26 * f9_26; - RHS26 += f9_26 * RHS9; - const double f10 = 1.0 / m_A28; - const double f10_26 = -f10 * m_A96; - m_A100 += m_A29 * f10_26; - m_A101 += m_A30 * f10_26; - RHS26 += f10_26 * RHS10; - const double f10_27 = -f10 * m_A102; - m_A106 += m_A29 * f10_27; - m_A107 += m_A30 * f10_27; - RHS27 += f10_27 * RHS10; - const double f11 = 1.0 / m_A32; - const double f11_25 = -f11 * m_A85; - m_A89 += m_A33 * f11_25; - m_A90 += m_A34 * f11_25; - RHS25 += f11_25 * RHS11; - const double f11_26 = -f11 * m_A97; - m_A99 += m_A33 * f11_26; - m_A100 += m_A34 * f11_26; - RHS26 += f11_26 * RHS11; - const double f12 = 1.0 / m_A35; - const double f12_23 = -f12 * m_A73; - m_A77 += m_A36 * f12_23; - m_A78 += m_A37 * f12_23; - RHS23 += f12_23 * RHS12; - const double f12_27 = -f12 * m_A103; - m_A105 += m_A36 * f12_27; - m_A107 += m_A37 * f12_27; - RHS27 += f12_27 * RHS12; - const double f13 = 1.0 / m_A38; - const double f13_24 = -f13 * m_A79; - m_A83 += m_A39 * f13_24; - m_A84 += m_A40 * f13_24; - RHS24 += f13_24 * RHS13; - const double f13_25 = -f13 * m_A86; - m_A88 += m_A39 * f13_25; - m_A89 += m_A40 * f13_25; - RHS25 += f13_25 * RHS13; - const double f14 = 1.0 / m_A41; - const double f14_16 = -f14 * m_A48; - m_A49 += m_A42 * f14_16; - m_A50 += m_A43 * f14_16; - RHS16 += f14_16 * RHS14; - const double f14_23 = -f14 * m_A74; - m_A75 += m_A42 * f14_23; - m_A77 += m_A43 * f14_23; - RHS23 += f14_23 * RHS14; - const double f15 = 1.0 / m_A44; - const double f15_17 = -f15 * m_A52; - m_A53 += m_A45 * f15_17; - m_A54 += m_A46 * f15_17; - RHS17 += f15_17 * RHS15; - const double f15_24 = -f15 * m_A80; - m_A81 += m_A45 * f15_24; - m_A83 += m_A46 * f15_24; - RHS24 += f15_24 * RHS15; - const double f16 = 1.0 / m_A49; - const double f16_23 = -f16 * m_A75; - m_A77 += m_A50 * f16_23; - RHS23 += f16_23 * RHS16; - const double f17 = 1.0 / m_A53; - const double f17_24 = -f17 * m_A81; - m_A83 += m_A54 * f17_24; - RHS24 += f17_24 * RHS17; - const double f18 = 1.0 / m_A56; - const double f18_19 = -f18 * m_A58; - m_A59 += m_A57 * f18_19; - RHS19 += f18_19 * RHS18; - const double f19 = 1.0 / m_A59; - const double f19_21 = -f19 * m_A66; - m_A67 += m_A60 * f19_21; - RHS21 += f19_21 * RHS19; - const double f20 = 1.0 / m_A62; - const double f20_24 = -f20 * m_A82; - m_A83 += m_A63 * f20_24; - m_A84 += m_A64 * f20_24; - RHS24 += f20_24 * RHS20; - const double f20_25 = -f20 * m_A87; - m_A88 += m_A63 * f20_25; - m_A89 += m_A64 * f20_25; - RHS25 += f20_25 * RHS20; - const double f21 = 1.0 / m_A67; - const double f21_26 = -f21 * m_A98; - m_A100 += m_A68 * f21_26; - RHS26 += f21_26 * RHS21; - const double f22 = 1.0 / m_A70; - const double f22_23 = -f22 * m_A76; - m_A77 += m_A71 * f22_23; - m_A78 += m_A72 * f22_23; - RHS23 += f22_23 * RHS22; - const double f22_27 = -f22 * m_A104; - m_A105 += m_A71 * f22_27; - m_A107 += m_A72 * f22_27; - RHS27 += f22_27 * RHS22; - const double f23 = 1.0 / m_A77; - const double f23_27 = -f23 * m_A105; - m_A107 += m_A78 * f23_27; - RHS27 += f23_27 * RHS23; - const double f24 = 1.0 / m_A83; - const double f24_25 = -f24 * m_A88; - m_A89 += m_A84 * f24_25; - RHS25 += f24_25 * RHS24; - const double f25 = 1.0 / m_A89; - const double f25_26 = -f25 * m_A99; - m_A100 += m_A90 * f25_26; - RHS26 += f25_26 * RHS25; - const double f26 = 1.0 / m_A100; - const double f26_27 = -f26 * m_A106; - m_A107 += m_A101 * f26_27; - RHS27 += f26_27 * RHS26; - V[27] = RHS27 / m_A107; - double tmp26 = 0.0; - tmp26 += m_A101 * V[27]; - V[26] = (RHS26 - tmp26) / m_A100; - double tmp25 = 0.0; - tmp25 += m_A90 * V[26]; - V[25] = (RHS25 - tmp25) / m_A89; - double tmp24 = 0.0; - tmp24 += m_A84 * V[25]; - V[24] = (RHS24 - tmp24) / m_A83; - double tmp23 = 0.0; - tmp23 += m_A78 * V[27]; - V[23] = (RHS23 - tmp23) / m_A77; - double tmp22 = 0.0; - tmp22 += m_A71 * V[23]; - tmp22 += m_A72 * V[27]; - V[22] = (RHS22 - tmp22) / m_A70; - double tmp21 = 0.0; - tmp21 += m_A68 * V[26]; - V[21] = (RHS21 - tmp21) / m_A67; - double tmp20 = 0.0; - tmp20 += m_A63 * V[24]; - tmp20 += m_A64 * V[25]; - V[20] = (RHS20 - tmp20) / m_A62; - double tmp19 = 0.0; - tmp19 += m_A60 * V[21]; - V[19] = (RHS19 - tmp19) / m_A59; - double tmp18 = 0.0; - tmp18 += m_A57 * V[19]; - V[18] = (RHS18 - tmp18) / m_A56; - double tmp17 = 0.0; - tmp17 += m_A54 * V[24]; - V[17] = (RHS17 - tmp17) / m_A53; - double tmp16 = 0.0; - tmp16 += m_A50 * V[23]; - V[16] = (RHS16 - tmp16) / m_A49; - double tmp15 = 0.0; - tmp15 += m_A45 * V[17]; - tmp15 += m_A46 * V[24]; - V[15] = (RHS15 - tmp15) / m_A44; - double tmp14 = 0.0; - tmp14 += m_A42 * V[16]; - tmp14 += m_A43 * V[23]; - V[14] = (RHS14 - tmp14) / m_A41; - double tmp13 = 0.0; - tmp13 += m_A39 * V[24]; - tmp13 += m_A40 * V[25]; - V[13] = (RHS13 - tmp13) / m_A38; - double tmp12 = 0.0; - tmp12 += m_A36 * V[23]; - tmp12 += m_A37 * V[27]; - V[12] = (RHS12 - tmp12) / m_A35; - double tmp11 = 0.0; - tmp11 += m_A33 * V[25]; - tmp11 += m_A34 * V[26]; - V[11] = (RHS11 - tmp11) / m_A32; - double tmp10 = 0.0; - tmp10 += m_A29 * V[26]; - tmp10 += m_A30 * V[27]; - V[10] = (RHS10 - tmp10) / m_A28; - double tmp9 = 0.0; - tmp9 += m_A25 * V[11]; - tmp9 += m_A26 * V[26]; - V[9] = (RHS9 - tmp9) / m_A24; - double tmp8 = 0.0; - tmp8 += m_A21 * V[10]; - tmp8 += m_A22 * V[26]; - V[8] = (RHS8 - tmp8) / m_A20; - double tmp7 = 0.0; - tmp7 += m_A17 * V[9]; - tmp7 += m_A18 * V[26]; - V[7] = (RHS7 - tmp7) / m_A16; - double tmp6 = 0.0; - tmp6 += m_A14 * V[8]; - tmp6 += m_A15 * V[26]; - V[6] = (RHS6 - tmp6) / m_A13; - double tmp5 = 0.0; - tmp5 += m_A11 * V[21]; - tmp5 += m_A12 * V[26]; - V[5] = (RHS5 - tmp5) / m_A10; - double tmp4 = 0.0; - tmp4 += m_A9 * V[20]; - V[4] = (RHS4 - tmp4) / m_A8; - double tmp3 = 0.0; - tmp3 += m_A7 * V[22]; - V[3] = (RHS3 - tmp3) / m_A6; - double tmp2 = 0.0; - tmp2 += m_A5 * V[17]; - V[2] = (RHS2 - tmp2) / m_A4; - double tmp1 = 0.0; - tmp1 += m_A3 * V[16]; - V[1] = (RHS1 - tmp1) / m_A2; - double tmp0 = 0.0; - tmp0 += m_A1 * V[18]; - V[0] = (RHS0 - tmp0) / m_A0; -} - // breakout static void nl_gcr_a59b19805d7e4461_7_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -15184,6 +15385,118 @@ static void nl_gcr_df3a545642cc0a22_7_double_double(double * __restrict V, const V[0] = (RHS0 - tmp0) / m_A0; } +// gunfight +static void nl_gcr_e25792142a75f8c4_14_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A2 += go[0]; + m_A1 += go[1]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 -= go[2] * *cnV[2]; + m_A4 += gt[3]; + m_A4 += gt[4]; + m_A3 += go[3]; + m_A6 += go[4]; + double RHS1 = Idr[3]; + RHS1 += Idr[4]; + m_A9 += gt[5]; + m_A9 += gt[6]; + m_A9 += gt[7]; + m_A9 += gt[8]; + m_A9 += gt[9]; + m_A9 += gt[10]; + m_A9 += gt[11]; + m_A9 += gt[12]; + m_A9 += gt[13]; + m_A7 += go[5]; + m_A10 += go[6]; + m_A10 += go[7]; + double RHS2 = Idr[5]; + RHS2 += Idr[6]; + RHS2 += Idr[7]; + RHS2 += Idr[8]; + RHS2 += Idr[9]; + RHS2 += Idr[10]; + RHS2 += Idr[11]; + RHS2 += Idr[12]; + RHS2 += Idr[13]; + RHS2 -= go[8] * *cnV[8]; + RHS2 -= go[9] * *cnV[9]; + RHS2 -= go[10] * *cnV[10]; + RHS2 -= go[11] * *cnV[11]; + RHS2 -= go[12] * *cnV[12]; + RHS2 -= go[13] * *cnV[13]; + m_A13 += gt[14]; + m_A13 += gt[15]; + m_A13 += gt[16]; + m_A13 += gt[17]; + m_A13 += gt[18]; + m_A12 += go[14]; + m_A12 += go[15]; + m_A11 += go[16]; + double RHS3 = Idr[14]; + RHS3 += Idr[15]; + RHS3 += Idr[16]; + RHS3 += Idr[17]; + RHS3 += Idr[18]; + RHS3 -= go[17] * *cnV[17]; + RHS3 -= go[18] * *cnV[18]; + const double f0 = 1.0 / m_A0; + const double f0_1 = -f0 * m_A3; + m_A4 += m_A1 * f0_1; + m_A5 += m_A2 * f0_1; + RHS1 += f0_1 * RHS0; + const double f0_2 = -f0 * m_A7; + m_A8 += m_A1 * f0_2; + m_A9 += m_A2 * f0_2; + RHS2 += f0_2 * RHS0; + const double f1 = 1.0 / m_A4; + const double f1_2 = -f1 * m_A8; + m_A9 += m_A5 * f1_2; + m_A10 += m_A6 * f1_2; + RHS2 += f1_2 * RHS1; + const double f1_3 = -f1 * m_A11; + m_A12 += m_A5 * f1_3; + m_A13 += m_A6 * f1_3; + RHS3 += f1_3 * RHS1; + const double f2 = 1.0 / m_A9; + const double f2_3 = -f2 * m_A12; + m_A13 += m_A10 * f2_3; + RHS3 += f2_3 * RHS2; + V[3] = RHS3 / m_A13; + double tmp2 = 0.0; + tmp2 += m_A10 * V[3]; + V[2] = (RHS2 - tmp2) / m_A9; + double tmp1 = 0.0; + tmp1 += m_A5 * V[2]; + tmp1 += m_A6 * V[3]; + V[1] = (RHS1 - tmp1) / m_A4; + double tmp0 = 0.0; + tmp0 += m_A1 * V[1]; + tmp0 += m_A2 * V[2]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // zac1b11142 static void nl_gcr_e3e057bb1961a530_178_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -17272,155 +17585,6 @@ static void nl_gcr_eb8f99b7d033585a_57_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// dpatrol -static void nl_gcr_ef9b40abd2bf582c_22_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) - -{ - - double m_A0(0.0); - double m_A1(0.0); - double m_A2(0.0); - double m_A3(0.0); - double m_A4(0.0); - double m_A5(0.0); - double m_A6(0.0); - double m_A7(0.0); - double m_A8(0.0); - double m_A9(0.0); - double m_A10(0.0); - double m_A11(0.0); - double m_A12(0.0); - double m_A13(0.0); - double m_A14(0.0); - double m_A15(0.0); - double m_A16(0.0); - double m_A17(0.0); - double m_A18(0.0); - double m_A19(0.0); - double m_A20(0.0); - double m_A21(0.0); - m_A0 += gt[0]; - m_A0 += gt[1]; - m_A0 += gt[2]; - m_A1 += go[0]; - double RHS0 = Idr[0]; - RHS0 += Idr[1]; - RHS0 += Idr[2]; - RHS0 -= go[1] * *cnV[1]; - RHS0 -= go[2] * *cnV[2]; - m_A2 += gt[3]; - m_A2 += gt[4]; - m_A2 += gt[5]; - m_A2 += gt[6]; - m_A4 += go[3]; - m_A3 += go[4]; - m_A3 += go[5]; - double RHS1 = Idr[3]; - RHS1 += Idr[4]; - RHS1 += Idr[5]; - RHS1 += Idr[6]; - RHS1 -= go[6] * *cnV[6]; - m_A5 += gt[7]; - m_A5 += gt[8]; - m_A5 += gt[9]; - m_A5 += gt[10]; - m_A7 += go[7]; - m_A6 += go[8]; - m_A6 += go[9]; - double RHS2 = Idr[7]; - RHS2 += Idr[8]; - RHS2 += Idr[9]; - RHS2 += Idr[10]; - RHS2 -= go[10] * *cnV[10]; - m_A10 += gt[11]; - m_A10 += gt[12]; - m_A10 += gt[13]; - m_A10 += gt[14]; - m_A10 += gt[15]; - m_A12 += go[11]; - m_A9 += go[12]; - m_A9 += go[13]; - m_A8 += go[14]; - m_A8 += go[15]; - double RHS3 = Idr[11]; - RHS3 += Idr[12]; - RHS3 += Idr[13]; - RHS3 += Idr[14]; - RHS3 += Idr[15]; - m_A16 += gt[16]; - m_A16 += gt[17]; - m_A16 += gt[18]; - m_A17 += go[16]; - m_A14 += go[17]; - m_A13 += go[18]; - double RHS4 = Idr[16]; - RHS4 += Idr[17]; - RHS4 += Idr[18]; - m_A21 += gt[19]; - m_A21 += gt[20]; - m_A21 += gt[21]; - m_A20 += go[19]; - m_A19 += go[20]; - m_A18 += go[21]; - double RHS5 = Idr[19]; - RHS5 += Idr[20]; - RHS5 += Idr[21]; - const double f0 = 1.0 / m_A0; - const double f0_5 = -f0 * m_A18; - m_A21 += m_A1 * f0_5; - RHS5 += f0_5 * RHS0; - const double f1 = 1.0 / m_A2; - const double f1_3 = -f1 * m_A8; - m_A10 += m_A3 * f1_3; - m_A11 += m_A4 * f1_3; - RHS3 += f1_3 * RHS1; - const double f1_4 = -f1 * m_A13; - m_A15 += m_A3 * f1_4; - m_A16 += m_A4 * f1_4; - RHS4 += f1_4 * RHS1; - const double f2 = 1.0 / m_A5; - const double f2_3 = -f2 * m_A9; - m_A10 += m_A6 * f2_3; - m_A11 += m_A7 * f2_3; - RHS3 += f2_3 * RHS2; - const double f2_4 = -f2 * m_A14; - m_A15 += m_A6 * f2_4; - m_A16 += m_A7 * f2_4; - RHS4 += f2_4 * RHS2; - const double f3 = 1.0 / m_A10; - const double f3_4 = -f3 * m_A15; - m_A16 += m_A11 * f3_4; - m_A17 += m_A12 * f3_4; - RHS4 += f3_4 * RHS3; - const double f3_5 = -f3 * m_A19; - m_A20 += m_A11 * f3_5; - m_A21 += m_A12 * f3_5; - RHS5 += f3_5 * RHS3; - const double f4 = 1.0 / m_A16; - const double f4_5 = -f4 * m_A20; - m_A21 += m_A17 * f4_5; - RHS5 += f4_5 * RHS4; - V[5] = RHS5 / m_A21; - double tmp4 = 0.0; - tmp4 += m_A17 * V[5]; - V[4] = (RHS4 - tmp4) / m_A16; - double tmp3 = 0.0; - tmp3 += m_A11 * V[4]; - tmp3 += m_A12 * V[5]; - V[3] = (RHS3 - tmp3) / m_A10; - double tmp2 = 0.0; - tmp2 += m_A6 * V[3]; - tmp2 += m_A7 * V[4]; - V[2] = (RHS2 - tmp2) / m_A5; - double tmp1 = 0.0; - tmp1 += m_A3 * V[3]; - tmp1 += m_A4 * V[4]; - V[1] = (RHS1 - tmp1) / m_A2; - double tmp0 = 0.0; - tmp0 += m_A1 * V[5]; - V[0] = (RHS0 - tmp0) / m_A0; -} - // zac1b11142 static void nl_gcr_f0a19b84f91ff24f_71_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -17955,6 +18119,10 @@ extern const plib::dynlib_static_sym nl_static_solver_syms[]; const plib::dynlib_static_sym nl_static_solver_syms[] = { // konami1x {"nl_gcr_105d3ecb773843b6_49_double_double", reinterpret_cast(&nl_gcr_105d3ecb773843b6_49_double_double)}, +// dpatrol + {"nl_gcr_10d27c48eccd37d0_22_double_double", reinterpret_cast(&nl_gcr_10d27c48eccd37d0_22_double_double)}, +// gunfight + {"nl_gcr_14360daccbfc23c0_112_double_double", reinterpret_cast(&nl_gcr_14360daccbfc23c0_112_double_double)}, // breakout {"nl_gcr_15a4e7fbe5facb3a_7_double_double", reinterpret_cast(&nl_gcr_15a4e7fbe5facb3a_7_double_double)}, // breakout @@ -18027,8 +18195,6 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { {"nl_gcr_99e69c1880e516a7_10_double_double", reinterpret_cast(&nl_gcr_99e69c1880e516a7_10_double_double)}, // tp1985 {"nl_gcr_a1806410e32baeb_26_double_double", reinterpret_cast(&nl_gcr_a1806410e32baeb_26_double_double)}, -// gunfight - {"nl_gcr_a479712c277f2ba4_108_double_double", reinterpret_cast(&nl_gcr_a479712c277f2ba4_108_double_double)}, // breakout {"nl_gcr_a59b19805d7e4461_7_double_double", reinterpret_cast(&nl_gcr_a59b19805d7e4461_7_double_double)}, // 280zzzap @@ -18059,14 +18225,14 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { {"nl_gcr_ddffc2781d05acf_10_double_double", reinterpret_cast(&nl_gcr_ddffc2781d05acf_10_double_double)}, // gamemachine {"nl_gcr_df3a545642cc0a22_7_double_double", reinterpret_cast(&nl_gcr_df3a545642cc0a22_7_double_double)}, +// gunfight + {"nl_gcr_e25792142a75f8c4_14_double_double", reinterpret_cast(&nl_gcr_e25792142a75f8c4_14_double_double)}, // zac1b11142 {"nl_gcr_e3e057bb1961a530_178_double_double", reinterpret_cast(&nl_gcr_e3e057bb1961a530_178_double_double)}, // konami2x {"nl_gcr_e4c54910436826d1_85_double_double", reinterpret_cast(&nl_gcr_e4c54910436826d1_85_double_double)}, // 280zzzap {"nl_gcr_eb8f99b7d033585a_57_double_double", reinterpret_cast(&nl_gcr_eb8f99b7d033585a_57_double_double)}, -// dpatrol - {"nl_gcr_ef9b40abd2bf582c_22_double_double", reinterpret_cast(&nl_gcr_ef9b40abd2bf582c_22_double_double)}, // zac1b11142 {"nl_gcr_f0a19b84f91ff24f_71_double_double", reinterpret_cast(&nl_gcr_f0a19b84f91ff24f_71_double_double)}, // breakout diff --git a/src/mame/audio/mw8080bw.cpp b/src/mame/audio/mw8080bw.cpp index 9049b8781e4..2fca11f815d 100644 --- a/src/mame/audio/mw8080bw.cpp +++ b/src/mame/audio/mw8080bw.cpp @@ -715,6 +715,24 @@ void seawolf_audio_device::device_start() * *************************************/ +// Sound board volume potentiometers. By default, these are all set to their +// midpoint values. + +static INPUT_PORTS_START(gunfight_audio) + PORT_START("POT_1_LEFT_MASTER_VOL") + PORT_ADJUSTER( 50, "Pot: Left Master Volume" ) NETLIST_ANALOG_PORT_CHANGED("sound_nl", "pot_left_master_vol") + PORT_START("POT_2_RIGHT_MASTER_VOL") + PORT_ADJUSTER( 50, "Pot: Right Master Volume" ) NETLIST_ANALOG_PORT_CHANGED("sound_nl", "pot_right_master_vol") + PORT_START("POT_3_LEFT_SHOT_VOL") + PORT_ADJUSTER( 50, "Pot: Left Shot Volume" ) NETLIST_ANALOG_PORT_CHANGED("sound_nl", "pot_left_shot_vol") + PORT_START("POT_4_RIGHT_SHOT_VOL") + PORT_ADJUSTER( 50, "Pot: Right Shot Volume" ) NETLIST_ANALOG_PORT_CHANGED("sound_nl", "pot_right_shot_vol") + PORT_START("POT_5_LEFT_HIT_VOL") + PORT_ADJUSTER( 50, "Pot: Left Hit Volume" ) NETLIST_ANALOG_PORT_CHANGED("sound_nl", "pot_left_hit_vol") + PORT_START("POT_6_RIGHT_HIT_VOL") + PORT_ADJUSTER( 50, "Pot: Right Hit Volume" ) NETLIST_ANALOG_PORT_CHANGED("sound_nl", "pot_right_hit_vol") +INPUT_PORTS_END + gunfight_audio_device::gunfight_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) : device_t(mconfig, GUNFIGHT_AUDIO, tag, owner, clock), m_left_shot(*this, "sound_nl:left_shot"), @@ -733,10 +751,10 @@ void gunfight_audio_device::write(u8 data) // the 74175 latches and inverts the top 4 bits switch ((~data >> 4) & 0x0f) { - case 0x01: // LEFT SHOOT sound (left speaker) + case 0x01: // LEFT SHOT sound (left speaker) m_left_shot->write_line(1); break; - case 0x02: // RIGHT SHOOT sound (right speaker) + case 0x02: // RIGHT SHOT sound (right speaker) m_right_shot->write_line(1); break; case 0x03: // LEFT HIT sound (left speaker) @@ -770,15 +788,30 @@ void gunfight_audio_device::device_add_mconfig(machine_config &config) NETLIST_LOGIC_INPUT(config, "sound_nl:left_hit", "I_LEFT_HIT.IN", 0); NETLIST_LOGIC_INPUT(config, "sound_nl:right_hit", "I_RIGHT_HIT.IN", 0); - // Multipliers set so that the highest output spikes of - // +/- 3 volts at mid potentiometer settings give safe - // non-clipping sample values of +/- 30,000. This would - // lead to clipping if all the potentiometers were set to max, - // but that's unlikely to happen, since the potentiometers are - // currently fixed and even on the real machine were service - // adjustments only. - NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUT_L").set_mult_offset(30000.0 / 3.0, 0.0); - NETLIST_STREAM_OUTPUT(config, "sound_nl:cout1", 1, "OUT_R").set_mult_offset(30000.0 / 3.0, 0.0); + // With all the volume potentiometers at their default midpoint + // settings, the highest output spikes are around +/- 3 volts, for an + // extreme output swing of 6 volts. Gun Fight's audio power amplifiers + // are configured with a voltage gain of 15 and have a single power + // supply of about 22 volts, so they will definitely clip the highest + // output peaks, but we don't model them. Instead, be cautious: scale + // the outputs before the power amps so that the highest output spikes + // of +/- 3 volts just reach the clipping limits for signed 16-bit + // samples. + NETLIST_STREAM_OUTPUT(config, "sound_nl:cout0", 0, "OUT_L").set_mult_offset(32767.0 / 3.0, 0.0); + NETLIST_STREAM_OUTPUT(config, "sound_nl:cout1", 1, "OUT_R").set_mult_offset(32767.0 / 3.0, 0.0); + + // Netlist volume-potentiometer interfaces + NETLIST_ANALOG_INPUT(config, "sound_nl:pot_left_master_vol", "R103.DIAL"); + NETLIST_ANALOG_INPUT(config, "sound_nl:pot_right_master_vol", "R203.DIAL"); + NETLIST_ANALOG_INPUT(config, "sound_nl:pot_left_shot_vol", "R123.DIAL"); + NETLIST_ANALOG_INPUT(config, "sound_nl:pot_right_shot_vol", "R223.DIAL"); + NETLIST_ANALOG_INPUT(config, "sound_nl:pot_left_hit_vol", "R110.DIAL"); + NETLIST_ANALOG_INPUT(config, "sound_nl:pot_right_hit_vol", "R210.DIAL"); +} + +ioport_constructor gunfight_audio_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(gunfight_audio); } void gunfight_audio_device::device_start() diff --git a/src/mame/audio/mw8080bw.h b/src/mame/audio/mw8080bw.h index 498fbf65e78..91caf9e5e41 100644 --- a/src/mame/audio/mw8080bw.h +++ b/src/mame/audio/mw8080bw.h @@ -56,6 +56,7 @@ public: protected: virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; virtual void device_start() override; private: diff --git a/src/mame/audio/nl_gunfight.cpp b/src/mame/audio/nl_gunfight.cpp index 2a5f653b5c9..d6c91de1eb2 100644 --- a/src/mame/audio/nl_gunfight.cpp +++ b/src/mame/audio/nl_gunfight.cpp @@ -4,86 +4,252 @@ #include "netlist/devices/net_lib.h" -#ifndef __PLIB_PREPROCESSOR__ - - #define NOISE(_name) \ - NET_REGISTER_DEV(NOISE, _name) - -#endif - #define USE_FRONTIERS 1 #define FAST_SWITCHES 1 -// I got this circuit's layout from Midway's schematic, "Gun Fight Sound -// Generator Detail P.C. 597-907E". +// This is a netlist description for the sound circuits of Midway's Gun Fight, +// based on Midway's schematic "Gun Fight Sound Generator Detail P.C. +// 597-907E". +// +// (This sound circuitry seems to have evolved from that for an older Midway +// game, an electromechanical rifle game from 1974 called Twin Pirate Gun. The +// schematics for Twin Pirate Gun's sound circuitry (P.C. 569-907-88), +// although not completely identical to Gun Fight's, are similar both in +// general structure and in many details.) +// +// Gun Fight's sound effects are simple "bang" sounds, both for the shooting +// of bullets and for bullets hitting targets. The effects are directed to the +// left or right speaker, depending on whether the left or right player is +// shooting or being hit. (Hits to obstacles get the same sound as hits to the +// right player and thus play from the right speaker.) Each sound effect gets +// a different pitch, with shots being higher pitched than hits. Shot sounds +// also decay faster than hit sounds and have slightly separated initial and +// secondary attacks, resulting in a "ka-pow" effect. +// +// The sounds are generated in stages by different sections of the circuitry. +// A noise generator, based on a zener diode, continuously produces white +// noise that forms the basis for all the sounds, and this noise is fed to +// four separate sound generators. Each generator filters the noise to produce +// the distinct pitch of its sound. Each generator's sound is triggered by a +// switch, activated digitally by the CPU. When this switch is turned on +// momentarily, a storage capacitor is charged up, and that sends power to the +// sound generator's transistor amplifier. This amplifies the filtered noise +// with a sharp attack as the switch is turned on and gradual decay as the +// capacitor drains. The generated sound is filtered further and then +// attenuated by a potentiometer which controls that sound's relative volume. +// Each side's two sound effect signals, after being generated and then +// attenuated by their respective volume pots, are mixed together and then +// further amplified by a second-stage transistor amplifier for that side. +// This mixed and amplified signal is itself filtered and then attenuated by +// the side's master volume potentiometer. Finally it gets sent to the power +// amplifier IC for that side's speaker. (This emulation does not handle the +// final power amplification.) +// +// The different sound effect generators have a common structure which is +// repeated four times. The mixers and second-stage amplifiers likewise have a +// common structure which is repeated twice, and their amplifiers are also +// rather similar to the effect amplifiers. +// +// To make the netlist easier to follow and verify, I've grouped its +// components and connections by function, with the groups ordered roughly +// according to the flow of signals: +// +// * the activating switches, +// * the shared noise generator, +// * the sound-effect noise filters, +// * the sound-effect initial amplifiers, output coupling capacitors and +// filters, and effect-volume potentiometers, +// * the mixing circuits, +// * the second-stage amplifiers, output coupling capacitors and filters, and +// master-volume potentiometers. +// +// Within each group, I've placed the sets of four similar components or +// connections together and listed them in the order: left-shot, right-shot, +// left-hit, right-hit. (For mixing and second-stage amplification components, +// the order is simply left, right.) Individual components are labeled the +// same as on the schematic. + + +// There are some uncertainties in this emulation about sound levels. The +// average level of the initially generated noise is uncertain, which poses a +// problem because all of the sound effects are based on amplifying that +// noise. The noise is generated by passing a small amount of current through +// a zener diode on the verge of its breakdown voltage, which results in very +// noisy current flow. Even though both the type of zener and the average +// current are known, the average strength of the noise is still uncertain, +// both because zener manufacturers do not specify performance under these +// conditions (they recommended zeners for voltage control under more stable, +// relatively noise-free operating conditions) and because the amount of noise +// may vary greatly from one zener to the next, even within the same +// production batch--let alone from one manufacturer to another. This is an +// inherent problem with zener diodes when used for noise generation. +// +// I have chosen a round figure of 2 mV RMS for the zener's average (RMS) +// noise level. Although this is only a guess, it seems to be in the ballpark +// for similar zeners operated with similar amounts of average current. It +// also keeps the noise component of the sound effects strong enough so as not +// to be overwhelmed by the pulse of the sound effects' initial attacks; this +// pulse is created by switching on their generating amplifiers and is +// independent of noise level. Meanwhile, this noise level is still low enough +// that, with all the volume potentiometers set to their midpoints, the noise +// won't be clipped by any subsequent amplification stage in the netlist, up +// to the power amp inputs. (Some such clipping may occur if a sound effect's +// volume is turned up well beyond its midpoint. That may also be true on real +// hardware.) +// +// The other big uncertainty is the audible effect of the power amp ICs. These +// amplifiers add both power and voltage gain, which may be enough to distort +// or clip the output. They may also have an audible filtering effect. In the +// Gun Fight schematic, and apparently in real machines, they are configured +// for a voltage gain of 15. Furthermore, any input voltages beyond a few +// hundred mV (positive or negative) should produce at least some clipping +// distortion, with the distortion getting worse for stronger signals. With +// all potentiometers set to the midpoint, the power amp signal inputs should +// see extreme pulses of +/- 3 V from the initial attack for sound effects, +// and even past those initial attack pulses, the sound effect noise should +// kick in at levels above +/- 1 V on the power amp inputs. If these levels +// are correct and the power amp ICs work as described, the noise of the sound +// effects should initially be heavily distorted, but since the original +// signal is already random noise, it's not clear whether that distortion +// would be apparent. Anyhow, the power amp ICs are completely unemulated +// here, and any distortion effects they might produce would be quite +// different from the hard clipping produced when limiting output levels +// digitally. +// +// I have compromized by setting the volume multipliers for the netlist stream +// outputs so that output levels of +/- 3 volts will produce the maximum +// allowed stream output magnitudes of +/- 32767. Voltages beyond that will be +// clipped. This at least produces some distortion if the volume +// potentiometers are adjusted above their midpoints. +// +// Further improving accuracy would require testing signal levels on actual +// hardware, with allowances made for variations in components, as well as a +// better understanding of the electrical and sonic behavior of the power +// amplifiers, speakers, and cabinet. It's questionable whether doing so is +// worth the effort. + + +// As I've said, this netlist does not include the final stage of sound +// generation, the twin audio power amplifier ICs. Although it is the norm for +// MAME analog sound emulation to omit this stage, some discussion of the +// power amplifiers is worthwhile in this case. Each is an SGS-ATES +// TAA-621-A11 single-channel amplifier, driving one 8-ohm speaker of about 4 +// or 5 inches. +// +// (On the Gun Fight schematic, the TAA-621-A11 is also labeled "LM354". The +// TAA-621-A11 was introduced in 1970 by the Italian firm SGS. The very +// similar LM354 was introduced in 1972 by European Electronic Products. +// However, this company seems to have been a mere U.S. importer and +// distributor of European components, making the LM354 just a rebadged +// TAA-621-A11. The LM354 occasionally comes up in discussions of Gun Fight +// audio but seems to have been otherwise short-lived. One problem with its +// name is that it can easily be mistaken for a National Semiconductor LMxxx +// linear IC, even though it's unrelated to that company. To further confuse +// matters, National Semiconductor had already introduced an LM354 of their +// own in 1970 which wasn't an audio amplifier at all, but a second-source +// version of Texas Instruments' SN7525 sense amplifier for minicomputer +// magnetic-core memory systems.) +// +// As is normal for TAA-621-A11 amps, those in Gun Fight are configured with +// some negative feedback to control their voltage gain. The gain is +// determined by the ratio of the chip's internal 15-kohm feedback resistor to +// the external resistor connected to the feedback terminal, pin 10. In Gun +// Fight this external resistor is 1 kohm, so the ratio, and thus the voltage +// gain, is 15. +// +// The TAA-621-A11 is rated at 4 watts at 10% total harmonic distortion (THD) +// when supplied with 24-volt power and driving a 16-ohm load. (Although not +// explicitly stated, this appears to be an RMS rating rather than a peak +// rating.) In Gun Fight's case, the speaker load is only 8 ohms, and the +// power supply voltage is a bit lower, about 22 volts (it comes from +// rectified 16.5-volt-RMS AC, buffered by a large smoothing capacitor). Both +// of these factors lower the power rating somewhat. Also, a power rating at +// 10% THD implies clipping is already heavy. The unclipped, clean power +// rating in Gun Fight would be lower, probably no more than 2 watts RMS, +// giving output around 4 volts RMS or about 5.5 volts in extreme amplitude. +// With a power amp voltage gain of 15, this would mean that any input signals +// with extreme amplitudes greater than about a third of a volt would be +// subject to power amp clipping. +// +// The power amps also have a few other connections, including ripple bypass +// capacitors to suppress ripple from the unregulated power supply, frequency +// compensation capacitors to prevent inducing unstable amplifier oscillations +// at high frequencies, and some filtering on the output to the speakers. + // All of the amplifying transistors in this circuit are NPN transistors of a // particular type, marked as "A-138" on the Gun Fight schematics. This seems // to be the Amperex A-138, a low-power silicon NPN transistor made by Amperex -// Electronics, which was a U.S. division of Philips. This transistor is long -// obsolete and has fallen into obscurity. The only source I could find with -// any data on it (given in greatly abbreviated form) is _Transistor -// Discontinued Devices D.A.T.A.Book, Edition 16_ (1980), by Derivation and -// Tabulation Associates; the A-138 is listed on p. 76, line 86. From that -// source, and the way the transistor is used in Gun Fight, it appears to be -// a fairly ordinary NPN transistor not very different from the 2N3904. +// Electronic Corporation, which was a U.S. division of Philips. This +// transistor, being a vendor-specific type long out of production, seems to +// have fallen into obscurity. The only source I could find with any data on +// it (given in greatly abbreviated form) is _Transistor Discontinued Devices +// D.A.T.A.Book, Edition 16_ (1980), by Derivation and Tabulation Associates, +// which lists the A-138 on p. 76, line 86. +// +// This source shows the A-138 to be an ordinary amplifier transistor of +// fairly high gain, with a maximum small-signal forward current transfer +// ratio (h_fe, AC current gain) of 650. The minimum h_fe is not given, but it +// can be estimated using the fact that such transistors are often graded and +// designated by gain. The A-137, another Amperex transistor listed on line 85 +// of the same D.A.T.A.Book page, has the same limits on power, collector +// current, and junction voltages, and thus appears to be in the same series, +// but it has a maximum h_fe of 415. If the A-137 was the next lower grade of +// gain from the A-138, the latter should have a minimum h_fe around 400. +// Values for h_FE, the DC forward current transfer ratio (DC current gain), +// aren't given for the A-138, but the range would be about the same or a bit +// lower, perhaps 350-600, with an average around 450-500. +// +// The high gain of Gun Fight's A-138 transistors causes a "ka-pow" effect in +// its shot sounds; I explain how later. (Andy Wellburn, in a Discord chat on +// 2020-06-05, confirmed this effect can be heard in some actual machines. He +// measured an h_FE of 238 for one A-138 from a Gun Fight sound board, but he +// warned that for old transistors like this, h_FE measurements can vary a +// lot, and I'm not surprised that the transistors' gain might be reduced more +// than 40 years later. But even a gain of 238 turns out to be high enough to +// give the "ka-pow" shot effect.) +// +// Considering the A-138's high gain and other limits, a decent match for it +// here seems to be the BC548C, which is modeled in the netlist library. The +// BC548C is the high-gain version of the BC548, a widely used Pro Electron +// standard type of general-purpose small-signal transistor in a through-hole +// TO-92 package. All A-138 transistors in this netlist are modeled as +// BC548Cs. -// Gun Fight's noise generator circuit is based on a reverse-biased 9.1-volt -// Zener diode (D304, a 1N5239). The Zener's noise current is amplified by a -// transistor, resulting in white noise output whose peak-to-peak voltage -// should be around a volt, according to various sources (e.g., _Diode, -// Transistor & FET Circuits Manual_, R. M. Marston (2013), p. 107). Since the -// netlist library does not yet support Zener diodes or their noise behavior, -// I use a very simple 1-volt peak-to-peak white noise generator instead. - -static NETLIST_START(NOISE) - VS(FV, 0) - PARAM(FV.FUNC, "rand() - 0.5") - - ALIAS(P, FV.P) - ALIAS(N, FV.N) -NETLIST_END() - -// Most of the Gun Fight sound circuits have a common structure which is -// repeated four times, one for each type of sound effect. (For the common -// left-master and right-master amplifiers and outputs, the structure is -// repeated only twice.) To make the netlist easier to follow and verify, I've -// grouped its components and connections by function, ordering the groups -// approximately according to the flow of signals from the activating switches -// (and the common noise source) to the initial sound-effect filters and -// amplifiers, to their coupling capacitors and potentiometers, and then to -// the mixing circuits and the second-stage amplifiers, coupling capacitors -// and master-volume potentiometers. Within each group, I've grouped the sets -// of four similar components or connections together and listed them in the -// order: left-shot, right-shot, left-hit, right-hit. (For master-related -// components, the order is simply left and right.) - -// The sound effects are simple "bang" sounds that are generated by -// single-transistor amplifiers which are wired in a common-emitter -// configuration. These amplifiers draw their current from storage capacitors -// which are charged from the 16.5-volt power supply via dual-transistor -// switches; the switches, in turn, are activated by digital signals from TTL -// logic. The charging of the capacitors by the switches, and their -// discharging by the amplifiers, provide the attack and decay of the "bang" -// sounds. static NETLIST_START(gunfight_schematics) + // **** Sound effect activation switches. + + // These switches are triggered by digital logic signals activated by + // the CPU. A high TTL logic level turns the switch on, allowing + // 16-volt power to flow through the switch into the sound effect + // generator's amplifier and storage capacitor, and a low logic level + // turns the switch off, cutting off the power flow. In practice, each + // sound effect is triggered by turning its switch on for about 50 ms + // and then switching it off again. + // + // Each switch is built from two transistors: a "low-side" NPN + // transistor which is switched on when a high TTL output level drives + // the NPN's base high, and a "high-side" PNP transistor which is + // switched on when the now conducting NPN pulls the PNP's base low. + // It is the high-side PNP transistor that actually switches the + // 16-volt power, hence the term "high-side". + #if FAST_SWITCHES - // Use fast, abstracted activation switches instead of a detailed - // circuit model of the actual dual-transistor activation switches. - // Although the latter would simulate the total circuit more - // accurately, it does not make any audible difference in the - // sound output produced. + // Use abstracted activation switches instead of a detailed circuit + // model of the dual-transistor switches. This gives faster emulation + // while not making any audible difference in the sound produced. - SYS_DSW(SW_LEFT_SHOT, IN_LS, I_V16_5.Q, R130.1) - SYS_DSW(SW_RIGHT_SHOT, IN_RS, I_V16_5.Q, R230.1) - SYS_DSW(SW_LEFT_HIT, IN_LH, I_V16_5.Q, R117.1) - SYS_DSW(SW_RIGHT_HIT, IN_RH, I_V16_5.Q, R217.1) + SYS_DSW(SW_LEFT_SHOT, IN_LS, I_V16.Q, R130.1) + SYS_DSW(SW_RIGHT_SHOT, IN_RS, I_V16.Q, R230.1) + SYS_DSW(SW_LEFT_HIT, IN_LH, I_V16.Q, R117.1) + SYS_DSW(SW_RIGHT_HIT, IN_RH, I_V16.Q, R217.1) - // The default on-resistance of 1 ohm is a bit high for my tastes, - // considering the charging resistor which follows is only 15 ohms. + // Lower the on-resistance to a more accurate value. The charging + // resistor which follows is only 15 ohms, so the default + // on-resistance of 1 ohm might noticeably affect the result. PARAM(SW_LEFT_SHOT.RON, 0.1) PARAM(SW_RIGHT_SHOT.RON, 0.1) PARAM(SW_LEFT_HIT.RON, 0.1) @@ -91,11 +257,7 @@ static NETLIST_START(gunfight_schematics) #else - // Each dual-transistor switch has two parts: a "low-side" NPN - // transistor which is switched by a TTL logic input, and a - // "high-side" PNP transistor which is switched by the low-side - // NPN transistor. It is the PNP transistor which actually switches - // the 16.5-volt power. + // Detailed circuit model of the dual-transistor switches. // "Low-side" NPN transistor switches, driven by TTL logic inputs. @@ -114,14 +276,16 @@ static NETLIST_START(gunfight_schematics) RES(R120, RES_K(5.1)) RES(R220, RES_K(5.1)) - QBJT_SW(Q108, "NPN") - QBJT_SW(Q208, "NPN") - QBJT_SW(Q105, "NPN") - QBJT_SW(Q205, "NPN") + QBJT_SW(Q108, "BC548C") + QBJT_SW(Q208, "BC548C") + QBJT_SW(Q105, "BC548C") + QBJT_SW(Q205, "BC548C") - // These actually all go to TTL ground at pin 7 of 7404 IC H6, - // rather than the usual circuit ground. - NET_C(R133.2, R233.2, R120.2, R220.2, Q108.E, Q208.E, Q105.E, Q205.E, GND) + // These all go to TTL ground at pin 7 of 7404 IC H6, rather than the + // ground used for the other sound circuits. + NET_C(GND, + R133.2, R233.2, R120.2, R220.2, + Q108.E, Q208.E, Q105.E, Q205.E) NET_C(R134.2, R133.1, Q108.B) NET_C(R234.2, R233.1, Q208.B) @@ -138,22 +302,26 @@ static NETLIST_START(gunfight_schematics) NET_C(Q105.C, R118.1) NET_C(Q205.C, R218.1) - // "High-side" PNP transistor switches, driven by "low-side" - // NPN switch outputs. The output of these goes to the storage - // capacitors and the current inputs of the sound-effect amplifiers. + // "High-side" PNP transistor switches, driven by "low-side" NPN + // switch outputs. The PNP switch outputs charge the storage + // capacitors that supply power to the sound-effect amplifiers; in + // addition, while they are on they power the amplifiers directly. RES(R132, RES_K(5.1)) RES(R232, RES_K(5.1)) RES(R119, RES_K(5.1)) RES(R219, RES_K(5.1)) + // The actual transistors used here are 2N4125s: QBJT_SW(Q107, "PNP") QBJT_SW(Q207, "PNP") QBJT_SW(Q104, "PNP") QBJT_SW(Q204, "PNP") - // All connected to 16.5-volt power. - NET_C(R132.1, R232.1, R119.1, R219.1, Q107.E, Q207.E, Q104.E, Q204.E, I_V16_5.Q) + // All connected to 16-volt power. + NET_C(I_V16.Q, + R132.1, R232.1, R119.1, R219.1, + Q107.E, Q207.E, Q104.E, Q204.E) NET_C(R131.2, R132.2, Q107.B) NET_C(R231.2, R232.2, Q207.B) @@ -165,12 +333,13 @@ static NETLIST_START(gunfight_schematics) NET_C(Q104.C, R117.1) NET_C(Q204.C, R217.1) - // Description of switches ends here. + // End of switch description. #endif - // The following are the current inputs to the storage capacitors and - // sound-effect amplifiers. + + // **** Current supply and storage capacitors for sound-effect + // **** amplifiers. RES(R130, RES_R(15)) RES(R230, RES_R(15)) @@ -181,35 +350,126 @@ static NETLIST_START(gunfight_schematics) CAP(C222, CAP_U(10)) CAP(C116, CAP_U(20)) CAP(C216, CAP_U(20)) - NET_C(C122.2, C222.2, C116.2, C216.2, GND) + NET_C(GND, C122.2, C222.2, C116.2, C216.2) NET_C(R130.2, C122.1, R126.1, R124.1) NET_C(R230.2, C222.1, R226.1, R224.1) NET_C(R117.2, C116.1, R113.1, R111.1) NET_C(R217.2, C216.1, R213.1, R211.1) - // Use a simple noise generating macro device, based on a voltage - // source, to simulate the AC noise generated by amplified Zener. - // This is the basic noise source which is filtered and amplified by - // the sound-effect circuits. - NOISE(N1) - NET_C(N1.N, GND) + // **** Shared white-noise generator circuit. This is the basic noise + // **** source which is filtered and amplified by the sound-effect + // **** circuits. - // Coupling capacitors from noise generator to sound effect - // frequency filters. + // Gun Fight's noise generator circuit is based on a reverse-biased + // 9.1-volt zener diode (D304, a 1N5239) whose noise current is then + // amplified by an A-138 NPN transistor, producing white noise at + // audio frequencies. + // + // (Strictly speaking, this is not a *pure* white noise generator, + // because the generator's bypass capacitor and biasing resistor, in + // combination with negative feedback from the amplified signal, act + // as a high-pass RC filter, filtering out the lowest noise + // frequencies.) + // + // Figuring out how strong the noise signal should be for this circuit + // is difficult. The noise generator's biasing resistors and + // transistor gain limit the average current through its zener to + // around 2 microamps, but the 1N5239 is normally expected to be used + // with much larger currents, in the range of 250 microamps to 50 + // milliamps. + // + // Zeners are most often used for smoothly controlling and limiting + // voltage with minimal fluctuation, like in a power regulator. But a + // zener can only do this smoothly if it passes a large enough + // current. This is especially true for "zeners" of voltages of 9.1 + // volts or more, which properly speaking are "avalanche diodes" that + // don't user the actual Zener effect but rather a different effect, + // avalanche breakdown, which is capable of generating far more noise. + // Standard zener specifications include "knee" figures which in + // effect give the minimum expected current, along with the maximum + // "dynamic impedance" at that current: how much the voltage may vary + // if the current changes, or vice versa. For the 1N5239, the knee is + // at 250 microamps, and the maximum dynamic impedance at the knee is + // 600 ohms, so a 1 microamp increase in current at that point would + // raise the voltage drop by up to 0.6 millivolts. Noise values for + // zeners are often not given at all, or if they are (as with + // Motorola's zeners), they are given at the knee current. In short, + // the manufacturer expects the current to be kept above the knee + // value, and if your current is lower, you're on your own. + // + // At very low currents, still within the breakdown region but well + // below the knee current, the zener's dynamic impedance is much + // greater, and more importantly, so is its noise. The conduction of + // current is no longer smooth and regular, but pulsing and episodic, + // as small conducting "microplasmas" within the diode's junction are + // repeatedly triggered and extinguished, like microscopic versions of + // lightning bolts in a thunderstorm. + // + // The netlist library includes a Zener diode model, but this model + // does not simulate the Zener's noise behavior. Instead I generate + // the noise from a noise voltage source in series with the Zener. + + // Simple model of a 1N5239 9.1-volt Zener diode. The 1N5239 is + // specified to conduct 20 mA of current at its nominal breakdown + // voltage of 9.1 V. The model produces an exponential I-V curve, + // passing through this point, which has the same general shape as + // that of a normal forward-biased diode. NBV is an exponent scale + // factor; its value here of 1 gives the curve a steep rise and a + // relatively sharp knee. Actual breakdown I-V curves have an even + // steeper rise and sharper knee, too steep and sharp to be + // represented by an exponential, but this model is good enough for + // this emulation, since the diode operates very close to a single + // point on the curve. + ZDIODE(D304, "D(BV=9.1 IBV=0.020 NBV=1)") + + // 24 kHz noise clock for the noise source, chosen to retain noise + // frequencies as high as possible for 48 kHz sample rate. + CLOCK(NCLK, 24000) + NET_C(I_V5.Q, NCLK.VCC) + NET_C(GND, NCLK.GND) + + // Normally-distributed noise of 2 millivolts RMS voltage. + // This level was chosen to have a strong amplified noise signal that + // won't be clipped by any subsequent stages of amplification before + // the power amps, if the volume potentiometers are not raised beyond + // their approximate midpoints. + SYS_NOISE_MT_N(NOISE, 0.002) + + NET_C(NCLK.Q, NOISE.I) + + RES(R302, RES_K(6.8)) + RES(R303, RES_K(6.8)) + CAP(C307, CAP_U(10)) + NET_C(C307.2, GND) + QBJT_EB(Q302, "BC548C") + NET_C(Q302.E, GND) + + NET_C(I_V16.Q, R302.1) + NET_C(Q302.B, NOISE.1) + NET_C(D304.A, NOISE.2) + NET_C(R303.2, C307.1, D304.K) + + // Coupling capacitors from noise generator to sound effect frequency + // filters. (These coupling capacitors, together with the resistances + // beyond them, act as high-pass filters with very low cutoff + // frequencies.) CAP(C303, CAP_U(0.1)) CAP(C306, CAP_U(0.1)) CAP(C304, CAP_U(0.1)) CAP(C305, CAP_U(0.1)) - NET_C(C303.1, C306.1, C304.1, C305.1, N1.P) + NET_C(R302.2, Q302.C, R303.1, C303.1, C306.1, C304.1, C305.1) - // Sound effect frequency filters. Each of these is a second-order - // low-pass filter with cutoff frequency determined by its component - // values. The different capacitor values produce each sound effect's - // distinct pitch. + + // **** Sound effect frequency filters. + + // Each sound effect has a pair of passive low-pass RC filters with + // cutoff frequencies determined by their component values. The + // different capacitor values produce each sound effect's distinct + // pitch. RES(R129, RES_K(20)) RES(R229, RES_K(20)) @@ -243,12 +503,65 @@ static NETLIST_START(gunfight_schematics) CAP(C214, CAP_U(0.047)) NET_C(C120.2, C220.2, C114.2, C214.2, GND) - // Sound effect amplifier circuits. Each of these is a single NPN - // transistor wired as a common-emitter amplifier. The "hit" - // sound effect amplifiers also have a bypass capacitor at the - // emitter. The attack and decay of the sound effects is handled - // by controlling the current supply to each amplifier, which is - // done by the switching circuits described above. + + // **** Sound effect amplifier circuits. + + // Each sound-effect amplifier is a single NPN transistor wired as a + // common-emitter amplifier. The amplifiers for "hit" sounds also have + // a bypass capacitor at the emitter, while those for "shot" sounds + // have no bypass capacitor and a much lower emitter resistance. The + // attack and decay of the sound effects is handled by controlling the + // current supply to each amplifier, which is done by the switching + // circuits and supply capacitors described above. + + // More explanation is needed for the "shot" sounds. Apart from their + // higher frequency and faster decay, the "ka-pow" effect in their + // initial attack further distinguishes them from the "hit" sounds. + // This effect comes from the high current gain (around 450-500) of + // the amplifier's A-138 transistor together with the low emitter + // resistance. When the current supply for the sound is switched on, + // the collector voltage at first spikes upward as the supply + // capacitor is charged. But the transistor's base voltage and base + // current also rise, which "turns on" the transistor, and as its + // collector current increases through its biasing resistor, the + // collector voltage plummets. For the "shot" sound transistors, + // because of their high current gain and low emitter resistance, the + // collector current grows so much that the collector voltage is + // pulled below the base voltage, pushing the transistor into + // saturation. This persists for as long as the current supply switch + // remains on; the collector voltage stays low with little variation. + // In this state the amplifier's input noise signal is being clipped + // rather than amplified. + + // The result is that the sound effect's initial voltage spike is + // followed by a relatively prolonged low with almost no noise. As + // this signal passes through the output coupling capacitor, the + // intervening filter and potentiometer, and then the second + // amplification stage, it becomes a series of strong oscillations, + // followed by a momentary silence which lasts as long as the sound's + // switch is held on: around 50 milliseconds. + + // Finally the sound switch is turned off, and the amplifier's supply + // voltage and current begin to drop as the supply capacitor + // discharges. The base current and collector current drop also, and + // the collector voltage begins to rise, eventually rising above the + // base voltage again. The transistor leaves saturation and returns to + // forward active mode. Now the noise signal is not being clipped but + // gets properly amplified on the collector output. So the momentary + // silence is followed by a sudden burst of noise, which then dies + // away as the supply capacitor is drained. + + // The result is the shot's distinct "ka-pow" sound: an initial + // punctuating crack, a very brief silence, and a sudden noise burst + // that quickly fades. + + // The "hit" sounds don't have this effect, despite using the same + // high-gain transistors, because their transistor amplifiers have a + // bypass capacitor and a much larger emitter resistance, 1 Kohm + // versus 100 ohms. That higher resistance keeps the collector current + // low enough that the collector voltage never drops below the base + // voltage, so the transistor never saturates, while the bypass + // capacitor allows the amplifier's AC gain to remain very high. RES(R126, RES_K(330)) RES(R226, RES_K(330)) @@ -276,10 +589,10 @@ static NETLIST_START(gunfight_schematics) CAP(C213, CAP_U(50)) NET_C(C113.2, C213.2, GND) - QBJT_EB(Q106, "NPN") - QBJT_EB(Q206, "NPN") - QBJT_EB(Q103, "NPN") - QBJT_EB(Q203, "NPN") + QBJT_EB(Q106, "BC548C") + QBJT_EB(Q206, "BC548C") + QBJT_EB(Q103, "BC548C") + QBJT_EB(Q203, "BC548C") NET_C(R128.2, C120.1, R126.2, R127.1, Q106.B) NET_C(R228.2, C220.1, R226.2, R227.1, Q206.B) @@ -291,10 +604,18 @@ static NETLIST_START(gunfight_schematics) NET_C(R112.1, C113.1, Q103.E) NET_C(R212.1, C213.1, Q203.E) - // Coupling capacitors and volume potentiometers for sound effect - // amplifier outputs. There are four volume pots, for shot and hit - // sounds on left and right. Presently these pots are fixed at the - // midpoint of their range. + + // **** Coupling capacitors, high-pass (pulse-differentiator) filters, + // **** and volume potentiometers for sound effect amplifier outputs. + + // These circuits act as high-pass filters on the sound effect + // generator outputs, with very low cutoff frequencies. Because the + // cutoff frequency is so low, one of the main effects of the filter + // is to remove any flat areas from the initial turn-on pulse of the + // sound effect generator amplifier. The filter effectively + // differentiates the pulse, producing output voltage proportional to + // the steepness of its slope. This replaces the single wide pulse of + // the initial attack with a sequence of sharp spike pulses. CAP(C119, CAP_U(0.047)) CAP(C219, CAP_U(0.047)) @@ -312,7 +633,9 @@ static NETLIST_START(gunfight_schematics) CAP(C211, CAP_U(0.033)) NET_C(C118.2, C218.2, C111.2, C211.2, GND) - // FIXME - sound effect volume potentiometers should be adjustable. + // There are four sound-effect volume pots, for shot and hit sounds on + // left and right. + POT(R123, RES_K(50)) POT(R223, RES_K(50)) POT(R110, RES_K(50)) @@ -320,23 +643,19 @@ static NETLIST_START(gunfight_schematics) NET_C(R123.3, R223.3, R110.3, R210.3, GND) // Reverse the sense of pot adjustments so that larger values result - // in greater volume, which we will want if, as I hope, these are - // made user-adjustable. + // in greater volume. PARAM(R123.REVERSE, 1) PARAM(R223.REVERSE, 1) PARAM(R110.REVERSE, 1) PARAM(R210.REVERSE, 1) - PARAM(R123.DIAL, 0.5) - PARAM(R223.DIAL, 0.5) - PARAM(R110.DIAL, 0.5) - PARAM(R210.DIAL, 0.5) NET_C(C119.2, C118.1, R123.1) NET_C(C219.2, C218.1, R223.1) NET_C(C112.2, C111.1, R110.1) NET_C(C212.2, C211.1, R210.1) - // Mixing of shot and hit sounds for each side. + + // **** Mixing of shot and hit sounds for each side. RES(R122, RES_K(30)) RES(R222, RES_K(30)) @@ -358,13 +677,16 @@ static NETLIST_START(gunfight_schematics) NET_C(R109.1, C110.2) NET_C(R209.1, C210.2) - // Second-stage amplifier circuits, which amplify each side's - // mixed shot and hit sounds. These are similar to the sound-effect - // amplifiers (particularly the "hit" ones), each being a single - // NPN transistor wired in common-emitter configuration, with a - // bypass capacitor at the emitter. They have no need for an - // attack-decay envelope, however, and so get their current - // directly from the 16.5-volt power supply. + + // **** Second-stage amplifier circuits, which amplify each side's + // **** mixed shot and hit sounds. + + // These amplifiers are similar to those for the "hit" sound effects, + // each being a single A-138 NPN transistor wired in common-emitter + // configuration, with a 1-Kohm resistance and a bypass capacitor at + // the emitter. They have no need for an attack-decay envelope, + // however, and so get their current directly from the 16-volt power + // supply. RES(R107, RES_K(150)) RES(R207, RES_K(150)) @@ -384,10 +706,10 @@ static NETLIST_START(gunfight_schematics) CAP(C209, CAP_U(50)) NET_C(C109.2, C209.2, GND) - NET_C(R107.1, R207.1, R108.1, R208.1, I_V16_5.Q) + NET_C(R107.1, R207.1, R108.1, R208.1, I_V16.Q) - QBJT_EB(Q102, "NPN") - QBJT_EB(Q202, "NPN") + QBJT_EB(Q102, "BC548C") + QBJT_EB(Q202, "BC548C") NET_C(C110.1, C117.1, R107.2, R105.1, Q102.B) NET_C(C210.1, C217.1, R207.2, R205.1, Q202.B) @@ -395,10 +717,9 @@ static NETLIST_START(gunfight_schematics) NET_C(R106.1, C109.1, Q102.E) NET_C(R206.1, C209.1, Q202.E) - // Coupling capacitors and volume potentiometers for second-stage - // amplifier outputs. There are two volume pots, for left and right - // master volume. Presently these pots are fixed at the midpoint of - // their range. + + // **** Coupling capacitors, bandpass filters, and volume + // **** potentiometers for second-stage amplifier outputs. CAP(C108, CAP_U(0.047)) CAP(C208, CAP_U(0.047)) @@ -416,31 +737,35 @@ static NETLIST_START(gunfight_schematics) CAP(C207, CAP_U(0.001)) NET_C(C107.2, C207.2, GND) - // FIXME - master volume potentiometers should be adjustable. + // There are two master volume pots, for left and right. + POT(R103, RES_K(47)) POT(R203, RES_K(47)) NET_C(R103.3, R203.3, GND) // Reverse the sense of pot adjustments so that larger values result - // in greater volume, which we will want if, as I hope, these are - // made user-adjustable. + // in greater volume. PARAM(R103.REVERSE, 1) PARAM(R203.REVERSE, 1) - PARAM(R103.DIAL, 0.5) - PARAM(R203.DIAL, 0.5) NET_C(R104.2, C107.1, R103.1) NET_C(R204.2, C207.1, R203.1) - // The following are the left and right speaker outputs. In the real - // circuit they don't drive the speakers directly, being far too weak, - // but rather go to pin 7, the signal input, of the respective - // TAA621A11 (or LM354) audio power amplifier ICs for the left and - // right speakers. + // The potentiometer outputs are used here as the left and right audio + // outputs. In the real circuit they drive the signal inputs of the + // audio power amplifier ICs for the left and right speakers. ALIAS(OUT_L, R103.2) ALIAS(OUT_R, R203.2) + // The real outputs are somewhat constrained in that they drive the + // bases of the input transistors within the power amplifiers. If they + // go too low in voltage, there seems to be a peculiar effect on the + // speaker output waveforms, although I'm not sure whether this is a + // real effect or an artifact of the LTspice simulation I constructed. + // Nor am I sure whether it matters in practice. In any case, it's not + // modeled here. + NETLIST_END() @@ -448,17 +773,20 @@ NETLIST_START(gunfight) SOLVER(Solver, 48000) PARAM(Solver.SORT_TYPE, "ASCENDING") - // For this netlist, ASCENDING turns out to be the fastest of the - // available sort types, roughly 40% faster than the default - // PREFER_IDENTITY_TOP_LEFT. - - LOCAL_LIB_ENTRY(NOISE) + // For this netlist, ASCENDING turns out to be slightly faster than + // the default sort type of PREFER_IDENTITY_TOP_LEFT, but the + // difference when using static solvers is very small. LOCAL_SOURCE(gunfight_schematics) INCLUDE(gunfight_schematics) - ANALOG_INPUT(I_V16_5, 16.5) // 16.5-volt power for sound amplifiers + // The amplifying transistors all get 16-volt power. The raw AC power + // input from the main power supply to the game logic board is 16.5 + // volts, but this is rectified and regulated to about 16 volts via + // TIP-31 power transistor Q301 and BZX61-C16 16-volt Zener diode + // D304. + ANALOG_INPUT(I_V16, 16) // 16-volt power for sound amplifiers ANALOG_INPUT(I_V5, 5) // 5-volt power for logic input devices LOGIC_INPUT(I_LEFT_SHOT, 0, "74XX") @@ -467,10 +795,12 @@ NETLIST_START(gunfight) LOGIC_INPUT(I_RIGHT_HIT, 0, "74XX") // Power and ground connections for logic input devices: - NET_C(I_V5.Q, I_LEFT_SHOT.VCC, I_RIGHT_SHOT.VCC, - I_LEFT_HIT.VCC, I_RIGHT_HIT.VCC) - NET_C(GND, I_LEFT_SHOT.GND, I_RIGHT_SHOT.GND, - I_LEFT_HIT.GND, I_RIGHT_HIT.GND) + NET_C(I_V5.Q, + I_LEFT_SHOT.VCC, I_RIGHT_SHOT.VCC, + I_LEFT_HIT.VCC, I_RIGHT_HIT.VCC) + NET_C(GND, + I_LEFT_SHOT.GND, I_RIGHT_SHOT.GND, + I_LEFT_HIT.GND, I_RIGHT_HIT.GND) ALIAS(IN_LS, I_LEFT_SHOT.Q) ALIAS(IN_RS, I_RIGHT_SHOT.Q) @@ -480,9 +810,11 @@ NETLIST_START(gunfight) #if USE_FRONTIERS // These frontiers keep the mostly independant halves of the circuit // (left channel and right channel) from affecting each other and the - // noise generator, which speeds up processing by about 10% while - // making no audible change in the output. Perhaps better ones could - // be found, but I don't know how to do so or if it's even possible. + // noise generator, which speeds up processing substantially while + // making no audible change in the output. These seem to be the only + // frontiers which improve performance; I haven't been able to find + // any additional beneficial ones from examining the circuit and + // experimenting. OPTIMIZE_FRONTIER(C303.1, RES_M(1), 50) OPTIMIZE_FRONTIER(C306.1, RES_M(1), 50) OPTIMIZE_FRONTIER(C304.1, RES_M(1), 50)