Transistor to gate circuit

Diode operation

I believe everyone knows the working characteristics of diodes , So how to use diodes to build a gate circuit ?

And gate of diode : Pull-up resistance , only AB High level at the same time , Output is high

Or gate of diode : Pull down resistance , as long as AB Either one is high , Output is high

MOS Tube work

         In high frequency processing , What we usually use is MOS Transistor instead of triode . Then why use it MOS What's the matter ? use MOS The transistor can achieve higher switching frequency and lower power consumption . however MOS The cost of tube is also relatively higher .

The following are used MOS Transistor construction gate circuit :

MOS And gate circuit of transistor  

MOS Or gate circuit of tube

MOS Non gate circuit of transistor


Gate circuit to arithmetic unit

Implementation of adder

Half adder

Binary number addition , The result is “ XOR gate ( Two values are different 1)”, Carry fetch “ And gate ” 

Full adder

When a carry is to be received , Two half adders are required

  Pulse carry adder and carry ahead adder

          If the full adder is used to realize binary addition , The result of that implementation is the systolic carry adder in the right figure , It is characterized by four full adders , The design is relatively simple , But when you want to operate on a four bit binary number , It takes four cycles to complete the operation . The design of carry ahead adder is complex , But it can complete the calculation of four binary numbers in one cycle . This design idea can let us understand , Why? FPGA Low dominant frequency , But it can still speed up our general calculator . When our algorithm is complex , It may take several dozen cycles for a general-purpose computing unit to complete its work , and FPGA It can be completed in one cycle through design .


The multiplier can be implemented by multiple adders :

Composition of control unit

Program control thought

In the previous section , We have mastered two ways of computing through transistors : Addition and multiplication . It means we already have a calculator . So how to change from a calculator to a computer ? Here we need to be able to master the idea of program control . For example, we want to calculate
3 Time , Then we will decompose it into two steps: addition and multiplication . Then the person completes the operation by operating the button on the calculator . The final result is 12. Then let the computer complete the calculation , First, build a control unit . We hope to complete the calculation of the content through the control unit .



  I believe you are more interested in computers , yes ” Instruction set “ It won't be strange , You can even think of it right away :X86 Instruction set ,ARM Instruction set, etc . So what exactly is an instruction set ? Here we can simply understand as , Instruction set is the choice of circuit , For example, our multiplication circuit , The addition circuit operates on the number in our register at the same time , Which circuit output should we choose , We can implement it through selectors .

  Crystal oscillator

        The crystal oscillator provides the basic clock signal for the system . A circuit without a crystal oscillator is a static circuit , It's like time is frozen , No operations are performed . Therefore, we can also understand it as a time signal .

Instruction definition

With the computing unit and the control unit , Then we can understand the difference between instructions and data , The command code is used to control the control unit , The data is calculated by the arithmetic unit . Next, I design a simple Harvard structure CPU, In order to enable the control unit to calculate addition and multiplication , The following three instructions are defined :

§0100, Write data to register

§0001, Add data to register , Save results to register

§0010, Multiply data by register

        We can analyze , First bit of instruction ( Right to left ) Represents the addition circuit , The second bit of the instruction represents the multiplication circuit , The third bit of the instruction indicates a register write operation , The fourth bit of the command is inactive .

circuit design

        C1 reach C4 Indicates a control command ,D1 reach D4 Represents a data instruction . on analysis ,C1 and C2 Selection of output results for addition and multiplication .C3 Indicates whether the data of the register is input externally or output by the arithmetic unit . Crystal oscillator represented by switch .


With what just happened 3 Instructions , Then we can use it to do a calculation problem !(3+1)×3

0100  0011  ; take 3 Write register

0001  0001  ; take 1 Add to register

0010  0011  ; take 3 Multiply with register


  assembly language

Organize the previous program into : 010000110001000100100011

So many zeros and ones are more complex than passwords , I believe you haven't had time to input it into the computer , Have been able to dictate .

Is there any way to improve this program ?

MOV 3 ; Register storage 3

ADD 1 ; Digital addition of register 1

MUL 3 ; ride 3


         For assembly language , Each instruction corresponds to the chip one by one , Direct command CPU
Carry out work , But it's still a lot more obscure for people . At the same time, the chips designed by different companies are different , The program we develop on one chip may not work on another chip . As a result, high-level languages have emerged . Usually C++
,Java,Python. So what's the difference between the three languages ?

         In the previous introduction , We know things like instruction sets , Common instruction sets are X86 and ARM Instruction set .

        C++ As a typical compiled language , We can compile it into different platforms , But the corresponding X86 Procedures and ARM Programs are not compatible with each other . This is also the importance of source code .

        Java It is also a compiled language , however Java The compiled program is a bytecode instruction defined by itself . So in X86 and ARM Virtual machines that implement these bytecodes on , Can run Java
Procedure . along with java More and more important . Many chips are implemented in hardware java virtual machine . For example, Nokia's Symbian system and our well-known Android system , Is in arm Running on java program ,arm Chip tape
java Hardware analysis .

         It also defines its own bytecode Python and Java What's the difference ?
Python As an interpretative language , Virtual machine comes with interpreter , When running , Keep reading strings , Then it is completed through the interpreter .

©2019-2020 Toolsou All rights reserved,
C++ of string of compare usage Python Study notes ( one )evo Tool usage problems ——Degenerate covariance rank, Umeyama alignment is not possibleRISC-V_GD32VF103-TIMER0 timer interrupt java Array subscript variable _Java Basic grammar : array be based on stm32 Control four-wheel trolley motor drive ( one ) be based on redis Design of liking function Software engineering career planning mysql Query random data by conditions _MySQL Random query of several qualified records centos7 install RabbitMq