Skip to content

Instantly share code, notes, and snippets.

@torpedo87
torpedo87 / assembler.md
Created February 25, 2020 12:54
어셈블러

어셈블러

  • 어셈블리 명령의 필드를 분석해서 동일한 의미의 2진코드로 바꾸고 그 코드들을 실제로 하드웨어에서 실행가능한 2진 명령어로 조립
  • 기호 사용 = 변수, 레이블
  • 기호 테이블을 사용해서 기호변환
  • asm -> hack

가정

  • 명령어 1024개짜리 프로그램
  • 명령어들이 단어 하나에 매핑
CHIP Computer {
IN reset;
PARTS:
// Put your code here:
Memory(in=Mout, load=Mwrite, address=address, out=outmem);
CPU(inM=outmem,instruction=instruction, reset=reset, outM=Mout, writeM=Mwrite, addressM=address, pc=pcout);
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?
@torpedo87
torpedo87 / memory.hdl
Last active February 11, 2020 14:35
m
CHIP Memory {
IN in[16], load, address[15];
OUT out[16];
PARTS:
// Put your code here:
//choose RAM if address[13..14] == [0,0] or [0,1]
//choose screen if address[13..14] == [1,0]
//choose KBD if addrss[13..14] == [1,1]
DMux4Way(in=load, sel=address[13..14], a=loadRAM16K1, b=loadRAM16K2, c=loadSCREEN, d=loadKBD);

computer architecture

memory

  • register 들이 모여서 만든 RAM

CPU

(START)
@16383
D=A
@R0
M=D
@KBD
D=M
//if kbd != 0, go to black
@R2
M=0
(LOOP)
@R0
D=M
// R0 <= 0 이면 end
@END
D;JLE
@torpedo87
torpedo87 / sequentiallogic.md
Created December 3, 2019 13:45
sequential logic

time

  • 시간을 integer 의 불연속적인 디지털 단위로 컨버팅
  • delay 는 무시
  • 안정화

flip flop (DFF)

  • 시간을 컨버팅하는 도구
  • Nand 를 사용해서 만들 수 있다
  • flip, flop 으로 두가지 상태를 표현
@torpedo87
torpedo87 / POP.md
Created March 30, 2019 03:12
protocol oriented programming

static dispatch

  • 컴파일 시 찾기
  • 빠르다
  • 프로토콜 자체에 익스텐션으로 이미 구현되어 있는 메소드

dynamic dispatch

  • 런타임 시 v-table 을 통해서 찾기
  • 프로토콜을 준수하기 때문에 컴파일 되나, 내부의 구현 내용은 런타임에 알 수 있다
@torpedo87
torpedo87 / nsfetchedresultscontroller.md
Created March 28, 2019 08:58
nsfetchedresultscontroller

NSFetchedResultsController

  • core data 의 fetched results 를 table view에 효율적으로 나타내기 위해 만든 컨트롤러
  • fetched results 의 wrapper
  • A controller that you use to manage the results of a Core Data fetch request and to display data to the user.
  • needed to synchronize a table view with a data source backed by Core Data.
  • performFetch() : After executing this method, you can access the receiver’s the fetched objects with the property fetchedObjects.
  • requires at least one sort descriptor