Author Topic: ?tion regarding computers from discrete comp's and low level computer structure?  (Read 5622 times)

0 Members and 1 Guest are viewing this topic.

Offline mrpsychoticTopic starter

  • Contributor
  • Posts: 34
I am interested in building certain components of computer processors with the use of discrete components only. I want to build on the individual component level (transistors, resistors, caps) and not on the gate level (quad and gate or hex inverter ic) and I have run into some problems.
I have a few questions and they are large. If you can answer any of them I would be glad but could you number them so I know which one you are talking about.

((1)) My first question is about how to build logic gates with discrete components. I have seen some schematic diagrams for and gates, or gates and inverters; they all seem to have some problems. For example, an and gate might have two bjt's where the base of each is an input.



My question stems from the saturation voltage of transistors. I assume that in logic circuits you want a transistor to act as a switch, and thus would want to make sure that the voltage drop is 0. I learned that to do this, you find the resistance value of the load you are trying to run and figure how much current it would take for the voltage drop to be Vcc. (Light bulb has a resistance of 100ohms, Vcc is 10V, V=IR dictates that the current running through the light bulb would be .1A). Then you divide this current by B (gain of transistor) to find the current that needs to be running through the base emitter path.

How do you find the load of a computer, where the output of a circuit might run through paths of great or little resistance? Is there a way to make logic circuits with transistors acting like switches while avoiding finding the saturation voltage?

((2)) How are computers made so that they can sit idle and then respond to inputs. This might sound like a stupid question but from a programming perspective the only way I could think to do it would be to create an infinite loop that constantly checks for inputs or a 1 in some input register.
The more I think about it the more it seems possible that this is how computers do it now; I know that the're able to run many programs at once so it seems possible. However, how did early computers do it? If a computer had only the capacity to run one program at a time then it seems a program accepting inputs would always have to come to a halt when an input is requires.

Is this truely the only way? How do modern computers accept inputs, how do computers that can only run 1 program at a time accept inputs?

((3)) I am also interested in memory circuitry. Looking at the types of ram, dram seems to be pretty strait forward. As I understand it sram is essentially memory made of logic grates where an outside signal initially acts as an input. The output of the logic circuit is then feed back in as an input and the circuit hold "itself" high or low (this description might be totally wrong). The problem is I have only seen schematics that show sram using CMOS. Is there a way to build sram using bjt's?

((4)) I have also had a chance to look at how rewritable rom (despite being read only) such as flash memory works. My first question is, why is this called read only? I get that it is nonvolatile so it's not ram, but it surely isn't read only memory either!

Are there any ways to make rewritable rom with discrete components? Flash involves, to my understanding, trapping electrons with some kind of tunneling. As far as I know, this can only be done in silicon. If I were to make some sort of computer (or more accurately: a device that demonstrates the properties of a computer) would the non volatile memory be limited to non-electrical things (brain, punch card, magnetic memory)?

((5)) How are jumps done in the opcode level? Assembly has specific commands for different types of jumps. Lets say you are running an 8 bit computer that had 8 bits of memory at each address, can't you only address 256 addresses (0 to 255)? Lets say the 8 bit computer processor has 128 unique operations, and an unconditional jump happens to be the 100th operation. In the memory you write your program to, the jump would be written as 1100100 (100 in decimal, the jump command). There would only be 1 bit left, hardly enough room to write the address of where you are actually trying to jump to.

My only conclusion is that you would tack a 0 to the front of the jump command making 01100100 and filling up the whole byte of memory. Then, when the computer reads the byte it recognizes the opcode for unconditional jump and reads the next byte of memory as the location of the jump and not  as a specific jump. Thus if you were trying to write an unconditional jump to address zero, the program would look like:
........
........
01100100
00000000

Is this how computers perform operations containing operational code and memory addresses that are written as one line in assembly code?
 

Offline Kiriakos-GR

  • Super Contributor
  • ***
  • !
  • Posts: 3525
  • Country: gr
  • User is banned.
    • Honda AX-1 rebuild
Hey you did a big effort to write all those , but still you are making questions that looks like,
that you plan to invent the wheel from the start ..

Why you do not read special books that analyzes power modes like stand-by - sleep -  hibernation.
Read and learn basics about how the BIOS chip works .. 

some questions can not find their answers in public forums .

My advice, start looking for real books related with your homework. 

 
 

Offline Zad

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: gb
    • Digital Wizardry, Analogue Alchemy, Software Sorcery
1) A big question. Or rather, a small question with lots of answers. Briefly, digital electronics mostly uses MOS transistors not bipolar junctions. This means that signals are voltage controlled not current controlled. You shouldn't take the output from the emitter of an NPN transistor anyway, as the output will tend to vary as the base current. An AND gate would normally be formed by building a NAND gate followed by an inverter.

