5章 コンピュータアーキテクチャ (後半)
こんにちは、tangoです。
本ページは、5章 コンピュータアーキテクチャ(前半)の続きです。
★回路図
・CPU
CHIP CPU {
IN inM[16], // M value input (M = contents of RAM[A])
instruction[16], // Instruction for execution
reset; // Signals whether to re-start the current
// program (reset==1) or continue executing
// the current program (reset==0).
OUT outM[16], // M value output
writeM, // Write to M?
addressM[15], // Address in data memory (of M)
pc[15]; // address of next instruction
PARTS:
//★ARegisterの作成、addressMの作成
Mux16(a=instruction, b=ALUout, sel=instruction[15], out=Ain);
Not(in=instruction[15], out=anot);
Or(a=anot, b=instruction[5], out=Aload);
ARegister(in=Ain, load=Aload, out=Adate, out[0..14]=addressM);
//★instruction[12]が0=A 1=M を決める
Mux16(a=Adate, b=inM, sel=instruction[12], out=AorM);
//★DRegisterの作成
And(a=instruction[4], b=instruction[15], out=Dload);
DRegister(in=ALUout, load=Dload, out=Ddate);
//★outMを作成
ALU(x=Ddate, y=AorM,
zx=instruction[11], nx=instruction[10], zy=instruction[9], ny=instruction[8], f=instruction[7], no=instruction[6],
out=ALUout, out=outM, zr=zr, ng=ng);
//★writeMを作成
And(a=instruction[3], b=instruction[15], out=writeM);
//★PCの作成
//1
And(a=ng, b=instruction[2], out=jump1);
And(a=zr, b=instruction[1], out=jump2);
Or(a=jump1, b=jump2, out=jump12);
//2
//ngORzr = noz
Or(a=ng, b=zr, out=noz);
//NOTngORzr = nnoz
Not(in=noz, out=nnoz);
And(a=nnoz, b=instruction[0], out=jump3);
//1+2=3
Or(a=jump12, b=jump3, out=jump123);
And(a=jump123, b=instruction[15], out=jl); //jumpload = jl
Not(in=jl, out=pcinc);
PC(in=Adate, inc=pcinc, load=jl, reset=reset, out[0..14]=pc);
}
・memory
CHIP Memory {
IN in[16], load, address[15];
OUT out[16];
PARTS:
//Rload = RAMload | IOload = I/Oload | sIN = scrennIN | kIN = keyboardIN
//Rout = RAMoutvv | sout = screenout | kout = Keybord
DMux(in=load, sel=address[14], a=Rload, b=IOload);
DMux(in=IOload, sel=address[13], a=sIN, b=kIN);
RAM16K(in=in, load=Rload, address=address[0..13], out=Rout);
Screen(in=in, load=sIN, address=address[0..12], out=sout);
Keyboard(out=kout);
Mux16(a=sout, b=kout, sel=address[13], out=IOout);
Mux16(a=Rout, b=IOout, sel=address[14], out=out);
}
・コンピュータ
CHIP Computer {
IN reset;
PARTS:
//★CPU作成
CPU(inM=Mout, instruction=Iout, reset=reset,
writeM=Win,
outM=Oin,
addressM=Addin,
pc=Pin);
//★ROM32K作成
//プログラムカウンタ
ROM32K(address=Pin, out=Iout);
//★Memory作成
Memory(in=Oin, address=Addin, load=Win, out=Mout);
}
Next
6章 アセンブラ
Back
1章 ブール理論
1章 ブール理論(番外編)
2章 ブール算術
3章 順序回路
4章 機械語(前半)
4章 機械語(後半)
5章 コンピュータアーキテクチャ(前半)
・Twitter
https://twitter.com/tango3564
・Instagram
https://www.instagram.com/tango3690/