简体   繁体   English

SystemC中与verilog wire等效的功能是什么?

[英]What is the equivalent in SystemC to verilog wire?

I'm converting some verilog code to SC. 我正在将一些Verilog代码转换为SC。 Here is a case made me confused: In verilog, a continuous assignment such as: 这是一个让我感到困惑的情况:在verilog中,连续的任务如:

wire a;
assign a =1;

Where a will get 1 immediately after the assignment. 分配后,a将立即获得1。 If we write it in SC: 如果我们用SC编写它:

sc_signal<bool> a;
a.write(1);

The current value of a will not be 1. How to resolve this problem? a的当前值将不是1。如何解决此问题? Like the following? 像下面吗?

bool a;
a = 1;

In Verilog, you are not guaranteed to read the updated value of a continuous assignment if you are changing the RHS and reading the LHS in two different processes synchronized to the same time. 在Verilog中,如果要在同时同步的两个不同过程中更改RHS和读取LHS,则不能保证读取连续分配的更新值。 You need to use a non-blocking assignment to avoid a race condition. 您需要使用非阻塞分配来避免竞争情况。

In SystemC, the write() method is similar to a non-blocking assignment. 在SystemC中, write()方法类似于非阻塞分配。 The difference is that you are required to use the write() method in SystemC. 区别在于您需要在SystemC中使用write()方法。 So .you should only be writing to signals as the output of a thread/process. 因此,您只应将信号写为线程/进程的输出。 If you need to read the signal within the process, then you need to use a variable local to the thread. 如果您需要在过程中读取信号,则需要使用线程本地的变量。

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

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