atomic-structure

As indicated in Fig. 3, silicon has 14 orbiting electrons, germanium has 32 electrons, gallium has 31 electrons, and arsenic has 33 orbiting electrons.

For germanium and silicon there are four electrons in the outermost shell, which are referred to as valence electrons.

Valence electrons are electrons in the outer shells that are not filled. Because valence electrons have higher energy than electrons in inner orbits, they are involved in the majority of chemical processes. They assist us in determining the chemical properties of an element, such as its valency or how it forms bonds with other elements.

Gallium has three valence electrons and arsenic has five valence electrons. Atoms that have four valence electrons are called tetravalent, those with three are called trivalent, and those with five are called pentavalent.

The term valence is used to indicate that the potential (ionization potential) required to remove any one of these electrons from the atomic structure is significantly lower than that required for any other electron in the structure.

Ionization energy, also called ionization potential, is the energy necessary to remove an electron from the neutral atom. X + energy → X+ + e− where X is any atom or molecule capable of being ionized, X + is that atom or molecule with an electron removed (positive ion), and e − is the removed electron.

covalent-bonding

In a pure silicon or germanium crystal the four valence electrons of one atom form a bonding arrangement with four adjoining atoms, as shown in Fig. 4.

This bonding of atoms, strengthened by the sharing of electrons, is called covalent bonding.

Because GaAs is a compound semiconductor, there is sharing between the two different atoms, as shown in Fig. 5. Each atom, gallium or arsenic, is surrounded by atoms of the complementary type. There is still a sharing of electrons similar in structure to that of Ge and Si, but now five electrons are provided by the As atom and three by the Ga atom.

covalent-binding-gaas

Although the covalent bond will result in a stronger bond between the valence electrons and their parent atom, it is still possible for the valence electrons to absorb sufficient kinetic energy from external natural causes to break the covalent bond and assume the “free” state. The term free is applied to any electron that has separated from the fixed lattice structure and is very sensitive to any applied electric fields such as established by voltage sources or any difference in potential. The external causes include effects such as light energy in the form of photons and thermal energy (heat) from the surrounding medium. At room temperature there are approximately free carriers in of intrinsic silicon material, that is, 15,000,000,000 (15 billion) electrons in a space smaller than a small sugar cube—an enormous number.

欢迎来到电子的微观世界!

legacy

Real mode

The central processing unit(CPU) always starts in real mode, and then the main loader usually executes the code to explicitly switch it to protected mode and then to the long mode.

These are the registers usable in real mode:

  • ip, flags;
  • ax, bx, cx, dx, sp, bp, si, di;
  • Segment registers: cs, ds, ss, es, (later also gs and fs).

As it was not straightforward to address more than 64 Kilobytes of memory, engineers came up with a solution to use special segement registers in the following way:

  • Each physical address consists of 20 bits(so, 5 hexadecimal digits).

  • Each logical address consists of two components. One is taken from a segment register and encodes the segment start. The other is an offset inside this segment. The hardware calculates the physical address from these components the following way:

    physical address = segment base * 16 + offset

    You can often see addresses written in form of segment:offset, for example:

    1
    4a40:0002, ds:0001, 7bd3:ah

    Note that strictly speaking, the segment register do not hold segments' starting addresses but rather their parts(the four most significant hexadecimal digits). By adding another zero digit to multiply it by we get the real segment starting address.

    Each instruction referencing memory implicitly assumes usage of one of segment registers. Documentation clarifies the default segment registers for each instruction. However, common sense can help as well. For instance, mov is used to manipulate data, so the address is relative to the data segment.

    1
    mov al, [0004]	; === mov al, ds:04444

    It is possible to redefine the segment explicitly:

    1
    mov al, cs:[0004]

    When the program is loaded, the loader set ip, cs, ss, and sp register to that cs:ip corresponds to the entry point, and ss:sp points on top of the stack.

    Real mode has numerous drawbacks

    • It makes multitasking very hard. The same address space is shared between all programs, so they should be loaded at different addresses. Their relative placement should usually be decided during compilation. :joy: But maybe we can distributed these tasks by hand.
    • Programs can rewrite each other's code or even operating system as they all live in the same address space. :dog: What about only one user?
    • Any program can execute any instruction, including those used to set up the processor's state. Some instructions should only be used by the operating system(like those used to set up virtual memory, perform power management, etc.) as their incorrect usage can crash the whole system. :laughing: We do not have operating system!