See: http://en.wikipedia.org/wiki/Diode%E2%80%93transistor_logic
and  http://en.wikipedia.org/wiki/Transistor%E2%80%93transistor_logic

2) Interrupts. Most (if not all) modern processors have a "Wait" instruction, this stops the fetch/execute cycle and just stops everything it is doing. When a pin on the IC is pulled low (or high, depending on how it is configured), the processor then jumps to a specific address stored in memory. This can also take place whilst the processor is busy with other work, it just stops what it is doing and jumps to an address. It is up to the interrupt service routine to make sure it saves the registers, restores them and returns cleanly out of the routine.

http://en.wikipedia.org/wiki/Interrupts

The method you described is known as Polling

http://en.wikipedia.org/wiki/Polling_%28computer_science%29

3) One form of a bjt memory cell would be the RS flip flop: http://www.hobbyprojects.com/flip_flop/a_transistor_RS_flip_Flop.html

4) Flash memory is derived from EPROM (electrically programmable read only memory) but the erasing is now performed electrically. All ROMs have to be programmable at least once, or else you need to hand wire the connections! You might possibly be able to fabricate it, but I wouldn't want to bother to be honest. Early computers used magnetic core memory to store non-volatile code http://en.wikipedia.org/wiki/Core_memory

5) Jumps are done several ways, depending on the CPU architecture. Typically a relative (8 bit) jump would be stored as a signed byte in memory, immediately after the instruction. When the instruction decoder realises it has a jump instruction, it fetches the next byte in sequence and adds it to the Program Counter, which is where the next instruction will be fetched from. An absolute jump would be encoded in 2 bytes, which would be loaded directly into the Program Counter.

Mike



Offline mrpsychoticTopic starter

  • Contributor
  • Posts: 34
In response to Kiriakos-GR:

It is true that I am making the wheel from scratch, but I am doing so precisely because I want to know how computers work on the lowest levels. Often, when I find information related to how computers work it is on much higher levels like memory hierarchy. My problem is that these often are written from the point of view "the output of the alu is written into the ram". I want to know how.

In addition I practically have a mental problem where I stop whatever I am doing to look up questions that I have about electronics and computers. These are the questions I have after using traditional lanes of research. Also, I am in high school not college so this isn't for a class, its just a hobby. That means I won't understand really complex responces, especially about computer programming because I struggle with that.

Hopefully this can give you some insight into the knowledge base that I have right now and my motivation for asking such questions.


In response to Zad:

Thanks for the great responses, I really appreciate it!

Funny thing is I have small ferrite cores 3/4th of a mm. I tries to make core memory with no such luck.

For answer five I am a little confused. For a relative jump you said' "When the instruction decoder realises it has a jump instruction, it fetches the next byte in sequence and adds it to the Program Counter". For the absolute jump you said it "would be encoded in 2 bytes".

Are any of these what my guess was? What is the difference between a relative and absolute jump?



Thanks for the responses. Maybe Dave will write in.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11713
  • Country: my
  • reassessing directives...
from the way i see it... all your questions, even a single question of it, has been asked and answered/solved during the period of this several decades. for instance, if you want to build a ROM with discreete components? i think that can easily take up your whole bench already. a discreete computer? well, i might say, your whole house and several of your neighboors! maybe you should start from barbage machine. sorry, your questions just seem too complicated for me. Good luck with your journey ;)
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Question regarding computers from discrete comp's ...
« Reply #5 on: September 26, 2010, 07:31:37 am »
You are cheating. You should first refine your own silicon and build your own transistors, instead of using off-the-shelf transistors. Because you learn so much more from the basic level upwards ...

And I am only halfway joking here. The classic TTL NAND gate, which is the basic building block of TTL logic starts of with a multi-emitter NPN BJT. Good luck in finding one at an affordable price in retail. You could try to replace it with two single BJT, or with a diode gate, effectively going one more step back to DTL.

But really, what is the point? One multi-emitter NPN, three normal NPN transistors, four resistors and a diode make up a basic TTL NAND. Together these components take up more space than a multi-gate TTL IC, and burn power as if the heat death of the universe is imminent.

By all means, if you want to know how a TTL gate works, build on. But forget about building a whole computer out of them in your basement.
« Last Edit: September 26, 2010, 07:34:00 am by BoredAtWork »
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19934
  • Country: gb
  • 0999
