Chisel3 - bind - Binding

 
Chisel数据类型(Data)与Module的绑定关系,根据Data的使用方式不同,而有多种绑定类型。
 
参考链接:
 
1. Binding
 
类型继承图如下:
其中:
a. interface指代traint;
b. 箭头意思为继承(extends);
 
可以看到这些绑定中,有:
a. 受控(constrained)和不受控的绑定;
b. 只读绑定;
c. 顶层绑定、子绑定;
d. 直连(Wire)绑定和寄存器(Reg)绑定;
e. 字面量(Literal)绑定,操作绑定;
f. 还有不关心(DontCare)的绑定;
 
2. 绑定相关的异常
 
分别为:
a. ExpectedChiselTypeException: A function expected a Chisel type but got a hardware object
b. ExpectedHardwareException: A function expected a hardware object but got a Chisel type
c. MixedDirectionAggregateException: An aggregate had a mix of specified and unspecified directionality children
d. RebindingException: Attempted to re-bind an already bound (directionality or hardware) object
 
 
3. requireIsHardware vs. requireIsChiselType
 
Hardware跟Chisel type并不是互斥的。事实上,两者都是针对类Data而言的。差别只在于是否绑定。
 
Data是Chisel中的基本数据类型,Bits/SInt/UInt/Bool/Aggregate都是其子类。这些数据变量(variable)的容器只有两种:线和寄存器。如果把数据变量放到容器中,连接到hardware graph中,这个数据变量就是hardware的一部分,requireIsHardware(dataVariable)就是真。反之,如果Data类型的数据变量只是一个变量,而没有连接到hardware graph中,则就只是一个孤立的chisel type的数据变量,而非hardware的一部分。
 
所以,这两个命名实际上并不贴切,反而注释里面就很好,requireIsBound/requireIsUnBound,或者更详细一点,requireIsBoundIntoHardwareGraph/requireIsNotBoundIntoHardwareGraph。
 
 
 

猜你喜欢

转载自www.cnblogs.com/wjcdx/p/10203566.html