Protected Mode

Intel 80386 was the first processor implementing protected 32-bit mode.

It provides wider versions of registers(eax, ebx, ..., esi, edi) as well as new protection mechanisms: protection rings, virtural memory, and an improved segmentation.

Obtaining a segment starting address has changed.

Linear address = segment base(taken from system table) + offset

Each of segment registers cs, ds, ss, es, gs, and fs stores so-called segment selector, containing an index in a special segment descriptor table and a little additional information.

Two types of segment descriptor tables:

  • LDT(Local Descriptor Table)
  • GDT(Global Descriptor Table)
segment-selector

Index denotes descriptor position in either GDT or LDT. The T bit select either LDT or GDT. As LDTs are no longer used, it will be zero in all cases.

The table entries in GDT/LDT also store information about which privilege level is assigned to the described segment. When a segment is accessed through segement selector, a check of Request Privilege Level(RPL) value(stored in selector = segment register) against Descriptor Privilege Level(stored in descriptor table) is performed. If RPL is not privileged enough to access a high privileged segment, an error will occur. This way we could create numerous segments with various permissions and use RPL values in segment selectors to define which of them are accessible to us right now(given our privilege level).

segment-descriptor

G-Granularity, e.g., size is in 0=bytes, 1=pages of size 4096 bytes each.

D-Default operand size(0=16 bit, 1=32 bit).

L-Is it a 64-bit mode segment?

V-Available for use by system software.

P-Present in memory right now.

S-Is it data/code (1) or is it just some system information holder (0).

X-Data (0) or code (1).

RW-For data segment, is writing allowed? (reading is always allowed); for code segment, is reading allowed? (writing is always prohibited).

DC-Growth direction: to lower or to higher addresses? (for data segment); can it be executed from higher privilege levels? (if code segment)

A-Was it accessed?

DPL-Descriptor Privilege Level (to which ring is it attached?)

Enabling Protected Mode loader_start32.asm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
lgdt cs:[_gdtr]

mov eax, cr0 ; !! Privileged instruction
or al, 1 ; this is the bit responsible for protected mode
mov cr0, eax ; !! Privileged instruction
jmp (0x1 << 3):start32 ; assign first seg selector to cs

align 16
_gdtr: ; stores GDT's last entry index + GDT address
dw 47
dq _gdt

align 16

_gdt:
; Null descriptor (should be present in any GDT)
dd 0x00, 0x00
; x32 code descriptor:
db 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x9A, 0xCF, 0x00 ; differ by exec bit
; x32 data descriptor:
db 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x92, 0xCF, 0x00 ; execution off (0x92)
; size size base base base util util|size base

Accessing Parts of Registers

1
2
3
4
5
6
7
8
9
10
11
mov rax, 0x1122334455667788			; rax = 0x1122334455667788
mov eax, 0x42 ; !rax = 0x00 00 00 00 00 00 00 42
; why not rax = 0x1122334400000042 ??

mov rax, 0x1122334455667788 ; rax = 0x1122334455667788
mov ax, 0x9999 ; rax = 0x1111222233339999, as expected
; this works as expected

mov rax, 0x1122334455667788 ; rax = 0x1122334455667788
xor eax, eax ; rax = 0x0000000000000000
; why not rax = 0x1122334400000000?

As you see, writing in 8-bit or 16-bit parts leaves the rest of bits intact. Writing to 32-bit parts, however, fill the upper half of a wide register with sign bit!

Explanation