I don't see anything wrong with using an emitter follower AND/OR gate every now and then or even a diode gate as long as one is aware of their shortcomings.  An emitter follower will loose 0.7V each stage but at least the output impedance is low and input impedance high. A diode logic gate will loose 0.7V and will have a high output impedance and a low input impedance. In short, one has to be careful, for example connecting the output of a diode AND to an NPN common emitter NOT gate won't produce a reliable gate as the AND gate will saturate at 0.7V which is enough to turn the transistor on, pulling the output low. The correct way is to add a diode in series with the transistor's base or add a current limiting resistor and use a PNP common emitter NOT gate.

If the above doesn't make sense to you then you're not ready to make logic gates with transistors and diodes: you need to do more reading.

I found the following site by Googling for computer discrete transistor. It's just an adder, not a full computer but it's a start.
http://www.waitingforfriday.com/index.php/4-Bit_Computer
 

Offline andri

  • Contributor
  • Posts: 10

((2)) How are computers made so that they can sit idle and then respond to inputs. This might sound like a stupid question but from a programming perspective the only way I could think to do it would be to create an infinite loop that constantly checks for inputs or a 1 in some input register.
The more I think about it the more it seems possible that this is how computers do it now; I know that the're able to run many programs at once so it seems possible. However, how did early computers do it? If a computer had only the capacity to run one program at a time then it seems a program accepting inputs would always have to come to a halt when an input is requires.

Is this truely the only way? How do modern computers accept inputs, how do computers that can only run 1 program at a time accept inputs?

Actually, in general (discounting multicore, multi-CPU and things like that) processors even in the highest-end computers still execute one program at a time. What happens is that every now and then (with Linux it's usually 100 or 1000 times per second) the control is forcibly taken from the application and given to the operating system, which can then schedule another process to run in the next timeslice. Thus we get the impression that the computer is running several programs simultaneously.
 

Offline Zad

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: gb
    • Digital Wizardry, Analogue Alchemy, Software Sorcery

In response to Zad:

Thanks for the great responses, I really appreciate it!

Funny thing is I have small ferrite cores 3/4th of a mm. I tries to make core memory with no such luck.

For answer five I am a little confused. For a relative jump you said' "When the instruction decoder realises it has a jump instruction, it fetches the next byte in sequence and adds it to the Program Counter". For the absolute jump you said it "would be encoded in 2 bytes".

Are any of these what my guess was? What is the difference between a relative and absolute jump?

I don't know a great deal about ferrite cores, and you do need to know lots of technical things about them, and they need to be the type of ferrite which is capable of retaining magnetisation. Most ferrite won't. It also needs a bias in order to write a bit, to overcome the ferrite's reluctance to magnetise.

I'm not sure how usable your jump type would be. A relative jump is capable of jumping a maximum of 128 bytes forwards or 127 bytes backwards, relative to wherever the program counter is currently pointing (very useful for small loops). An absolute jump is capable of jumping to any location in the 65536 address space. A third type would be a subroutine call, which pushes the current programme counter onto the stack and jumps to the (2 byte) location. A typical syntax might be:

CALL #0C00

Then a RETURN instruction at the end of the routine POPs the value off the stack and back into the programme counter, resuming execution from immediately after wherever the CALL instruction was.

If you want to get deep into assembly language programming, have a look at something like The Art of Assembly Language (now available off-copyright http://flint.cs.yale.edu/cs422/doc/art-of-asm/pdf/ )



Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19934
  • Country: gb
  • 0999
((4)) I have also had a chance to look at how rewritable rom (despite being read only) such as flash memory works. My first question is, why is this called read only? I get that it is nonvolatile so it's not ram, but it surely isn't read only memory either!
Flash memory is just a type of EEPROM. It's called EEPROM for historical reasons and is nothing like RAM.

First there was ROM which is Read Only Memory and was only mask programmable i.e. it had to be done at manufacture.

Then there was PROM (Programmable Read Only Memory) which could be programmed electronically. It worked by having lots of tiny little fuses which could be blown by applying a high voltage that would change the bit from high to low. It could only be written to once, a bit could be changed from 0 to 1 but not back again: you can't unblow a fuse.

Then came EPROM (Erasable Programmable Read Only Memory) that could be programmed electronically but required UV to erase the chip which had to be all done in one go.

Eventually there was EEPROM (Electronically Erasable Programmable Read Only Memory) which could be erased electronically but whole IC still had to be erased in one go so it could not be used like a hard drive or USB stick, more like a CD-RW.

Now there's flash memory which consists of many EEPROM units on the same IC (these are known as blocks, cells or sectors). The memory contents can't be written to like RAM, each block needs to be erased completely before any of the bits in the block can be reused which makes some write operations considerably slower than reading. For example, suppose the flash memory is split into 8192 x 1 megabit blocks (a 1GB flash drive) and only one bit needs to be changed from a 1 to a 0, the whole block needs to be copied to some RAM (this is always on the flash IC for speed and cost purposes), the bit changed in RAM, the block erased and the data in RAM written back to the EEPROM, which is very slow. Another problem is that blocks can only withstand a certain number of erase operations before they stop working or corrupt data.

There are some solutions to the problems described above:

Write speed can be increased by writing the data somewhere else, marking a block as empty rather than erasing it and doing it later when the drive isn't busy or only when there isn't enough room to fit any more data.

The life can be increased dramatically by using wear levelling which ensures the same block isn't written/erased cyclically and that blocks which have been used less are erased rather than ones which have been used many times before.

As far as using a ferrite as memory is concerned: it won't work because the kind of material used to make inductors and transformers does not hold its magnetism. My advice is use audio cassette or punched paper tape for storage, like old computers did, rather than trying to make your own solid state non-volatile memory which won't be as good as the old mechanical methods. The computer will need to be booted manually: keep the CPU halted in its reset state, copy the data from the storage to RAM and start the CPU. When you've finished, you'll need to copy the data from RAM to a separate data storage, assuming you want to save it.
 

Offline mrpsychoticTopic starter

  • Contributor
  • Posts: 34
Thanks for all of the advice, I have read more and seen how bjt's can be used in TTL logic open collector circuits that are robust. These require different values of resistors and such so it looked somewhat hard. I have read the allaboutcircuits.com digital volume on the construction and function of logic gates http://www.allaboutcircuits.com/vol_4/index.html.

I have also gained good understanding through that chapter of introductory cmos logic gates which seem to be both simpler to understand and easier to construct. I have a few questions about the parts used in cmos logic gates:

1. Where the chapter labeled resistors in TTL open collector logic gates, there was no mention of any in cmos logic gates (save maybe a few pullup resistors on the inputs). Are there any internal components needed other than transistors in cmos circuitry?

2. The article mentions mosfet transistors and judging by the name cmos I am guessing that mosfet transistors are required as apposed to other varieties of fet's. Is this true?

3. Lastly and most importantly, I am on a severe hobbyist budget but I want to make a few gates of my own. While I am finding that bjt's can cost as low as 2 cents for both npn and pnp transistors I am having a harder time with mosfets. First off I make my own circuit boards and they are to crude for sot packages. So, I need through hole packaging. Also, there seem to be a lot less p channel than n channel mosfets, and more importantly I get the impression that certain p- channels make better complements to certain n-channel. Is it true that any old p-channel won't be really compatible with any old n-channel?

My requirements then are through hole and p-channel is complimentary with the n-channel. The variable factor is getting the lowest cost since I am considering buying a few hundred of each type.

The lowest n- channel through hole I can find is 6.5 cents in bulk (2n7000). P-channels seem to be as cheap as 25 cents in bulk and I don't even now if it is complimentary. Can anyone recommend cheap, through hole, n and p channel mosfets that make a good pair? Tall order I know.

Thanks again for any suggestions and insight.

 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19934
  • Country: gb
  • 0999
1) I suggest you answer that yourself: look at the datasheets for some common CMOS ICs.

2) What does CMOS stand for? Read the article on CMOS.

