Course 16 or 8 bit cpu

Thread Starter

enjoykilian

Joined May 15, 2021
95
Hello
I am searching for a free online course about cpu's but more the old part of it because for educational purposes i want to desing and make a 16 bit (or 8 bit) cpu but i dont know everything already so i want a good course that covers the main stuff of a cpu (ram, alu, registers...) But also video output (vga) and audio output (3 to idk voices and all basic waveforms) and any kind of keyboard input (usb or ps/2) like a commodore 64 so i can program it.

Your help is much appreciated.
 

Papabravo

Joined Feb 24, 2006
21,159
Hello
I am searching for a free online course about cpu's but more the old part of it because for educational purposes i want to desing and make a 16 bit (or 8 bit) cpu but i dont know everything already so i want a good course that covers the main stuff of a cpu (ram, alu, registers...) But also video output (vga) and audio output (3 to idk voices and all basic waveforms) and any kind of keyboard input (usb or ps/2) like a commodore 64 so i can program it.

Your help is much appreciated.
I've never seen a complete course, only the individual bits and pieces. It may be too late to design a traditional CPU with logic gates and MSI building blocks. It is much more likely that you could accomplish this goal by learning Verilog or VHDL and building a CPU in an FPGA. There are many existing CPU designs that you can study as well. I don't know that I have ever seen the published drawings for an actual CPU.
 

Papabravo

Joined Feb 24, 2006
21,159
I have always found this to be an excellent introduction to the world of microcontrollers.

https://www.nxp.com/docs/en/reference-manual/M68HC05TB.pdf
I agree, that it is great for learning how to work with and program microcontrollers, it being one of the smallest useful machines, larger and more capable than a Turing machine. In terms of learning how to design a CPU it might leave the TS unsatisfied. That is why I suggested the FPGA route. I'll let the TS be the judge on that score.
 

Thread Starter

enjoykilian

Joined May 15, 2021
95
Thank yall but the main cpu design i know but how a cpu produces sound and display graphics also what is the 6502 chip
 

MrChips

Joined Oct 2, 2009
30,709
Thank yall but the main cpu design i know but how a cpu produces sound and display graphics also what is the 6502 chip
Whoa! That's a lot to chew on. Let's take one at a time.

How does a computer produce sound?

We will tackle this in reverse order of sound generation.

10) Sound requires an acoustic wave. The most common way to do this is with a mechanical diaphragm.
There are two ways to do this (1) with a voice coil in a loudspeaker or (2) a piezoelectric transducer. Both of these require a varying or oscillating voltage or current.

9) We can create a varying voltage or current with an audio amplifier. We can design and audio amplifier using transistors or op-amps followed by a power output stage, usually of low output impedance. Now we need a signal to drive the amplifier.

8) The audio signal can be generated by a computer in one of two ways (1) by sending a varying voltage from a DAC (digital to analog converter) or (2) by rapidly switching an output pin between logic 0 and 1 while modulating the duty cycle of the digital signal. In either case, the CPU has to have a digital target voltage or duty cycle value to send to the hardware.

7) The CPU needs a sequence of digital values to send to the hardware at predetermined times. In order to make life simple, we keep the cycle period constant. The rate at which the values are sent to the DAC is governed by the sampling theorem (also called the Nyquist limit or Nyquist theorem). High-fidelity sound and the extent of normal human hearing extends to 20kHz. The period of a 20kHz sinewave is 50μs. The sampling theorem demands that the digital values to the DAC must be at minimum twice the maximum signal frequency. In other words, the CPU must send out digital values at 25μs intervals or shorter.

6) Now we need to send values to the DAC every 25μs. While we can do this in a software loop on a fast CPU this is very inefficient in terms of CPU resources. Computers use dedicated hardware to access the digital values so that the CPU is not involved. This can be implemented using hardware interrupts. It is more effective to use DMA (direct memory access) whereby the sound hardware can access computer memory without intervention from the CPU.

5) Now that we have sound hardware, we need to put digital values into a block of memory for the sound hardware to access, in other words, we need content. Content can be a recording from a microphone, from the line input, prerecorded data from a sound file, e,g, mp3 file, or synthesized by the computer and application program such as a MIDI application (Musical Instrument Digital Interface).

4) Now we can pay attention to how many bits will be stored, 8, 12, 16, 24, etc., single channel or multiple channels, and what the digital numbers represent. The values can be encoded in various ways. The data could be linear, logarithmic, exponential, encoded, with error checking, unipolar, bipolar, offset binary... the field is wide open to the designer and intended application.

3) 2) 1) whatever I can think of next.
 

Papabravo

Joined Feb 24, 2006
21,159
Thank yall but the main cpu design i know but how a cpu produces sound and display graphics also what is the 6502 chip
It was an 8-bit CPU produced by MOS Technology. It appeared in two main products:
  1. KIM-I single board computer (ca. 1977)
  2. Commodore PET personal computer (ca.1978)
Documents for both are still available online.
 