Let's think about instruction decoding. The part of a CPU called instruction decoder is constantly translating commands from an older CISC system to a more convenient RISC one. Pipelines allow for a simultaneous execution of up to six smaller instructions. To achieve that, however, the notion of registers should be virtualized. During microcode execution, the decoder choose an available register from a large bank of physical registers. As soon as the bigger instruction ends, the effects become visible to programmer: the value of some physical registers may be copied to those, currently assigned to be, let's say, rax.

The data interdependencies between instructions stall the pipeline, decreasing performance. The worst cases occur when the same register is read and modified by several consecutive instructions(think about rflags!).

If modifying eax means keeping upper bits of rax intact, it introduces an additional dependency between current instruction and whatever instruction modified rax or its parts before. By discarding upper 32 bits on each write to eax we eliminate this dependency, because we do not care anymore about previous rax value or its parts.

This kind of a new behavior was introduced with the latest general purpose registers' growth to 64 bits and does not affect operations with their smaller parts for the sake of compatibility. Otherwise, most older binaries would have stopped working because assigning to, for example, bl, would have modified the entire ebx, which was not true back when 64-bit registers had not yet been introduced.

动机

感觉我们国家已经到比较危险的时候。基础教育迫不及待。当然这里要致敬我的电路老师许承斌,像他这样在基础学科默默奉献一辈子的教师,值得我们尊敬和学习!所以我打算从头开始好好学习电路,打算把相关的知识也好好复习整理,能够累积成一些好的课件,给现在的年轻人们一些帮助。也许20-30年后,经过一两代人的努力,我们的半导体水平能够慢慢接近美国。

计划的参考文献、书籍

  • Electronic Devices and Circuit Theory
  • Practical Electronics for Inventors
  • 面包板电子制作130例

依赖的一些知识

  • Ordinary Differential Equations - Dr. Trefor Bazett

教果果的一些记录

2022-12-17

  1. 串并联3个发光二极管
  2. 面包板连线
  3. 万用表测量电阻
  4. 直流电源调节电压

2022-12-31

  1. 搭建OR gate,使用两个二极管并联,串联一个发光二极管
  2. 教了diodes,正、反
  3. 电流大小计算
  4. 0.7V压降

2023-1-1

NOR Gate,采用两个二极管并联,一个上拉发光二极管。

2023-1-2

AND Gate,反向的两个二极管并联,一个上拉电阻,串联一个发光二极管。

NAND Gate,反向两个二极管并联,上面两个1K,其中一路串联发光二极管,下面一个1K。教了果果diodes 0.7V压降测量。

2023-1-8

和果果一起搭了例29,音频放大器。其中我们一起焊接了断了线的BP。一共用了5个小面包板(一种分布式架构)。一个自制switch,电源switch,地switch。

mianbao-29

2023-1-14

和果果先学习了555 timer基本原理。果果发现了半圆形来找引脚的方法。然后我们搭了例78,催眠器。是雨滴的模拟声。有个8号引脚连错了,debug了一下。但是调节可变电阻并没有显著改变频率。增加电压可以让电流变大,BP声音变响。

mianbao-78

2023-2-4

果果学习了电阻的色环,以及万用表测量电阻。并收拾了上个电路。开始搭建例12,光控点动开关,果果完成了左半部分电路,我学习了继电器HK4100F一些连线,成功搭建完成。

mianbao-12

阶段总结

对于一个一年级小朋友,其实已经可以慢慢学习电路的一些基础,尤其可以一起动手,理论的知识可以慢慢潜移默化的教,但是动手成功制作一个面包板项目,能让孩子更有信心和兴趣,后续希望还能听到果果和我说:“爸爸,我们来搭电路吧”。

List some tools for my MacBook.

  • Software
    • CleanMyMac X
    • magnet
    • parallels desktop
  • peripheral
    • hhkb
    • Mateview
    • magic mouse

