码迷,mamicode.com
首页 > 其他好文 > 详细

Chisel3 - bind - Binding

时间:2018-12-31 23:44:21      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:ecif   针对   ack   操作   技术   两种   master   font   exception   

 
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。
 
 
 

Chisel3 - bind - Binding

标签:ecif   针对   ack   操作   技术   两种   master   font   exception   

原文地址:https://www.cnblogs.com/wjcdx/p/10203566.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!