Previous 199869 Revisions Next

r28729 Wednesday 19th March, 2014 at 17:23:04 UTC by Oliver Stöneberg
renamed tms5110r.c to tms5110r.inc
[src/emu/sound]sound.mak tms5110.c tms5110r.c tms5110r.inc* tms5220.c vlm5030.c

trunk/src/emu/sound/tms5110r.c
r28728r28729
1/* TMS51xx and TMS52xx ROM Tables */
2
3/* The following table is assumed to be for TMS5100
4 *
5 * US Patent 4209836
6 *           4331836
7 *           4304964
8 *           4234761
9 *           4189779
10 *           4449233
11 *
12 * All patents give interpolation coefficients
13 *  { 1, 8, 8, 8, 4, 4, 2, 2 }
14 *  This sequence will not calculate the published
15 *  fractions:
16 * 1 8 0.125
17 * 2 8 0.234
18 * 3 8 0.330
19 * 4 4 0.498
20 * 5 4 0.623
21 * 6 2 0.717
22 * 7 2 0.859
23 * 0 1 1.000
24 * (remember, 1 is the FIRST entry!)
25 *
26 * Instead,  { 1, 8, 8, 8, 4, 4, 4, 2 }
27 * will calculate those coefficients.
28 * Howeever, after simulating the actual circuit from the patent in pspice,
29 * the { 1, 8, 8, 8, 4, 4, 2, 2 } pattern is revealed as the correct one.
30 * Since the real chip uses shifters and not true division to achieve those
31 * factors, they have been replaced by the shifting coefficients:
32 * { 0, 3, 3, 3, 2, 2, 1, 1 }
33 */
34
35   /* quick note on derivative analysis:
36   Judging by all the TI chips I (Lord Nightmare) have done this test on, the first derivative between successive values of the LPC tables should follow a roughly triangular or sine shaped curve, the second derivative should start at a value, increase slightly, then decrease smoothly and become negative right around where the LPC curve passes 0, finally increase slightly right near the end. If it doesn't do this, there is probably a wrong value in there somewhere. The pitch and energy tables follow similar patterns but aren't the same since they never cross 0. The chirp table doesn't follow this pattern at all.
37   */
38/* chip type defines */
39#define SUBTYPE_TMS5100         1
40#define SUBTYPE_M58817          2
41#define SUBTYPE_TMS5110         4
42#define SUBTYPE_TMS5200         8
43#define SUBTYPE_TMS5220         16
44#define SUBTYPE_PAT4335277      32
45#define SUBTYPE_VLM5030         64
46
47/* coefficient defines */
48#define MAX_K                   10
49#define MAX_SCALE_BITS          6
50#define MAX_SCALE               (1<<MAX_SCALE_BITS)
51#define COEFF_ENERGY_SENTINEL   (511)
52#define MAX_CHIRP_SIZE          52
53
54struct tms5100_coeffs
55{
56   int             subtype;
57   int             num_k;
58   int             energy_bits;
59   int             pitch_bits;
60   int             kbits[MAX_K];
61   unsigned short  energytable[MAX_SCALE];
62   unsigned short  pitchtable[MAX_SCALE];
63   int             ktable[MAX_K][MAX_SCALE];
64   INT16           chirptable[MAX_CHIRP_SIZE];
65   INT8            interp_coeff[8];
66};
67
68/*
69The TMS5100NL was decapped and imaged by digshadow in April, 2013.
70The LPC table is verified to match the decap.
71 It also matches the intended contents of US Patent 4,209,836 and several others.
72The chirp table is verified to match the decap, and also matches the patents.
73The TMS5100 (development name: TMC0280) and the Speak and spell's "CD2801" chip
74are believed to be the same silicon. The 5100 may be the 'A' die revision of
75the CD2801 based on die markings.
76*/
77static const struct tms5100_coeffs pat4209836_coeff =
78{
79   /* subtype */
80   SUBTYPE_TMS5100,
81   10,
82   4,
83   5,
84   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
85   /* E  */
86   { 0,  0,  1,  1,  2,  3,  5,  7,
87      10,  15,  21,  30,  43,  61,  86, COEFF_ENERGY_SENTINEL }, // last rom value is actually really 0, but the tms5110.c code still requires the sentinel value to function correctly, until it is properly updated or merged with tms5220.c
88   /* P  */
89   {   0,  41,  43,  45,  47,  49,  51,  53,
90      55,  58,  60,  63,  66,  70,  73,  76,
91      79,  83,  87,  90,  94,  99, 103, 107,
92      112, 118, 123, 129, 134, 140, 147, 153 },
93   {
94      /* K1  */
95      { -501, -497, -493, -488, -480, -471, -460, -446,
96         -427, -405, -378, -344, -305, -259, -206, -148,
97         -86,  -21,   45,  110,  171,  227,  277,  320,
98         357,  388,  413,  434,  451,  464,  474,  498 },
99      /* K2  */
100      { -349, -328, -305, -280, -252, -223, -192, -158,
101         -124,  -88,  -51,  -14,  23,    60,   97,  133,
102         167,  199,  230,  259,  286,  310,  333,  354,
103         372,  389,  404,  417,  429,  439,  449,  506 },
104      /* K3  */
105      { -397, -365, -327, -282, -229, -170, -104, -36,
106         35,  104,  169,  228,  281,  326,  364, 396 },
107      /* K4  */
108      { -369, -334, -293, -245, -191, -131, -67,  -1,
109         64,  128,  188,  243,  291,  332, 367, 397 },
110      /* K5  */
111      { -319, -286, -250, -211, -168, -122, -74, -25,
112         24,   73,  121,  167,  210,  249, 285, 318 },
113      /* K6  */
114      { -290, -252, -209, -163, -114,  -62,  -9,  44,
115         97,  147,  194,  238,  278,  313, 344, 371 },
116      /* K7  */
117      { -291, -256, -216, -174, -128, -80, -31,  19,
118         69,  117,  163,  206,  246, 283, 316, 345 },
119      /* K8  */
120      { -218, -133,  -38,  59,  152,  235, 305, 361 },
121      /* K9  */
122      { -226, -157,  -82,  -3,   76,  151, 220, 280 },
123      /* K10 */
124      { -179, -122,  -61,    1,   62,  123, 179, 231 },
125   },
126   /* Chirp table */
127   {   0,  42, -44, 50, -78, 18, 37, 20,
128      2, -31, -59,  2,  95, 90,  5, 15,
129      38, -4,  -91,-91, -42,-35,-36, -4,
130      37, 43,   34, 33,  15, -1, -8,-18,
131      -19,-17,   -9,-10,  -6,  0,  3,  2,
132      1,  0,    0,  0,   0,  0,  0,  0,
133      0,  0,    0,  0 },
134   /* interpolation coefficients */
135   { 3, 3, 3, 2, 2, 1, 1, 0 }
136};
137
138/* The following CD2802 coefficients come from US Patents 4,403,965 and 4,946,391; They have not yet been verified using derivatives. The M58817 seems to work best with these coefficients, so its possible the engineers of that chip copied them from the TI patents.
139***These values have not yet been verified against a real CD2802 (used in touch & tell)***
140*/
141static const struct tms5100_coeffs pat4403965_coeff =
142{
143   /* subtype */
144   SUBTYPE_M58817,
145   10,
146   4,
147   5,
148   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
149   /* E   */
150   { 0,   1,   2,   3,   4,   6,   8,  11,
151      16,  23,  33,  47,  63,  85, 114, 511 },
152   /* P   */
153   { 0,  41,  43,  45,  47,  49,  51,  53,
154      55,  58,  60,  63,  66,  70,  73,  76,
155      79,  83,  87,  90,  94,  99, 103, 107,
156   112, 118, 123, 129, 134, 140, 147, 153 },
157   {
158      /* K1  */
159      { -501, -498, -495, -490, -485, -478, -469, -459,
160         -446, -431, -412, -389, -362, -331, -295, -253,
161         -207, -156, -102,  -45,   13,   70,  126,  179,
162         228,  272,  311,  345,  374,  399,  420,  437 },
163      /* K2  */
164      { -376, -357, -335, -312, -286, -258, -227, -195,
165         -161, -124,  -87,  -49,  -10,   29,   68,  106,
166         143,  178,  212,  243,  272,  299,  324,  346,
167         366,  384,  400,  414,  427,  438,  448,  506 },
168      /* K3  */
169      { -407, -381, -349, -311, -268, -218, -162, -102,
170         -39,   25,   89,  149,  206,  257,  302,  341 },
171      /* K4  */
172      { -290, -252, -209, -163, -114,  -62,   -9,   44,
173         97,  147,  194,  238,  278,  313,  344,  371 },
174      /* K5  */
175      { -318, -283, -245, -202, -156, -107,  -56,   -3,
176         49,  101,  150,  196,  239,  278,  313,  344 },
177      /* K6  */
178      { -193, -152, -109,  -65,  -20,   26,   71,  115,
179         158,  198,  235,  270,  301,  330,  355,  377 },
180      /* K7  */
181      { -254, -218, -180, -140,  -97,  -53,   -8,   36,
182         81,  124,  165,  204,  240,  274,  304,  332 },
183      /* K8  */
184      { -205, -112,  -10,   92,  187,  269,  336,  387 },
185      /* K9  */
186      { -249, -183, -110,  -19,   48,  126,  198,  261 }, // on tms5200 the 4th entry is -32
187      /* K10 */
188      { -190, -133,  -73,  -10,   53,  115,  173,  227 },
189   },
190   /* Chirp table */
191   {   0, 43,  -44, 51,-77, 18, 37, 20,
192      2,-30,  -58,  3, 96, 91,  5, 15,
193      38, -4,  -90,-91,-42,-35,-35, -3,
194      37, 43,   35, 34, 15, -1, -8,-17,
195      -19,-17,   -9, -9, -6,  1,  4,  3,
196      1,  0,    0,  0,  0,  0,  0,  0,
197      0,  0,    0,  0 },
198   /* interpolation coefficients */
199   { 3, 3, 3, 2, 2, 1, 1, 0 }
200};
201
202/* The following TMS5110A LPC coefficients were directly read from an actual
203TMS5110A chip by Jarek Burczynski using the PROMOUT pin, and can be regarded
204as established fact. However, the chirp table and the interpolation
205coefficients still come from the patents as there doesn't seem to be an easy
206way to read those out from the chip without decapping it.
207*/
208static const struct tms5100_coeffs tms5110a_coeff =
209{
210   /* subtype */
211   SUBTYPE_TMS5110,
212   10,
213   4,
214   5,
215   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
216   /* E   */
217   { 0,   1,   2,   3,   4,   6,   8,  11,
218      16,  23,  33,  47,  63,  85, 114, 511 },
219   /* P   */
220   { 0,  15,  16,  17,  19,  21,  22,  25,
221      26,  29,  32,  36,  40,  42,  46,  50,
222      55,  60,  64,  68,  72,  76,  80,  84,
223      86,  93, 101, 110, 120, 132, 144, 159 },
224   {
225      /* K1  */
226      { -501, -498, -497, -495, -493, -491, -488, -482,
227         -478, -474, -469, -464, -459, -452, -445, -437,
228         -412, -380, -339, -288, -227, -158,  -81,   -1,
229         80,  157,  226,  287,  337,  379,  411,  436 },
230      /* K2  */
231      { -328, -303, -274, -244, -211, -175, -138,  -99,
232         -59,  -18,   24,   64,  105,  143,  180,  215,
233         248,  278,  306,  331,  354,  374,  392,  408,
234         422,  435,  445,  455,  463,  470,  476,  506 },
235      /* K3  */
236      { -441, -387, -333, -279, -225, -171, -117,  -63,
237         -9,   45,   98,  152,  206,  260,  314,  368 },
238      /* K4  */
239      { -328, -273, -217, -161, -106,  -50,    5,   61,
240         116,  172,  228,  283,  339,  394,  450,  506 },
241      /* K5  */
242      { -328, -282, -235, -189, -142,  -96,  -50,   -3,
243         43,   90,  136,  182,  229,  275,  322,  368 },
244      /* K6  */
245      { -256, -212, -168, -123,  -79,  -35,   10,   54,
246         98,  143,  187,  232,  276,  320,  365,  409 },
247      /* K7  */
248      { -308, -260, -212, -164, -117,  -69,  -21,   27,
249         75,  122,  170,  218,  266,  314,  361,  409 },
250      /* K8  */
251      { -256, -161,  -66,   29,  124,  219,  314,  409 },
252      /* K9  */
253      { -256, -176,  -96,  -15,   65,  146,  226,  307 },
254      /* K10 */
255      { -205, -132,  -59,   14,   87,  160,  234,  307 },
256   },
257   /* Chirp table */
258   {   0,  42, -44, 50, -78, 18, 37, 20,
259      2, -31, -59,  2,  95, 90,  5, 15,
260      38, -4,  -91,-91, -42,-35,-36, -4,
261      37, 43,   34, 33,  15, -1, -8,-18,
262      -19,-17,   -9,-10,  -6,  0,  3,  2,
263      1,  0,    0,  0,   0,  0,  0,  0,
264      0,  0,    0,  0 },
265   /* interpolation coefficients */
266   { 3, 3, 3, 2, 2, 1, 1, 0 }
267};
268
269/* The following coefficients come from US Patent 4,335,277 and 4,581,757.
270However, the K10 row of coefficients are entirely missing from both of those
271patents.
272The K values don't match the values read from an actual TMS5200 chip, but
273might match the TMS5111 or some other undiscovered chip?
274*/
275   // k* is followed by d if done transcription, c if checked for derivative aberrations
276static const struct tms5100_coeffs pat4335277_coeff =
277{
278   /* subtype */
279   SUBTYPE_PAT4335277,
280   10,
281   4,
282   6,
283   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
284   /* Ed   */
285   { 0,   1,   2,   3,   4,   6,   8,  11,
286      16,  23,  33,  47,  63,  85, 114, 511 }, /* last value is actually 0 in ROM, but 511 is stop sentinel */
287   /* Pd   */
288   { 0,  14,  15,  16,  17,  18,  19,  20,
289      21,  22,  23,  24,  25,  26,  27,  28,
290      29,  30,  31,  32,  34,  36,  38,  40,
291      41,  43,  45,  48,  49,  51,  54,  55,
292      57,  60,  62,  64,  68,  72,  74,  76,
293      81,  85,  87,  90,  96,  99, 103, 107,
294   112, 117, 122, 127, 133, 139, 145, 151,
295   157, 164, 171, 178, 186, 194, 202, 211 },
296   {
297      /* K1dc  */
298      { -507, -505, -503, -501, -497, -493, -488, -481,
299         -473, -463, -450, -434, -414, -390, -362, -328,
300         -288, -242, -191, -135,  -75,  -13,   49,  110,
301         168,  221,  269,  311,  348,  379,  404,  426 },
302      /* K2dc  */
303      { -294, -266, -235, -202, -167, -130,  -92,  -52,
304         -12,   28,   68,  108,  145,  182,  216,  248,
305         278,  305,  330,  352,  372,  390,  406,  420,
306         432,  443,  453,  461,  468,  474,  479,  486 },
307      /* K3dc  */
308      { -449, -432, -411, -385, -354, -317, -273, -223,
309         -167, -107,  -43,   22,   87,  148,  206,  258 },
310      /* K4dc (first 4-5 values are probably wrong but close) */
311      { -321, -270, -220, -157,  -97,  -40,   25,   89,
312         150,  207,  259,  304,  343,  376,  403,  425 },
313      /* K5dc  */
314      { -373, -347, -318, -284, -247, -206, -162, -115,
315         -65,  -15,   36,   86,  135,  181,  224,  263 },
316      /* K6dc  */
317      { -213, -176, -137,  -96,  -54,  -11,   33,   75,
318         117,  157,  195,  231,  264,  294,  322,  347 },
319      /* K7dc  */
320      { -294, -264, -232, -198, -161, -122,  -82,  -41,
321            1,   43,   84,  125,  163,  200,  234,  266 },
322      /* K8dc  */
323      { -195, -117,  -32,   54,  137,  213,  279,  335 },
324      /* K9dc  */
325      { -122,  -55,   15,   83, 149,  210,  264,  311  },
326      /* K10  - this was entirely missing from the patent, and I've simply copied the real TMS5220 one, which is wrong */
327      { -205, -132,  -59,   14,  87,  160,  234,  307  },
328   },
329   /* Chirp table */
330   {   0,  42, -44, 50, -78, 18, 37, 20,
331      2, -31, -59,  2,  95, 90,  5, 15,
332      38, -4,  -91,-91, -42,-35,-36, -4,
333      37, 43,   34, 33,  15, -1, -8,-18,
334      -19,-17,   -9,-10,  -6,  0,  3,  2,
335      1,  0,    0,  0,   0,  0,  0,  0,
336      0,  0,    0,  0 },
337   /* interpolation coefficients */
338   { 3, 3, 3, 2, 2, 1, 1, 0 }
339};
340
341/*
342The TMS5200CNL was decapped and imaged by digshadow in March, 2013.
343It is equivalent to the CD2501E (internally: "TMC0285") chip used
344 on the TI 99/4(A) speech module.
345The LPC table is verified to match the decap.
346 (It was previously dumped with PROMOUT which matches as well)
347The chirp table is verified to match the decap. (sum = 0x3da)
348Note that the K coefficients are VERY different from the coefficients given
349 in the US 4,335,277 patent, which may have been for some sort of prototype or
350 otherwise intentionally scrambled. The energy and pitch tables, however, are
351 identical to that patent.
352Also note, that the K coefficients are ALMOST identical to the coefficients from the CD2802.
353The interpolation coefficients still come from the patents pending verification
354 of the interpolation counter circuit from the chip decap image.
355NOTE FROM DECAP: immediately to the left of each of the K1,2,3,4,5,and 6
356 coefficients in the LPC rom are extra columns containing the constants
357 -510, -502, 313, 318, or in hex 0x202, 0x20A, 0x139, 0x13E.
358 Those EXACT constants DO appear (rather nonsensically) on the lpc table in US
359 patent 4,335,277. They don't seem to do anything except take up space and may
360 be a leftover from an older design predating even the patent.
361*/
362
363static const struct tms5100_coeffs tms5200_coeff =
364{
365   /* subtype */
366   SUBTYPE_TMS5200,
367   10,
368   4,
369   6,
370   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
371   /* E */
372   { 0,   1,   2,   3,   4,   6,   8,  11,
373      16,  23,  33,  47,  63,  85, 114,  0 },
374   /* P */
375   { 0,  14,  15,  16,  17,  18,  19,  20,
376      21,  22,  23,  24,  25,  26,  27,  28,
377      29,  30,  31,  32,  34,  36,  38,  40,
378      41,  43,  45,  48,  49,  51,  54,  55,
379      57,  60,  62,  64,  68,  72,  74,  76,
380      81,  85,  87,  90,  96,  99, 103, 107,
381   112, 117, 122, 127, 133, 139, 145, 151,
382   157, 164, 171, 178, 186, 194, 202, 211 },
383   {
384      /* K1 */
385      { -501, -498, -495, -490, -485, -478, -469, -459,
386         -446, -431, -412, -389, -362, -331, -295, -253,
387         -207, -156, -102,  -45,   13,   70,  126,  179,
388         228,  272,  311,  345,  374,  399,  420,  437 },
389      /* K2 */
390      { -376, -357, -335, -312, -286, -258, -227, -195,
391         -161, -124,  -87,  -49,  -10,   29,   68,  106,
392         143,  178,  212,  243,  272,  299,  324,  346,
393         366,  384,  400,  414,  427,  438,  448,  506 },
394      /* K3 */
395      { -407, -381, -349, -311, -268, -218, -162, -102,
396         -39,   25,   89,  149,  206,  257,  302,  341 },
397      /* K4 */
398      { -290, -252, -209, -163, -114,  -62,   -9,   44,
399         97,  147,  194,  238,  278,  313,  344,  371 },
400      /* K5 */
401      { -318, -283, -245, -202, -156, -107,  -56,   -3,
402         49,  101,  150,  196,  239,  278,  313,  344 },
403      /* K6 */
404      { -193, -152, -109,  -65,  -20,   26,   71,  115,
405         158,  198,  235,  270,  301,  330,  355,  377 },
406      /* K7 */
407      { -254, -218, -180, -140,  -97,  -53,   -8,   36,
408         81,  124,  165,  204,  240,  274,  304,  332 },
409      /* K8 */
410      { -205, -112,  -10,   92,  187,  269,  336,  387 },
411      /* K9 */
412      { -249, -183, -110,  -32,   48,  126,  198,  261 }, // verified from decap; on the cd2802 patent the 4th entry is -19 (patent typo?)
413      /* K10 */
414      { -190, -133,  -73,  -10,   53,  115,  173,  227 },
415   },
416   /* Chirp table */
417   {   0x00, 0x03, 0x0F, 0x28, 0x4C, 0x6C, 0x71, 0x50,
418      0x25, 0x26, 0x4C, 0x44, 0x1A, 0x32, 0x3B, 0x13,
419      0x37, 0x1A, 0x25, 0x1F, 0x1D, 0x00, 0x00, 0x00,
420      0,  0,  0,  0,  0,  0,  0,  0,
421      0,  0,  0,  0,  0,  0,  0,  0,
422      0,  0,  0,  0,  0,  0,  0,  0,
423      0,  0,  0,  0 },
424   /* interpolation coefficients */
425   { 0, 3, 3, 3, 2, 2, 1, 1 }
426};
427
428/*
429The TMS5220NL was decapped and imaged by digshadow in April, 2013.
430The LPC table table is verified to match the decap.
431The chirp table is verified to match the decap. (sum = 0x3da)
432Note that all the LPC K* values match the TMS5110a table (as read via PROMOUT)
433exactly.
434The TMS5220CNL was decapped and imaged by digshadow in April, 2013.
435The LPC table table is verified to match the decap and exactly matches TMS5220NL.
436The chirp table is verified to match the decap. (sum = 0x3da)
437*/
438static const struct tms5100_coeffs tms5220_coeff =
439{
440   /* subtype */
441   SUBTYPE_TMS5220,
442   10,
443   4,
444   6,
445   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
446   /* E   */
447   { 0,   1,   2,   3,   4,   6,   8,  11,
448      16,  23,  33,  47,  63,  85, 114,  0 },
449   /* P   */
450   { 0,  15,  16,  17,  18,  19,  20,  21,
451      22,  23,  24,  25,  26,  27,  28,  29,
452      30,  31,  32,  33,  34,  35,  36,  37,
453      38,  39,  40,  41,  42,  44,  46,  48,
454      50,  52,  53,  56,  58,  60,  62,  65,
455      68,  70,  72,  76,  78,  80,  84,  86,
456      91,  94,  98, 101, 105, 109, 114, 118,
457   122, 127, 132, 137, 142, 148, 153, 159 },
458   {
459      /* K1  */
460      { -501, -498, -497, -495, -493, -491, -488, -482,
461         -478, -474, -469, -464, -459, -452, -445, -437,
462         -412, -380, -339, -288, -227, -158,  -81,   -1,
463         80,  157,  226,  287,  337,  379,  411,  436 },
464      /* K2  */
465      { -328, -303, -274, -244, -211, -175, -138,  -99,
466         -59,  -18,   24,   64,  105,  143,  180,  215,
467         248,  278,  306,  331,  354,  374,  392,  408,
468         422,  435,  445,  455,  463,  470,  476,  506 },
469      /* K3  */
470      { -441, -387, -333, -279, -225, -171, -117,  -63,
471         -9,   45,   98,  152,  206,  260,  314,  368  },
472      /* K4  */
473      { -328, -273, -217, -161, -106,  -50,    5,   61,
474         116,  172,  228,  283,  339,  394,  450,  506  },
475      /* K5  */
476      { -328, -282, -235, -189, -142,  -96,  -50,   -3,
477         43,   90,  136,  182,  229,  275,  322,  368  },
478      /* K6  */
479      { -256, -212, -168, -123,  -79,  -35,   10,   54,
480         98,  143,  187,  232,  276,  320,  365,  409  },
481      /* K7  */
482      { -308, -260, -212, -164, -117,  -69,  -21,   27,
483         75,  122,  170,  218,  266,  314,  361,  409  },
484      /* K8  */
485      { -256, -161,  -66,   29,  124,  219,  314,  409  },
486      /* K9  */
487      { -256, -176,  -96,  -15,   65,  146,  226,  307  },
488      /* K10 */
489      { -205, -132,  -59,   14,   87,  160,  234,  307  },
490   },
491   /* Chirp table */
492   {   0x00, 0x03, 0x0F, 0x28, 0x4C, 0x6C, 0x71, 0x50,
493      0x25, 0x26, 0x4C, 0x44, 0x1A, 0x32, 0x3B, 0x13,
494      0x37, 0x1A, 0x25, 0x1F, 0x1D, 0x00, 0x00, 0x00,
495      0,  0,  0,  0,  0,  0,  0,  0,
496      0,  0,  0,  0,  0,  0,  0,  0,
497      0,  0,  0,  0,  0,  0,  0,  0,
498      0,  0,  0,  0 },
499   /* interpolation coefficients */
500   { 0, 3, 3, 3, 2, 2, 1, 1 }
501};
502
503/* The following Sanyo VLM5030 coefficients are derived from decaps of the chip
504done by ogoun, plus image stitching done by John McMaster. The organization of
505coefficients beyond k2 is derived from work by Tatsuyuki Satoh.
506The actual coefficient rom on the chip die has 5 groups of bits only:
507Address |   K1A   |   K1B   |   K2   | Energy | Pitch |
508Decoder |   K1A   |   K1B   |   K2   | Energy | Pitch |
509K1A, K1B and K2 are 10 bits wide, 32 bits long each.
510Energy and pitch are both 7 bits wide, 32 bits long each.
511K1A holds odd values of K1, K1B holds even values.
512K2 holds values for K2 only
513K3 and K4 are actually the table index values <<6
514K5 thru K10 are actually the table index values <<7
515The concept of only having non-binary weighted reflection coefficients for the
516first two k stages is mentioned in Markel & Gray "Linear Prediction of Speech"
517and in Thomas Parsons' "Voice and Speech Processing"
518 */
519static const struct tms5100_coeffs vlm5030_coeff =
520{
521   /* subtype */
522   SUBTYPE_VLM5030,
523   10,
524   5,
525   5,
526   { 6, 5, 4, 4, 3, 3, 3, 3, 3, 3 },
527   /* E   */
528   { 0,  1,  2,  3,  5,  6,  7,  9,
529      11, 13, 15, 17, 19, 22, 24, 27,
530      31, 34, 38, 42, 47, 51, 57, 62,
531      68, 75, 82, 89, 98,107,116,127},
532   /* P   */
533   {   0,  21,  22,  23,  24,  25,  26,  27,
534      28,  29,  31,  33,  35,  37,  39,  41,
535      43,  45,  49,  53,  57,  61,  65,  69,
536      73,  77,  85,  93, 101, 109, 117, 125 },
537   {
538      /* K1  */
539      /* (NOTE: the order of each table is correct, despite that the index MSb
540      looks backwards) */
541      {  390, 403, 414, 425, 434, 443, 450, 457,
542         463, 469, 474, 478, 482, 485, 488, 491,
543         494, 496, 498, 499, 501, 502, 503, 504,
544         505, 506, 507, 507, 508, 508, 509, 509,
545         -390,-376,-360,-344,-325,-305,-284,-261,
546         -237,-211,-183,-155,-125, -95, -64, -32,
547            0,  32,  64,  95, 125, 155, 183, 211,
548         237, 261, 284, 305, 325, 344, 360, 376 },
549      /* K2  */
550      {    0,  50, 100, 149, 196, 241, 284, 325,
551         362, 396, 426, 452, 473, 490, 502, 510,
552            0,-510,-502,-490,-473,-452,-426,-396, /* entry 16(0x10) either has some special function, purpose unknown, or is a manufacturing error and should have been -512 */
553         -362,-325,-284,-241,-196,-149,-100, -50 },
554      /* K3  */
555      /*{    0, 100, 196, 284, 362, 426, 473, 502,
556        -510,-490,-452,-396,-325,-241,-149, -50 },*/
557      {    0, 64, 128, 192, 256, 320, 384, 448,
558         -512,-448,-384,-320,-256,-192,-128, -64 },
559      /* K4  */
560      /*{    0, 100, 196, 284, 362, 426, 473, 502,
561        -510,-490,-452,-396,-325,-241,-149, -50 },*/
562      {    0, 64, 128, 192, 256, 320, 384, 448,
563         -512,-448,-384,-320,-256,-192,-128, -64 },
564      /* K5  */
565      {    0, 128, 256, 384,-512,-384,-256,-128 },
566      /* K6  */
567      {    0, 128, 256, 384,-512,-384,-256,-128 },
568      /* K7  */
569      {    0, 128, 256, 384,-512,-384,-256,-128 },
570      /* K8  */
571      {    0, 128, 256, 384,-512,-384,-256,-128 },
572      /* K9  */
573      {    0, 128, 256, 384,-512,-384,-256,-128 },
574      /* K10 */
575      /*{    0, 196, 362, 473,-510,-452,-325,-149 },*/
576      {    0, 128, 256, 384,-512,-384,-256,-128 },
577   },
578   /* Chirp table */
579   {   0,127,127,  0,  0,  0,  0,  0,
580      0,  0,  0,  0,  0,  0,  0,  0,
581      0,  0,  0,  0,  0,  0,  0,  0,
582      0,  0,  0,  0,  0,  0,  0,  0,
583      0,  0,  0,  0,  0,  0,  0,  0,
584      0,  0,  0,  0,  0,  0,  0,  0,
585      0,  0,  0,  0 },
586   /* interpolation coefficients */
587   { 3, 3, 3, 2, 2, 1, 1, 0 }
588};
trunk/src/emu/sound/sound.mak
r28728r28729
689689SOUNDOBJS += $(SOUNDOBJ)/tms5110.o
690690endif
691691
692$(SOUNDOBJ)/tms5110.o:  $(SOUNDSRC)/tms5110r.c
692$(SOUNDOBJ)/tms5110.o:  $(SOUNDSRC)/tms5110r.inc
693693
694694
695695
r28728r28729
701701SOUNDOBJS += $(SOUNDOBJ)/tms5220.o $(EMUMACHINE)/spchrom.o
702702endif
703703
704$(SOUNDOBJ)/tms5220.o:  $(SOUNDSRC)/tms5110r.c
704$(SOUNDOBJ)/tms5220.o:  $(SOUNDSRC)/tms5110r.inc
705705
706706
707707
r28728r28729
745745SOUNDOBJS += $(SOUNDOBJ)/vlm5030.o
746746endif
747747
748$(SOUNDOBJ)/vlm5030.o:  $(SOUNDSRC)/tms5110r.c
748$(SOUNDOBJ)/vlm5030.o:  $(SOUNDSRC)/tms5110r.inc
749749
750750
751751
trunk/src/emu/sound/vlm5030.c
r28728r28729
132132};
133133
134134/* Pull in the ROM tables */
135#include "tms5110r.c"
135#include "tms5110r.inc"
136136
137137/*
138138  speed parameter
trunk/src/emu/sound/tms5220.c
r28728r28729
326326static const UINT8 reload_table[4] = { 0, 2, 4, 6 }; //sample count reload for 5220c and cd2501ecd only; 5200 and 5220 always reload with 0; keep in mind this is loaded on IP=0 PC=12 subcycle=1 so it immediately will increment after one sample, effectively being 1,3,5,7 as in the comments above.
327327
328328// Pull in the ROM tables
329#include "tms5110r.c"
329#include "tms5110r.inc"
330330
331331
332332void tms5220_device::set_variant(int variant)
trunk/src/emu/sound/tms5110r.inc
r0r28729
1/* TMS51xx and TMS52xx ROM Tables */
2
3/* The following table is assumed to be for TMS5100
4 *
5 * US Patent 4209836
6 *           4331836
7 *           4304964
8 *           4234761
9 *           4189779
10 *           4449233
11 *
12 * All patents give interpolation coefficients
13 *  { 1, 8, 8, 8, 4, 4, 2, 2 }
14 *  This sequence will not calculate the published
15 *  fractions:
16 * 1 8 0.125
17 * 2 8 0.234
18 * 3 8 0.330
19 * 4 4 0.498
20 * 5 4 0.623
21 * 6 2 0.717
22 * 7 2 0.859
23 * 0 1 1.000
24 * (remember, 1 is the FIRST entry!)
25 *
26 * Instead,  { 1, 8, 8, 8, 4, 4, 4, 2 }
27 * will calculate those coefficients.
28 * Howeever, after simulating the actual circuit from the patent in pspice,
29 * the { 1, 8, 8, 8, 4, 4, 2, 2 } pattern is revealed as the correct one.
30 * Since the real chip uses shifters and not true division to achieve those
31 * factors, they have been replaced by the shifting coefficients:
32 * { 0, 3, 3, 3, 2, 2, 1, 1 }
33 */
34
35   /* quick note on derivative analysis:
36   Judging by all the TI chips I (Lord Nightmare) have done this test on, the first derivative between successive values of the LPC tables should follow a roughly triangular or sine shaped curve, the second derivative should start at a value, increase slightly, then decrease smoothly and become negative right around where the LPC curve passes 0, finally increase slightly right near the end. If it doesn't do this, there is probably a wrong value in there somewhere. The pitch and energy tables follow similar patterns but aren't the same since they never cross 0. The chirp table doesn't follow this pattern at all.
37   */
38/* chip type defines */
39#define SUBTYPE_TMS5100         1
40#define SUBTYPE_M58817          2
41#define SUBTYPE_TMS5110         4
42#define SUBTYPE_TMS5200         8
43#define SUBTYPE_TMS5220         16
44#define SUBTYPE_PAT4335277      32
45#define SUBTYPE_VLM5030         64
46
47/* coefficient defines */
48#define MAX_K                   10
49#define MAX_SCALE_BITS          6
50#define MAX_SCALE               (1<<MAX_SCALE_BITS)
51#define COEFF_ENERGY_SENTINEL   (511)
52#define MAX_CHIRP_SIZE          52
53
54struct tms5100_coeffs
55{
56   int             subtype;
57   int             num_k;
58   int             energy_bits;
59   int             pitch_bits;
60   int             kbits[MAX_K];
61   unsigned short  energytable[MAX_SCALE];
62   unsigned short  pitchtable[MAX_SCALE];
63   int             ktable[MAX_K][MAX_SCALE];
64   INT16           chirptable[MAX_CHIRP_SIZE];
65   INT8            interp_coeff[8];
66};
67
68/*
69The TMS5100NL was decapped and imaged by digshadow in April, 2013.
70The LPC table is verified to match the decap.
71 It also matches the intended contents of US Patent 4,209,836 and several others.
72The chirp table is verified to match the decap, and also matches the patents.
73The TMS5100 (development name: TMC0280) and the Speak and spell's "CD2801" chip
74are believed to be the same silicon. The 5100 may be the 'A' die revision of
75the CD2801 based on die markings.
76*/
77static const struct tms5100_coeffs pat4209836_coeff =
78{
79   /* subtype */
80   SUBTYPE_TMS5100,
81   10,
82   4,
83   5,
84   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
85   /* E  */
86   { 0,  0,  1,  1,  2,  3,  5,  7,
87      10,  15,  21,  30,  43,  61,  86, COEFF_ENERGY_SENTINEL }, // last rom value is actually really 0, but the tms5110.c code still requires the sentinel value to function correctly, until it is properly updated or merged with tms5220.c
88   /* P  */
89   {   0,  41,  43,  45,  47,  49,  51,  53,
90      55,  58,  60,  63,  66,  70,  73,  76,
91      79,  83,  87,  90,  94,  99, 103, 107,
92      112, 118, 123, 129, 134, 140, 147, 153 },
93   {
94      /* K1  */
95      { -501, -497, -493, -488, -480, -471, -460, -446,
96         -427, -405, -378, -344, -305, -259, -206, -148,
97         -86,  -21,   45,  110,  171,  227,  277,  320,
98         357,  388,  413,  434,  451,  464,  474,  498 },
99      /* K2  */
100      { -349, -328, -305, -280, -252, -223, -192, -158,
101         -124,  -88,  -51,  -14,  23,    60,   97,  133,
102         167,  199,  230,  259,  286,  310,  333,  354,
103         372,  389,  404,  417,  429,  439,  449,  506 },
104      /* K3  */
105      { -397, -365, -327, -282, -229, -170, -104, -36,
106         35,  104,  169,  228,  281,  326,  364, 396 },
107      /* K4  */
108      { -369, -334, -293, -245, -191, -131, -67,  -1,
109         64,  128,  188,  243,  291,  332, 367, 397 },
110      /* K5  */
111      { -319, -286, -250, -211, -168, -122, -74, -25,
112         24,   73,  121,  167,  210,  249, 285, 318 },
113      /* K6  */
114      { -290, -252, -209, -163, -114,  -62,  -9,  44,
115         97,  147,  194,  238,  278,  313, 344, 371 },
116      /* K7  */
117      { -291, -256, -216, -174, -128, -80, -31,  19,
118         69,  117,  163,  206,  246, 283, 316, 345 },
119      /* K8  */
120      { -218, -133,  -38,  59,  152,  235, 305, 361 },
121      /* K9  */
122      { -226, -157,  -82,  -3,   76,  151, 220, 280 },
123      /* K10 */
124      { -179, -122,  -61,    1,   62,  123, 179, 231 },
125   },
126   /* Chirp table */
127   {   0,  42, -44, 50, -78, 18, 37, 20,
128      2, -31, -59,  2,  95, 90,  5, 15,
129      38, -4,  -91,-91, -42,-35,-36, -4,
130      37, 43,   34, 33,  15, -1, -8,-18,
131      -19,-17,   -9,-10,  -6,  0,  3,  2,
132      1,  0,    0,  0,   0,  0,  0,  0,
133      0,  0,    0,  0 },
134   /* interpolation coefficients */
135   { 3, 3, 3, 2, 2, 1, 1, 0 }
136};
137
138/* The following CD2802 coefficients come from US Patents 4,403,965 and 4,946,391; They have not yet been verified using derivatives. The M58817 seems to work best with these coefficients, so its possible the engineers of that chip copied them from the TI patents.
139***These values have not yet been verified against a real CD2802 (used in touch & tell)***
140*/
141static const struct tms5100_coeffs pat4403965_coeff =
142{
143   /* subtype */
144   SUBTYPE_M58817,
145   10,
146   4,
147   5,
148   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
149   /* E   */
150   { 0,   1,   2,   3,   4,   6,   8,  11,
151      16,  23,  33,  47,  63,  85, 114, 511 },
152   /* P   */
153   { 0,  41,  43,  45,  47,  49,  51,  53,
154      55,  58,  60,  63,  66,  70,  73,  76,
155      79,  83,  87,  90,  94,  99, 103, 107,
156   112, 118, 123, 129, 134, 140, 147, 153 },
157   {
158      /* K1  */
159      { -501, -498, -495, -490, -485, -478, -469, -459,
160         -446, -431, -412, -389, -362, -331, -295, -253,
161         -207, -156, -102,  -45,   13,   70,  126,  179,
162         228,  272,  311,  345,  374,  399,  420,  437 },
163      /* K2  */
164      { -376, -357, -335, -312, -286, -258, -227, -195,
165         -161, -124,  -87,  -49,  -10,   29,   68,  106,
166         143,  178,  212,  243,  272,  299,  324,  346,
167         366,  384,  400,  414,  427,  438,  448,  506 },
168      /* K3  */
169      { -407, -381, -349, -311, -268, -218, -162, -102,
170         -39,   25,   89,  149,  206,  257,  302,  341 },
171      /* K4  */
172      { -290, -252, -209, -163, -114,  -62,   -9,   44,
173         97,  147,  194,  238,  278,  313,  344,  371 },
174      /* K5  */
175      { -318, -283, -245, -202, -156, -107,  -56,   -3,
176         49,  101,  150,  196,  239,  278,  313,  344 },
177      /* K6  */
178      { -193, -152, -109,  -65,  -20,   26,   71,  115,
179         158,  198,  235,  270,  301,  330,  355,  377 },
180      /* K7  */
181      { -254, -218, -180, -140,  -97,  -53,   -8,   36,
182         81,  124,  165,  204,  240,  274,  304,  332 },
183      /* K8  */
184      { -205, -112,  -10,   92,  187,  269,  336,  387 },
185      /* K9  */
186      { -249, -183, -110,  -19,   48,  126,  198,  261 }, // on tms5200 the 4th entry is -32
187      /* K10 */
188      { -190, -133,  -73,  -10,   53,  115,  173,  227 },
189   },
190   /* Chirp table */
191   {   0, 43,  -44, 51,-77, 18, 37, 20,
192      2,-30,  -58,  3, 96, 91,  5, 15,
193      38, -4,  -90,-91,-42,-35,-35, -3,
194      37, 43,   35, 34, 15, -1, -8,-17,
195      -19,-17,   -9, -9, -6,  1,  4,  3,
196      1,  0,    0,  0,  0,  0,  0,  0,
197      0,  0,    0,  0 },
198   /* interpolation coefficients */
199   { 3, 3, 3, 2, 2, 1, 1, 0 }
200};
201
202/* The following TMS5110A LPC coefficients were directly read from an actual
203TMS5110A chip by Jarek Burczynski using the PROMOUT pin, and can be regarded
204as established fact. However, the chirp table and the interpolation
205coefficients still come from the patents as there doesn't seem to be an easy
206way to read those out from the chip without decapping it.
207*/
208static const struct tms5100_coeffs tms5110a_coeff =
209{
210   /* subtype */
211   SUBTYPE_TMS5110,
212   10,
213   4,
214   5,
215   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
216   /* E   */
217   { 0,   1,   2,   3,   4,   6,   8,  11,
218      16,  23,  33,  47,  63,  85, 114, 511 },
219   /* P   */
220   { 0,  15,  16,  17,  19,  21,  22,  25,
221      26,  29,  32,  36,  40,  42,  46,  50,
222      55,  60,  64,  68,  72,  76,  80,  84,
223      86,  93, 101, 110, 120, 132, 144, 159 },
224   {
225      /* K1  */
226      { -501, -498, -497, -495, -493, -491, -488, -482,
227         -478, -474, -469, -464, -459, -452, -445, -437,
228         -412, -380, -339, -288, -227, -158,  -81,   -1,
229         80,  157,  226,  287,  337,  379,  411,  436 },
230      /* K2  */
231      { -328, -303, -274, -244, -211, -175, -138,  -99,
232         -59,  -18,   24,   64,  105,  143,  180,  215,
233         248,  278,  306,  331,  354,  374,  392,  408,
234         422,  435,  445,  455,  463,  470,  476,  506 },
235      /* K3  */
236      { -441, -387, -333, -279, -225, -171, -117,  -63,
237         -9,   45,   98,  152,  206,  260,  314,  368 },
238      /* K4  */
239      { -328, -273, -217, -161, -106,  -50,    5,   61,
240         116,  172,  228,  283,  339,  394,  450,  506 },
241      /* K5  */
242      { -328, -282, -235, -189, -142,  -96,  -50,   -3,
243         43,   90,  136,  182,  229,  275,  322,  368 },
244      /* K6  */
245      { -256, -212, -168, -123,  -79,  -35,   10,   54,
246         98,  143,  187,  232,  276,  320,  365,  409 },
247      /* K7  */
248      { -308, -260, -212, -164, -117,  -69,  -21,   27,
249         75,  122,  170,  218,  266,  314,  361,  409 },
250      /* K8  */
251      { -256, -161,  -66,   29,  124,  219,  314,  409 },
252      /* K9  */
253      { -256, -176,  -96,  -15,   65,  146,  226,  307 },
254      /* K10 */
255      { -205, -132,  -59,   14,   87,  160,  234,  307 },
256   },
257   /* Chirp table */
258   {   0,  42, -44, 50, -78, 18, 37, 20,
259      2, -31, -59,  2,  95, 90,  5, 15,
260      38, -4,  -91,-91, -42,-35,-36, -4,
261      37, 43,   34, 33,  15, -1, -8,-18,
262      -19,-17,   -9,-10,  -6,  0,  3,  2,
263      1,  0,    0,  0,   0,  0,  0,  0,
264      0,  0,    0,  0 },
265   /* interpolation coefficients */
266   { 3, 3, 3, 2, 2, 1, 1, 0 }
267};
268
269/* The following coefficients come from US Patent 4,335,277 and 4,581,757.
270However, the K10 row of coefficients are entirely missing from both of those
271patents.
272The K values don't match the values read from an actual TMS5200 chip, but
273might match the TMS5111 or some other undiscovered chip?
274*/
275   // k* is followed by d if done transcription, c if checked for derivative aberrations
276static const struct tms5100_coeffs pat4335277_coeff =
277{
278   /* subtype */
279   SUBTYPE_PAT4335277,
280   10,
281   4,
282   6,
283   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
284   /* Ed   */
285   { 0,   1,   2,   3,   4,   6,   8,  11,
286      16,  23,  33,  47,  63,  85, 114, 511 }, /* last value is actually 0 in ROM, but 511 is stop sentinel */
287   /* Pd   */
288   { 0,  14,  15,  16,  17,  18,  19,  20,
289      21,  22,  23,  24,  25,  26,  27,  28,
290      29,  30,  31,  32,  34,  36,  38,  40,
291      41,  43,  45,  48,  49,  51,  54,  55,
292      57,  60,  62,  64,  68,  72,  74,  76,
293      81,  85,  87,  90,  96,  99, 103, 107,
294   112, 117, 122, 127, 133, 139, 145, 151,
295   157, 164, 171, 178, 186, 194, 202, 211 },
296   {
297      /* K1dc  */
298      { -507, -505, -503, -501, -497, -493, -488, -481,
299         -473, -463, -450, -434, -414, -390, -362, -328,
300         -288, -242, -191, -135,  -75,  -13,   49,  110,
301         168,  221,  269,  311,  348,  379,  404,  426 },
302      /* K2dc  */
303      { -294, -266, -235, -202, -167, -130,  -92,  -52,
304         -12,   28,   68,  108,  145,  182,  216,  248,
305         278,  305,  330,  352,  372,  390,  406,  420,
306         432,  443,  453,  461,  468,  474,  479,  486 },
307      /* K3dc  */
308      { -449, -432, -411, -385, -354, -317, -273, -223,
309         -167, -107,  -43,   22,   87,  148,  206,  258 },
310      /* K4dc (first 4-5 values are probably wrong but close) */
311      { -321, -270, -220, -157,  -97,  -40,   25,   89,
312         150,  207,  259,  304,  343,  376,  403,  425 },
313      /* K5dc  */
314      { -373, -347, -318, -284, -247, -206, -162, -115,
315         -65,  -15,   36,   86,  135,  181,  224,  263 },
316      /* K6dc  */
317      { -213, -176, -137,  -96,  -54,  -11,   33,   75,
318         117,  157,  195,  231,  264,  294,  322,  347 },
319      /* K7dc  */
320      { -294, -264, -232, -198, -161, -122,  -82,  -41,
321            1,   43,   84,  125,  163,  200,  234,  266 },
322      /* K8dc  */
323      { -195, -117,  -32,   54,  137,  213,  279,  335 },
324      /* K9dc  */
325      { -122,  -55,   15,   83, 149,  210,  264,  311  },
326      /* K10  - this was entirely missing from the patent, and I've simply copied the real TMS5220 one, which is wrong */
327      { -205, -132,  -59,   14,  87,  160,  234,  307  },
328   },
329   /* Chirp table */
330   {   0,  42, -44, 50, -78, 18, 37, 20,
331      2, -31, -59,  2,  95, 90,  5, 15,
332      38, -4,  -91,-91, -42,-35,-36, -4,
333      37, 43,   34, 33,  15, -1, -8,-18,
334      -19,-17,   -9,-10,  -6,  0,  3,  2,
335      1,  0,    0,  0,   0,  0,  0,  0,
336      0,  0,    0,  0 },
337   /* interpolation coefficients */
338   { 3, 3, 3, 2, 2, 1, 1, 0 }
339};
340
341/*
342The TMS5200CNL was decapped and imaged by digshadow in March, 2013.
343It is equivalent to the CD2501E (internally: "TMC0285") chip used
344 on the TI 99/4(A) speech module.
345The LPC table is verified to match the decap.
346 (It was previously dumped with PROMOUT which matches as well)
347The chirp table is verified to match the decap. (sum = 0x3da)
348Note that the K coefficients are VERY different from the coefficients given
349 in the US 4,335,277 patent, which may have been for some sort of prototype or
350 otherwise intentionally scrambled. The energy and pitch tables, however, are
351 identical to that patent.
352Also note, that the K coefficients are ALMOST identical to the coefficients from the CD2802.
353The interpolation coefficients still come from the patents pending verification
354 of the interpolation counter circuit from the chip decap image.
355NOTE FROM DECAP: immediately to the left of each of the K1,2,3,4,5,and 6
356 coefficients in the LPC rom are extra columns containing the constants
357 -510, -502, 313, 318, or in hex 0x202, 0x20A, 0x139, 0x13E.
358 Those EXACT constants DO appear (rather nonsensically) on the lpc table in US
359 patent 4,335,277. They don't seem to do anything except take up space and may
360 be a leftover from an older design predating even the patent.
361*/
362
363static const struct tms5100_coeffs tms5200_coeff =
364{
365   /* subtype */
366   SUBTYPE_TMS5200,
367   10,
368   4,
369   6,
370   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
371   /* E */
372   { 0,   1,   2,   3,   4,   6,   8,  11,
373      16,  23,  33,  47,  63,  85, 114,  0 },
374   /* P */
375   { 0,  14,  15,  16,  17,  18,  19,  20,
376      21,  22,  23,  24,  25,  26,  27,  28,
377      29,  30,  31,  32,  34,  36,  38,  40,
378      41,  43,  45,  48,  49,  51,  54,  55,
379      57,  60,  62,  64,  68,  72,  74,  76,
380      81,  85,  87,  90,  96,  99, 103, 107,
381   112, 117, 122, 127, 133, 139, 145, 151,
382   157, 164, 171, 178, 186, 194, 202, 211 },
383   {
384      /* K1 */
385      { -501, -498, -495, -490, -485, -478, -469, -459,
386         -446, -431, -412, -389, -362, -331, -295, -253,
387         -207, -156, -102,  -45,   13,   70,  126,  179,
388         228,  272,  311,  345,  374,  399,  420,  437 },
389      /* K2 */
390      { -376, -357, -335, -312, -286, -258, -227, -195,
391         -161, -124,  -87,  -49,  -10,   29,   68,  106,
392         143,  178,  212,  243,  272,  299,  324,  346,
393         366,  384,  400,  414,  427,  438,  448,  506 },
394      /* K3 */
395      { -407, -381, -349, -311, -268, -218, -162, -102,
396         -39,   25,   89,  149,  206,  257,  302,  341 },
397      /* K4 */
398      { -290, -252, -209, -163, -114,  -62,   -9,   44,
399         97,  147,  194,  238,  278,  313,  344,  371 },
400      /* K5 */
401      { -318, -283, -245, -202, -156, -107,  -56,   -3,
402         49,  101,  150,  196,  239,  278,  313,  344 },
403      /* K6 */
404      { -193, -152, -109,  -65,  -20,   26,   71,  115,
405         158,  198,  235,  270,  301,  330,  355,  377 },
406      /* K7 */
407      { -254, -218, -180, -140,  -97,  -53,   -8,   36,
408         81,  124,  165,  204,  240,  274,  304,  332 },
409      /* K8 */
410      { -205, -112,  -10,   92,  187,  269,  336,  387 },
411      /* K9 */
412      { -249, -183, -110,  -32,   48,  126,  198,  261 }, // verified from decap; on the cd2802 patent the 4th entry is -19 (patent typo?)
413      /* K10 */
414      { -190, -133,  -73,  -10,   53,  115,  173,  227 },
415   },
416   /* Chirp table */
417   {   0x00, 0x03, 0x0F, 0x28, 0x4C, 0x6C, 0x71, 0x50,
418      0x25, 0x26, 0x4C, 0x44, 0x1A, 0x32, 0x3B, 0x13,
419      0x37, 0x1A, 0x25, 0x1F, 0x1D, 0x00, 0x00, 0x00,
420      0,  0,  0,  0,  0,  0,  0,  0,
421      0,  0,  0,  0,  0,  0,  0,  0,
422      0,  0,  0,  0,  0,  0,  0,  0,
423      0,  0,  0,  0 },
424   /* interpolation coefficients */
425   { 0, 3, 3, 3, 2, 2, 1, 1 }
426};
427
428/*
429The TMS5220NL was decapped and imaged by digshadow in April, 2013.
430The LPC table table is verified to match the decap.
431The chirp table is verified to match the decap. (sum = 0x3da)
432Note that all the LPC K* values match the TMS5110a table (as read via PROMOUT)
433exactly.
434The TMS5220CNL was decapped and imaged by digshadow in April, 2013.
435The LPC table table is verified to match the decap and exactly matches TMS5220NL.
436The chirp table is verified to match the decap. (sum = 0x3da)
437*/
438static const struct tms5100_coeffs tms5220_coeff =
439{
440   /* subtype */
441   SUBTYPE_TMS5220,
442   10,
443   4,
444   6,
445   { 5, 5, 4, 4, 4, 4, 4, 3, 3, 3 },
446   /* E   */
447   { 0,   1,   2,   3,   4,   6,   8,  11,
448      16,  23,  33,  47,  63,  85, 114,  0 },
449   /* P   */
450   { 0,  15,  16,  17,  18,  19,  20,  21,
451      22,  23,  24,  25,  26,  27,  28,  29,
452      30,  31,  32,  33,  34,  35,  36,  37,
453      38,  39,  40,  41,  42,  44,  46,  48,
454      50,  52,  53,  56,  58,  60,  62,  65,
455      68,  70,  72,  76,  78,  80,  84,  86,
456      91,  94,  98, 101, 105, 109, 114, 118,
457   122, 127, 132, 137, 142, 148, 153, 159 },
458   {
459      /* K1  */
460      { -501, -498, -497, -495, -493, -491, -488, -482,
461         -478, -474, -469, -464, -459, -452, -445, -437,
462         -412, -380, -339, -288, -227, -158,  -81,   -1,
463         80,  157,  226,  287,  337,  379,  411,  436 },
464      /* K2  */
465      { -328, -303, -274, -244, -211, -175, -138,  -99,
466         -59,  -18,   24,   64,  105,  143,  180,  215,
467         248,  278,  306,  331,  354,  374,  392,  408,
468         422,  435,  445,  455,  463,  470,  476,  506 },
469      /* K3  */
470      { -441, -387, -333, -279, -225, -171, -117,  -63,
471         -9,   45,   98,  152,  206,  260,  314,  368  },
472      /* K4  */
473      { -328, -273, -217, -161, -106,  -50,    5,   61,
474         116,  172,  228,  283,  339,  394,  450,  506  },
475      /* K5  */
476      { -328, -282, -235, -189, -142,  -96,  -50,   -3,
477         43,   90,  136,  182,  229,  275,  322,  368  },
478      /* K6  */
479      { -256, -212, -168, -123,  -79,  -35,   10,   54,
480         98,  143,  187,  232,  276,  320,  365,  409  },
481      /* K7  */
482      { -308, -260, -212, -164, -117,  -69,  -21,   27,
483         75,  122,  170,  218,  266,  314,  361,  409  },
484      /* K8  */
485      { -256, -161,  -66,   29,  124,  219,  314,  409  },
486      /* K9  */
487      { -256, -176,  -96,  -15,   65,  146,  226,  307  },
488      /* K10 */
489      { -205, -132,  -59,   14,   87,  160,  234,  307  },
490   },
491   /* Chirp table */
492   {   0x00, 0x03, 0x0F, 0x28, 0x4C, 0x6C, 0x71, 0x50,
493      0x25, 0x26, 0x4C, 0x44, 0x1A, 0x32, 0x3B, 0x13,
494      0x37, 0x1A, 0x25, 0x1F, 0x1D, 0x00, 0x00, 0x00,
495      0,  0,  0,  0,  0,  0,  0,  0,
496      0,  0,  0,  0,  0,  0,  0,  0,
497      0,  0,  0,  0,  0,  0,  0,  0,
498      0,  0,  0,  0 },
499   /* interpolation coefficients */
500   { 0, 3, 3, 3, 2, 2, 1, 1 }
501};
502
503/* The following Sanyo VLM5030 coefficients are derived from decaps of the chip
504done by ogoun, plus image stitching done by John McMaster. The organization of
505coefficients beyond k2 is derived from work by Tatsuyuki Satoh.
506The actual coefficient rom on the chip die has 5 groups of bits only:
507Address |   K1A   |   K1B   |   K2   | Energy | Pitch |
508Decoder |   K1A   |   K1B   |   K2   | Energy | Pitch |
509K1A, K1B and K2 are 10 bits wide, 32 bits long each.
510Energy and pitch are both 7 bits wide, 32 bits long each.
511K1A holds odd values of K1, K1B holds even values.
512K2 holds values for K2 only
513K3 and K4 are actually the table index values <<6
514K5 thru K10 are actually the table index values <<7
515The concept of only having non-binary weighted reflection coefficients for the
516first two k stages is mentioned in Markel & Gray "Linear Prediction of Speech"
517and in Thomas Parsons' "Voice and Speech Processing"
518 */
519static const struct tms5100_coeffs vlm5030_coeff =
520{
521   /* subtype */
522   SUBTYPE_VLM5030,
523   10,
524   5,
525   5,
526   { 6, 5, 4, 4, 3, 3, 3, 3, 3, 3 },
527   /* E   */
528   { 0,  1,  2,  3,  5,  6,  7,  9,
529      11, 13, 15, 17, 19, 22, 24, 27,
530      31, 34, 38, 42, 47, 51, 57, 62,
531      68, 75, 82, 89, 98,107,116,127},
532   /* P   */
533   {   0,  21,  22,  23,  24,  25,  26,  27,
534      28,  29,  31,  33,  35,  37,  39,  41,
535      43,  45,  49,  53,  57,  61,  65,  69,
536      73,  77,  85,  93, 101, 109, 117, 125 },
537   {
538      /* K1  */
539      /* (NOTE: the order of each table is correct, despite that the index MSb
540      looks backwards) */
541      {  390, 403, 414, 425, 434, 443, 450, 457,
542         463, 469, 474, 478, 482, 485, 488, 491,
543         494, 496, 498, 499, 501, 502, 503, 504,
544         505, 506, 507, 507, 508, 508, 509, 509,
545         -390,-376,-360,-344,-325,-305,-284,-261,
546         -237,-211,-183,-155,-125, -95, -64, -32,
547            0,  32,  64,  95, 125, 155, 183, 211,
548         237, 261, 284, 305, 325, 344, 360, 376 },
549      /* K2  */
550      {    0,  50, 100, 149, 196, 241, 284, 325,
551         362, 396, 426, 452, 473, 490, 502, 510,
552            0,-510,-502,-490,-473,-452,-426,-396, /* entry 16(0x10) either has some special function, purpose unknown, or is a manufacturing error and should have been -512 */
553         -362,-325,-284,-241,-196,-149,-100, -50 },
554      /* K3  */
555      /*{    0, 100, 196, 284, 362, 426, 473, 502,
556        -510,-490,-452,-396,-325,-241,-149, -50 },*/
557      {    0, 64, 128, 192, 256, 320, 384, 448,
558         -512,-448,-384,-320,-256,-192,-128, -64 },
559      /* K4  */
560      /*{    0, 100, 196, 284, 362, 426, 473, 502,
561        -510,-490,-452,-396,-325,-241,-149, -50 },*/
562      {    0, 64, 128, 192, 256, 320, 384, 448,
563         -512,-448,-384,-320,-256,-192,-128, -64 },
564      /* K5  */
565      {    0, 128, 256, 384,-512,-384,-256,-128 },
566      /* K6  */
567      {    0, 128, 256, 384,-512,-384,-256,-128 },
568      /* K7  */
569      {    0, 128, 256, 384,-512,-384,-256,-128 },
570      /* K8  */
571      {    0, 128, 256, 384,-512,-384,-256,-128 },
572      /* K9  */
573      {    0, 128, 256, 384,-512,-384,-256,-128 },
574      /* K10 */
575      /*{    0, 196, 362, 473,-510,-452,-325,-149 },*/
576      {    0, 128, 256, 384,-512,-384,-256,-128 },
577   },
578   /* Chirp table */
579   {   0,127,127,  0,  0,  0,  0,  0,
580      0,  0,  0,  0,  0,  0,  0,  0,
581      0,  0,  0,  0,  0,  0,  0,  0,
582      0,  0,  0,  0,  0,  0,  0,  0,
583      0,  0,  0,  0,  0,  0,  0,  0,
584      0,  0,  0,  0,  0,  0,  0,  0,
585      0,  0,  0,  0 },
586   /* interpolation coefficients */
587   { 3, 3, 3, 2, 2, 1, 1, 0 }
588};
Property changes on: trunk/src/emu/sound/tms5110r.inc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/sound/tms5110.c
r28728r28729
8484#define CTL_STATE_NEXT_OUTPUT   (2)
8585
8686/* Pull in the ROM tables */
87#include "tms5110r.c"
87#include "tms5110r.inc"
8888
8989#define DEBUG_5110  0
9090

Previous 199869 Revisions Next


© 1997-2024 The MAME Team