You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user_peripherals/20_AY8913.md
+53-4Lines changed: 53 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,13 +19,27 @@ Peripheral index: 20
19
19
20
20
## What it does
21
21
22
-
This is a replica of 8-bit classic **[AY-3-8913](https://en.wikipedia.org/wiki/General_Instrument_AY-3-8910)** 3-voice programmable sound generator (PSG) chip from General Instruments. The AY-3-8913 is a smaller variant of AY-3-8910 or its analog YM2149.
22
+
This is a replica of 8-bit classic **[AY-3-8910/AY-3-8912/AY-3-8913](https://en.wikipedia.org/wiki/General_Instrument_AY-3-8910)** 3-voice programmable sound generator (PSG) integrated into a modern RISC-V as a peripheral.
23
23
24
+
The AY-3-891x family of programmable sound generators was introduced by General Instrument in 1978. Variants of the AY-3-891x were broadly used in:
- A single **envelope** generator able to produce 10 different shapes
35
+
- Chip is capable to produce a range of waves from a **30 Hz** to **125 kHz**, defined by **12-bit** registers.
36
+
-**16** different volume levels on a logarithmic scale
24
37
25
38
## Register map
26
39
27
-
The behavior of the AY-3-891x is defined by 14 registers. All registers are READ ONLY!
40
+
The behavior of the AY-3-891x is defined by 14 registers. The register map matches the original AY-3-891x and should be able to play the original tunes without modifications.
28
41
42
+
All registers are **read only** in this peripheral and start in **unknown** uninitialised state upon reset!
29
43
30
44
| Address | Access | Bits used | Function | Description |
@@ -44,10 +58,45 @@ The behavior of the AY-3-891x is defined by 14 registers. All registers are READ
44
58
| 12 | R |```xxxxxxxx```| ---//--- | 8-bit coarse frequency |
45
59
| 13 | R |```....xxxx```| Envelope Shape | 4-bit shape control |
46
60
61
+
### Square wave tone generators
62
+
63
+
Square waves are produced by counting down the 12-bit counters. Counter counts up from 0. Once the corresponsding register value is reached, counter is reset and
64
+
the output bit of the channel is flipped producing square waves.
65
+
66
+
### Noise generator
67
+
68
+
Noise is produced with 17-bit [Linear-feedback Shift Register (LFSR)](https://en.wikipedia.org/wiki/Linear-feedback_shift_register) that flips the output bit pseudo randomly.
69
+
The shift rate of the LFSR register is controller by the 5-bit counter.
70
+
71
+
### Envelope
72
+
73
+
The envelope shape is controlled with 4-bit register, but can take only 10 distinct patterns. The speed of the envelope is controlled with 16-bit counter. Only a single envelope is produced that can be shared by any combination of the channels.
74
+
75
+
### Volume
76
+
Each of the three AY-3-891x channels have dedicated DAC that converts 16 levels of volume to analog output. Volume levels are 3 dB apart in AY-3-891x.
77
+
78
+
## IO pins
79
+
80
+
There is a single PWM output signal that is connected to all the output pins uo_out[7:0].
81
+
The input pins are not used.
82
+
47
83
## How to test
48
84
49
-
TODO: Explain how to use your project
85
+
All register state are in **unknown** uninitialised state upon reset. The very first thing you should do is to set them to zero!
86
+
87
+
In order to play a standard pitch A440 note you have to enable Channel A tone in the mixer:
0 commit comments