我们先自我介绍,介绍完以后,我们进行了分组。我当了队长,还有人当了副队长。我们的队伍叫“孙悟空队”,他们的队叫“奥特曼队”。然后我们就开始拔萝卜了。拔完萝卜以后,我们就开始做香肠。第一步,把肠衣套在一个像管子一样的东西上。第二步,把上面给打结。第三步,把肉给塞进去。还有一根管子一样圆的东西,把肉给压住。👩帮我压住肉,我在下面把肉扶住,把它做成几段。做好了以后,我们要把它晾干。

做完香肠以后,我们就吃中午饭。吃完中午饭,我们在玩。玩了一会,老师叫一些人来洗萝卜。我也去了。洗完萝卜以后,我们就开始切萝卜。切完萝卜,我们去砍竹子。我们小组砍完竹子,就开始做竹筒饭。做完竹筒饭以后,我们就去拔了干草,老师说我们两个队要比赛,看谁拔的多。我们小组的人努力的拔,“嘿呦,嘿呦......”,比赛结果奥特曼队赢了。老师给他们发了100的金币。发完以后,我们队老师也奖励了20的金币。拿着我们的干草,去喂牛,羊吃。喂完小动物,我们就去偷鸡蛋。老师给我们发了一个盒子,我们就去鸡窝里捡鸡蛋。我们想要抓一只鸡,我们所有人都没抓到,只有一个人抓到了一只🐔,他是奥特曼队的队长。最后我们把一天收获的金币兑换掉,我换了一些礼物,换好礼物,老师还给我们每个人发了一顶帽子。发完以后,老师还把我们今天一天的劳动的一些菜,每人都发了一些。

今天一天我们都在玩一些有意思的劳动。我感觉今天的劳动很开心,都是一些好玩的劳动。今天的一天真愉快!不知道下次妈妈还会带我去什么地方干农活?

第一天,我们到了临安,我跟一个默默弟弟一起下水玩。我下水玩,有一个哥哥,他抓了很多的🦐,他告诉我有一个地方有好多的🦐,我去抓了很多条🦐。我们玩了一会,默默弟弟他跟我要上楼了。上楼我们都休息了一会会。又过了一会,妹妹起床了。我们起床了以后,我和默默弟弟还有妹妹又一起下水玩了一会。我们坐车到了一个饭店,那边有一块很到很大的草坪,我们到那边去玩了一会。我们走了一个楼梯,下去看到一个石头滩。我跟默默和妹妹一起拿了一些小石头一起丢,默默的外公他丢了一个石头,可以在水面上蹦了好几次,一直蹦到对岸。然后我们就去吃饭了。吃完饭,默默弟弟直接上床睡觉了,我在下面玩了会,然后我就上床去睡觉了。

第二天早晨我们一起来,我跟默默弟弟一起走了一会路。我们看到了一个地方,然后妈妈叫我们回来吃早饭了。回来我们就去吃早饭了。吃完早饭以后,我们就去爬山了。我们从山脚开始爬,爬到半腰,我和默默弟弟排在最前 面,默默弟弟排在第一个,我排在第二个,其他人全都排在我们俩的后面。我们一直爬到快到山顶了,到山顶以后我们看到了一个小亭子,我们都休息了一会。我和默默走到了亭子旁边,看到了山上有一个水,我们就喝了一口,这个水是甜甜的,跟我们一起走到那边的人都喝了一口,妈妈说很好喝。喝完以后我们就去了旁边一个地方,有一个小溪。我跟默默弟弟在那边玩了一会。玩好以后我们又回到亭子休息了一会。我们就下山了。下山的路上我捡到了一些树枝,然后我们到🚗上。然后我们就去吃中午饭了。吃完午饭,默默弟弟睡觉了。我在补作业。补好作业,我在一楼玩了一会。玩好以后我想叫默默弟弟起床,然后我叫了一声默默弟弟,但是默默他还是没有起床。然后我就下到二楼看了一眼妹妹,看妹妹已经醒过来了。然后我就开始跟妹妹玩了。我跟妹妹玩了一会,默默他就起床了。就跟我一起玩了。他外公帮我和默默弟弟采了一些芦苇。然后我们玩了妈妈宝宝扫地的游戏。然后我们上山了。我们走到早晨去玩的地方。早晨我们没看到有个游乐场,然后我们就在里面玩。里面有跳跳床、翘翘板、转转盘,还有一个小乐园。然后我们就去吃饭了。吃完饭,我们看到了一个人他在跳舞。然后我就去跳了一会。然后我们就上床睡觉了。

第三天,我们早晨吃完早饭,然后我们玩了一会会就回家了。

这三天真是愉快的三天!不知道下次还会去哪里?真希望下一次再跟默默弟弟一起玩~我希望下次还能交到一个新朋友!

我跟一个比我大一岁的哥哥去磐安玩。我们第一天去的是十八涡。我们看到了乌石村。然后就去吃饭了。吃完饭,坐大巴就入住酒店了。

第二天,我去走了玻璃吊桥,也走了彩虹桥,还坐了飞船。走完了以后,比我大的哥哥掉了一颗彩虹糖,他就哭了。然后我们就去吃饭了。吃完饭,我们在旁边逛了一会,马上就要下雨了。我们走了很久才找到大巴车。我们回到酒店玩了一会,然后就去吃晚饭了。晚饭吃好我们在昨天晚上的地方走了一会。我们走到了一个地方,有很多的小人,我们照着他摆造型。

第三天,我们去了舞龙峡。我们坐了车子,到了以后下车,下车了以后又坐了船。船带我们到大瀑布。我们看到了五个大瀑布。其中有个瀑布超级的大,我站在旁边,有很多水都崩出来了,很凉快。看完了以后我们就去吃饭了。吃完饭以后还有两个景点,我们去舞龙园看了一个龙的动画片。看好龙的动画片以后,我们去拍了一些照片,到一个地方,去走了迷宫。然后我们再坐了小火车,还看了舞龙表演,我上去甩了龙,爷爷也上去甩了龙,爷爷还上去拿了旗帜。我们做大巴车又去了一个博物馆,去完博物馆我们就去吃晚饭了。

第四天早上,我们去了一个菜场,去完菜场以后,我们就去吃中饭。吃完中饭我们就回家了。

上上周我去朱家尖玩。我们10点出发,直到下午3点才到。我们到酒店了以后,换上游泳衣,去东沙的沙滩玩。我跟妹妹先玩了一会沙子,然后爸爸带我去游泳。我去玩大浪,我都吃了好几口咸的海水。 玩好了以后,我又到了妈妈那边和妹妹一起玩沙子。

回到家洗好澡以后,妈妈带我们去吃海鲜。我们吃了海鲜炒饭,虾,海螺,扇贝。吃完饭妈妈带我和妹妹去买了两桶水。等爸爸吃完了以后,我和妹妹已经很累了,我们就回到了酒店。我和妹妹刷好牙就一起睡觉了。

我们第二天吃好早饭以后,就去大清山玩。我们到了大清山很高的地方,看下去的风景很美。我们在上山的地方,还看到了一个沙滩,我们下去玩了一会会。在下山的路上,我在车上看到下面的海是五颜六色的。有墨绿色,深蓝色,淡蓝色,还有黄色。我们下山了以后,就去了另外一个酒店。到酒店了以后,过了一会,阿姨给我们吃了西瓜,吃完后,我们放下行李,去吃海鲜面条。回到酒店,我们上楼。我们的房间打开窗户就能看到沙滩。

下午妹妹起床,我们换好泳衣,到楼下小沙滩去玩堆沙堡。在玩沙之前,我最近想出了一个很好玩的游戏,叫小猫露露。我是小猫露露,妹妹是白兔糖糖,爸爸是乌龟皮皮。我想到一个好主意,我们用干沙和湿沙围了一个圆圈。👨说把这个当做一个城堡。然后我们又用干沙和湿沙一起搭了一个很坚固的城堡。那时候快涨潮了,👨突然想到了一个好主意,👨说我们可以挖一条护城河。我们在挖护城河的时候,我看到那边有人也造了一个沙堡,他们因为没有护城河,很快就被潮水淹没了。潮水越涨越高,再过10分钟就要到达我们的地方了,我说我们必须得挖快一点啦!果真过了10分钟之后,海水真的到达我们的目的地了。看起来护城河跟大浪像在打仗一样,感觉很多大浪快被护城河运走了。最后实在更多大浪过来了,在没有淹之前,妈妈帮我们拍了我们自己造的城堡,我们拿上工具,摆了一个造型。城堡被淹没后,我们回酒店了。