3) A P-channel MOSFET will always be inferior to an N-channel MOSFET of the same price, mainly because it will have a higher channel resistance. As far as complimentary is concerned, you want a similar P-MOSFET with roughly similar characteristics as the N-MOSFET. You won't find one but I think the threshold voltage is the most important thing.

A word of caution about building your own CMOS gates. Look at the schematic for an inverter.


When the input changes from 0 to 1, there will be a point where both MOSFETs are turned on which will short circuit the supply and draw a large current. This can be minimised by ensuring that one of the transistors is slightly faster than the other and choosing devices without too lower Ron. It's probably a good idea to get an N-channel MOSFET with a faster switching speed and lower gate capacitance: remember better N-channel transistors are cheaper than P-channels.

You might also want to consider using the CD4007 IC which contains a logic inverter and two complimentary pairs:
http://www.seas.upenn.edu/~ese206/labs/MOSFET/CD4007Datasheet.pdf

It's an IC but you still get access to the individual transistors so it's not quite the same as cheating and using a C4001 for a NOR gate.

Hell I suggest you build one NAND and one NOR gate from discrete transistors, that way you can prove to yourself that you can do it. Then build your computer from either NAND or NOR CMOS logic ICs a any gate can be made from them and any flip-flop circuit can be made from discrete gates. The 74HC00 is probably a good start and can be bought in large quantities pretty cheaply but you may want to choose an IC with Schmitt trigger inputs e.g. 74HC132 for noise immunity.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf