简体   繁体   English

一个SC_CTHREAD与另一个SC_CTHREAD之间的通信有一个时钟周期延迟

[英]One clock cycle delay in communication between one SC_CTHREAD and another SC_CTHREAD

I am trying to model a simple direct mapped cache with main memory module which is an sc_cthread and a main memory state machine which also an SC_CTHREAD . 我正在尝试使用一个主内存模块(一个sc_cthread和一个主内存状态机,也就是SC_CTHREAD对一个简单的直接映射缓存进行SC_CTHREAD I am observing one clock cycle delay from writing to a signal from my main memory module and receiving it on state machine. 我观察到从主内存模块写入信号并在状态机上接收到一个时钟周期延迟。

How can I do it in only one clock cycle? 我怎样才能在一个时钟周期内完成?

You cannot avoid the latency between threads when using an SC_CTHREAD. 使用SC_CTHREAD时,您无法避免线程之间的延迟。 When writing to an sc_signal from one CTHREAD, the value change will only be visible to another CTHREAD at the next clock edge. 从一个CTHREAD写入sc_signal时,该值更改仅在下一个时钟沿对另一CTHREAD可见。

If you must use a CTHREAD (ie using high-level synthesis), then the only way to avoid the cross-thread latency is to place both functionalities within a single CTHREAD. 如果必须使用CTHREAD(即使用高级综合),则避免跨线程延迟的唯一方法是将两个功能都放在一个CTHREAD中。

If you only need a behavioral model for simulation, then you could use SC_THREADs and sc_events. 如果仅需要行为模型进行仿真,则可以使用SC_THREADs和sc_events。 One thread can generate an sc_event that is being waited on by the second thread. 一个线程可以生成第二个线程正在等待的sc_event。 When the second thread wakes on that event, it can observe sc_signal changes done by the first thread, and then produce an output (aligned with the clock edge if desired). 当第二个线程在该事件上唤醒时,它可以观察到第一个线程完成的sc_signal变化,然后产生输出(如果需要,与时钟沿对齐)。 Using sc_events gives the opportunity to sample and update signals "between" clock edges. 使用sc_events可以在“时钟”沿之间“采样”和更新信号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM