编 者 按
来看下pipeline中haltit的用法
haltit看名字,就基本能猜到这个函数的大体功能是流水线暂停。
在stage中,流水线暂停提供了这么几个api:
def haltit()(implicit loc: location) : unit = haltit(conditionalcontext.istrue)def haltit(cond : bool)(implicit loc: location) : unit = internals.request.halts += namefromlocation(combinit(cond), haltrequest)def haltwhen(cond : bool)(implicit loc: location) : unit = haltit(cond)三个api最终所实现的都是往internals.request.halts中添加cond条件。那么就看下request.halts在pipeline构建时所起的作用。
首先,在进行 connectionswithoutsinks(没有驱动其他级stage)往前遍历的函数propagaterequirements中:
if(stage.request.halts.nonempty){ stage.arbitration.propagateready = true stage.isready //force creation}可以看到,如果stage中的internals.request.halts非空,这里做了两件事:
stage.arbitration.propagateready设置为true,即需向前级stage传递ready信号为本级创建input.ready信号随后在propagaterequirements中的代码片段:
stagedriver.get(stage) match { case some(c : connectionmodel) = > { if(c.s.arbitration.propagateready && c.m.output.ready == null){ c.m.output.ready = bool() if(c.m.input.ready == null){ c.m.input.ready = bool() } }这里在处理当前stage中的connectionlogic时,因为当前stage.arbitration.propagateready为true,如果驱动当前stage的master stage的output.ready为空,那么这里就会确保master stage中具备input.ready以及output.ready,确保上级stage具备这种握手机制。
而后在该函数中的递归调用:
for(m < - stagemasters(stage)){ if(stage.internals.arbitration.propagateready) m.internals.arbitration.propagateready = true propagaterequirements(m)}这里如果当前stage如果存在stage.arbitration.propagateready为true,那么也会设置其master stage的.arbitration.propagateready为true,通过递归调用,确保整个链路上ready信号一直向前传播,即确保反压一路到底。
最后,在处理stage internal connection阶段时:
if(s.request.halts.nonempty){ val dohalt = s.request.halts.orr when(dohalt){ s.input.ready := false s.output.valid := false }}如果当前stage中request.halts中条件满足,那么当前stage中的output.valid,input.ready信号将会统一拉低,从而暂停向下级传输。
examplecase class test8() extends component{ val io=new bundle{ val data_in=slave(stream(uint(8 bits))) val data_out=master(stream(uint(8 bits))) val cond=in bool() } noioprefix() val a=stageable(uint(8 bits)) val pip=new pipeline{ val stage0=new stage{ this.drivefrom(io.data_in) a:=io.data_in.payload } val stage1=new stage(connection.m2s()){ } val stage2=new stage(connection.m2s()){ io.data_out.valid:=this.internals.output.valid io.data_out.payload:=a internals.output.ready=bool() this.haltit(io.cond) internals.output.ready:=io.data_out.ready this.internals.arbitration.propagateready=true } } pip.build()}这里给出了一个haltit的example。在staeg2阶段,如果cond为true,那么则流水线暂停。
这里需注意的是这里将stage2的output.ready由io.data_out.ready信号进行驱动,但output.ready信号是默认不会创建的,故这里显示创建internals.output.ready为bool类型电路对象。
浅析硅碳负极材料在锂离子电池中的应用
集成智能第2部分:电机启动开环加速
2023网络与边缘产业高层峰会:英特尔携行业伙伴解锁网络与边缘无限潜能
调用机智云API,实现网页控制物联网别踩白块游戏在STM32上同步显示
基于数字PLL和DSP的调频FM发射器架构研究
pipeline高端玩法—haltIt介绍(九)
工业物联网解决方案:精梳机远程云组态监控平台
基于人工智能视觉问答技术的人机协作数字孪生模型仿真方案
嵌入式模块板卡BGA芯片胶底部填充胶应用
NVIDIA最新版GRD驱动,新增三款游戏的支持
奥比中光旗下公司新拓三维发布国内首台管件光学3D检测设备
低噪声四通道吉他混音电路
电量计算公式多少度电 电量和度数怎么换算
基于电流测试的混合电路故障诊断
力邀Nvidia老将加盟,三星GPU的目标不止手机
BP3187EB 是一款高精度的两绕组、低PF原边反馈恒流驱动器
温度代码迁移
纪念版锐龙72700X日本上架 售价约合人民币2470元
阿里巴巴集团宣布,“双11”的销售额再创新高
dfrobotFT232USB转TTL串口线简介