Thread Starter

enjoykilian

Joined May 15, 2021
95
Ow so they do it that way i thouth they did by a binary number for example 0000 wich they devided in sections of 2 so 00 And 00 wich the first 00 means the first voice (voice 0) and the last 00 means the waveform 0 and maybe if its a 8 bit number for example 00000101 is it at voice 1 waveform 1 @ a frequency or a note for example (if note) in the last for bits (0000) again spliting it in 00 and 00 than you have note 0 and octave 0 and if you have that information sending that to a decoder and sending it to an oscillator it might sounds stupid but i thought that they did it that way just one question how does a dac work i knew that it was there but never needed to use one before
 

MrChips

Joined Oct 2, 2009
30,709
Ow so they do it that way i thouth they did by a binary number for example 0000 wich they devided in sections of 2 so 00 And 00 wich the first 00 means the first voice (voice 0) and the last 00 means the waveform 0 and maybe if its a 8 bit number for example 00000101 is it at voice 1 waveform 1 @ a frequency or a note for example (if note) in the last for bits (0000) again spliting it in 00 and 00 than you have note 0 and octave 0 and if you have that information sending that to a decoder and sending it to an oscillator it might sounds stupid but i thought that they did it that way just one question how does a dac work i knew that it was there but never needed to use one before
There are 1001 ways to encode information.
Yes, if you wanted to encode music notation you can devise any number of schemes to do so.
However, a musical instrument is a very complex thing. Besides the basic note, (frequency or pitch), there are complex parameters such as volume, attack, decay (envelope), timbre, harmonics, modulation, vibrato, tremolo, and such nuances as slides, hammers, pulloffs, bends, (I am a guitar player), plus all the nuances for violins, horns, percussion instruments etc.

I will explain how a DAC works in another post.
 

Thread Starter

enjoykilian

Joined May 15, 2021
95
There are 1001 ways to encode information.
Yes, if you wanted to encode music notation you can devise any number of schemes to do so.
However, a musical instrument is a very complex thing. Besides the basic note, (frequency or pitch), there are complex parameters such as volume, attack, decay (envelope), timbre, harmonics, modulation, vibrato, tremolo, and such nuances as slides, hammers, pulloffs, bends, (I am a guitar player), plus all the nuances for violins, horns, percussion instruments etc.

I will explain how a DAC works in another post.
Ow thx but i just watched a video and i think its just a large voltage divider but you can explain if you want but its not an nesaceary
 

MrChips

Joined Oct 2, 2009
30,709
If you can accept the fact that what reaches your ear is an acoustic pressure wave that looks something like this, regardless of the source of the sound then we can move on.

1626490185706.png

The picture above could represent about 5 seconds of sound (just my guess).
If we could zoom in and look at a 15ms slice we might see something like this:

1626490335072.png

If we can get the computer to replicate this waveform we would be able to hear the sound.
What we do is to take samples at fixed intervals (say 25μs) and store these values in memory somewhere. This is the function of an ADC (analog to digital converter).

A DAC is the reverse process where we take prerecorded digital values and convert them to a voltage.

Here is an example of a 4-bit DAC
DCBA Volts
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 10
1011 11
1100 12
1101 13
1110 14
1111 15

For illustrative purposes only, let us suppose that we have 4 bits, A, B, C, and D.
Bit-A is given a weight of 1V
Bit-B is given a weight of 2V
Bit-C is given a weight of 4V
Bit-D is given a weight of 8V

When the DAC receives a 4-bit value such as 0101, this is decoded into 0V + 4V + 0V + 1V = 5V
Thus the 4-bit DAC is capable of generating 16 different voltage levels (including 0V).
By sending 4-bit values to a DAC in sequential order the CPU can generate any waveform shape (within given frequency and resolution limitations).


1626490753517.png
 

MrChips

Joined Oct 2, 2009
30,709
Ow thx but i just watched a video and i think its just a large voltage divider but you can explain if you want but its not an nesaceary
No. It is not a large voltage divider. It is more than that. It is a summing amplifier with n-inputs where each input is given a different weight.
 

MrChips

Joined Oct 2, 2009
30,709
The best way to learn about this is by doing it yourself.
If you have the required equipment I can show you how to do this.
Here is the minimum of what you will need:

1) computer (PC or laptop)
2) microcontroller IC, or some kind of MCU development kit or hardware
3) IDE (integrated development environment) aka sw platform, toolset, compiler, etc.
4) oscilloscope
5) assorted values of resistors
 

Thread Starter

enjoykilian

Joined May 15, 2021
95
The best way to learn about this is by doing it yourself.
If you have the required equipment I can show you how to do this.
Here is the minimum of what you will need:

1) computer (PC or laptop)
2) microcontroller IC, or some kind of MCU development kit or hardware
3) IDE (integrated development environment) aka sw platform, toolset, compiler, etc.
4) oscilloscope
5) assorted values of resistors
I dont have an osciloscope
 
Top