第三天早上,我们到一楼,吃了好吃的。我们的饭都是一样的,我感觉超级好吃,里面有鸡蛋、西瓜、花生和咸菜,还有泡饭、馒头。吃完早饭后,我们收拾好行李,去观音法界。我看到了千手观音。还看到了很多的观音的雕像。我还看了一会电影。然后我们就回家了。

到家了以后,爷爷烧了香喷喷的饭菜,我吃了很多。真是一个愉快的暑假开始的第一个周末!

端午节的上午爸爸带我和妹妹去篮球场玩。我跟妹妹玩,爸爸投篮。玩好之后爸爸带我们走回家。

我们吃西瓜,吃完中饭妹妹睡午觉。

下午在家玩树莓派。爸爸先教我灯闪烁,又教我了声音传感器。我们一起录了视频,我扮了小猫露露,可可在外面玩。

吃晚饭,睡觉。

起床,今天早晨起来,我带爷爷去昨天那个篮球场,我自己玩,爷爷投篮。爷爷骑自行车带我回到家。吃早饭。妹妹起床有点生病。过了一会妈妈说带我去看琴。吃饭。回来。妹妹已经睡着了。妹妹起来后我们一起玩小猫露露的游戏。我扮演小猫露露,妹妹扮演白兔糖糖。妈妈跟我讲,明天要和糖糖姐姐一起去森泊水上乐园。

我很开心,马上要到我的生日了。这个端午节是我最爱的端午节!

又过了一个星期,到周末了。这个周末,是一个清明节。 第一天,👩早晨在家给我们洗衣服,👨带我和妹妹下面玩一号🐹和二号🐹的游戏。 到了中午,👩跟我说好要去吃肯德基,吃完肯德基带我看电影。到了中大银泰的肯德基店里,妈妈在座位上点菜,肯德基那边有个小的玩具厂,然后我在里面玩的非常开心。我玩的滑滑梯,过了一会我走出了玩具厂,然后在座位上等了一会,我等得非常饿,洗完手后,👩让我在座位上再等一会,过了一会儿,👩把饮料还有炸鸡翅,薯条都拿了过来。吃完以后,👩给我们又点了一份蛋挞,吃完我们就去看电影了。看完了电影,妈妈告诉我去糖糖姐姐家玩。 到了糖糖姐姐家,糖糖姐姐带我去楼顶上看了兔子,还有乌龟,我还喂了兔子苹果和青菜。然后下了楼,我们一起玩了一个小房子。玩了很长的时间,妈妈说要吃饭了。吃完饭后,糖糖姐姐给我吃了一个棒棒糖。我们两个人又开始一起玩了。 第二天到了,吃完早饭,我们就去爬山了。我们爬城隍山。我跟糖糖姐姐一起爬山。到了山顶,我们又往前继续走,那边又很多的石头,就像一座山,我们一起爬上去又爬下来。👨带着妹妹也一起爬上爬下。 中午到了,我们去西湖银泰吃了莜莜面。吃完面,我们去外面打了会游戏,吃了个冰淇凌。然后我们就回家了。 下午我们再玩了一会一号🐹和二号🐹。 今天早晨,吃完早饭,妈妈去把我们上周的书还掉,爸爸带着我和妹妹又去玩了一号🐹和二号仓鼠。 下午我们在家里休息。 晚上我想再和爸爸去玩一号🐹和二号🐹😂。 这个清明节,虽然没有去成三亚,但是还是非常非常愉快,这个清明节简直是我最喜欢的一个清明节了。

0%