【leetcode】
linked lists
1.linked list cycle
2.Intersection of Two Linked Lists
注意点:
1.hash_map 法
nodes_seen=set() ; ; nodes_seen=[]
nodes_seen.add(head) ; ; nodes_seen.append(head)
1.1.head 是ListNode也可以放在set()里
1.2.set() 比list= [] 要快
2.环监测算法
slow=slow.next(乌龟走1步)
fast=fast.next.next(兔子走2步)
【uvm 网课】
1.field automation 域的自动化
`uvm_object_utils_begin(xx)
`uvm_field_xx(xxx,UVM_ALL_ON)
//有助于使用copy/compare/pack/unpack/print等函数
`uvm_object_utils_end
2.copy 和 clone 的区别?
UVM的clone 和SV copy 一样,会创建对象
UVM的copy不创建对象
3.deep copy和shallow copy?
浅copy就是另外开辟内存空间,复制一样的东西,
但是里面嵌套的不会开辟内存,只是用句柄指向;
深copy就是完全复制,开辟内存空间,包括嵌套的一层,需要自己写copy;
uvm的copy是深copy
【computer architecture】
1.Von_Neumann versus Harvard Architecture?
Von: single memory that can hold both data and instructions
Mordern!Harvard: data and instruction are separate in memory/cache
2.little Endian and big Endian
word: 0xDDCCBBAA
0x1000~0x1003: AA BB CC DD(从小到大摆放,little Endian)
0x1000~0x1003: DD CC BB AA(从大到小摆放,big Endian)
3.difference between SRAM and DRAM?
3.1. made of:
DRAM: 1 transistor + 1 capacitor
SRAM:6 transistors
3.2.how to keep the data in the memory?
DRAM:volatile,need regularly refreshed due to leakage
SRAM:need power supplied to retain a value
3.3.speed?
DRAM:refresh cycles
SRAM:no refresh cycles,so fast
3.4.cost:SRAM> DRAM
3.5.density: DRAM> SRAM
4.memory of 256KB==2^8*2^10 Bytes
For each byte, address bits 18 bits
5.10 stages pipeline, 100 data elements, each pipeline is 1ns
Total time taken = (10ns+99ns)=109ns
1 data takes 10ns, others takes 99ns=109ns
6.addressing modes for instruction?
1.immediate mode
2.direct addressing mode
3.register addressing mode
4.indexed addressing mode
【digital circuit】
1.full adder
A+B+Ci =C S
C>=2, C==1; C=AB+Ci(A+B)=AB+Ci(AxorB)
S=A xor B xor Ci; 偶数个数的1就会进位,导致S为0
2.用加法器实现乘法
a:101
b:101
-------------
101
00000
10100
-------------
b的每位1/0遍历,每次a向左shift一位
3.状态机:sequence detector/除法(根据目前余多少来状态转移)/sequence detecor 3b palindrome(每次都shift 1位,存3个,然后判断)
4.moore/mealy machine(与input有关)