【leetcode】
binary tree
1.iteration
2.recursive
3.万事想想None
要点:root.val=xxxx
root.left=TreeNode(0)
root.right=TreeNode(0)
这样return的root就会有很多枝叶,如果是放在recursive 的fun里面再TreeNode(0),就会导致枝叶之间是离散的
3.invert binary tree
要点:def XX(self, root):
self.XX(xx)
4.Binary Tree Inorder Traversal
要点:什么是inorder traversal?
1.recursive:不断地向左or向右穷举,直至触及全部都是None,对比结束的情况
return self.inorderTraversal(root.left)+[root.val]+self.inorderTraversal(root.right)
2.iteration:
1.while node or stack:node 穷举到最左,append 到stack里
2.stack pop出上个最左的,append到result里,node=node.right,进入1
stack 存的是最左
result存的是最左,右侧的最左,右侧,共享的枝干
5.symmetric tree
recursive
【uvm 网课】
1.uvm_object 是核心基类
2.factory
功能
2.1: override
2.2: registration and polymorphism
uvm_component(环境层次,不动产)
uvm_object(验证场景)
如何使用?
1.定义 class xxx extends xxx
2.注册 class register
'uvm_component/object_utils(comp1)
3.构建create object
new(string name='xx', uvm_component parent)
super.new(name, parent);
comp_type::type_id::create(string name, uvm_component parent)
//component 需要层次构建,所以需要parent,底层勾住上一层,这样就能将整个uvm结构串接起来
object_type::type_id::create(string name)
【computer architecture】
P6: copy based register renaming
simple but slow
1.value movement too much
2.fanout
RS:op,T(ROB#),T1,T2,V1,V2
Map Table:index是 regfile,entry 是 ROB#
Tag==0,copy value from Regfile
Tag!=0,copy Map Table tag to RS
Tag!=0+,copy value from ROB
CDB
ROB:value
ARF
R10K
RS:op,T,T1,T2
Map Table:index 是register,entry是speculative 的 register
Arch Map:存放实存的physical registers
FreeList:存放空闲physical registers
ROB:ROB#,T,Told
如果成功:T还给arch map,Told还给freelist
如果speculative失败:Told 无所谓,T得还回去:rollback, checkpoint
physical registers(arch map,speculative,freelist)