sc_signal / sc_in / sc_out

sc_signal 继承于 sc_interface和sc_prim_channel;sc_in、sc_out 和sc_inout 都继承于sc_port,并且模板参数N都为1,表明都必须跟一个sc_inerface进行绑定。其中,sc_out 和sc_inout 提供了write 和read 的API,而sc_in只提供了read的API,这些API中,会访问 与之绑定的sc_interface的read/write 函数,比如与sc_signal绑定时,访问的就是sc_signal的read/write 函数。

从用户的角度来看,我们习惯上initiator write,slave read,如下图,我们可以简单理解为,有sc_out -> sc_signal -> sc_in这样的信号传输方向存在。

template <class T> class sc_signal_in_if : virtual public sc_interface
template <class T> class sc_in : public sc_port<sc_signal_in_if<T>,1>

template <class T> class sc_signal_inout_if : public sc_signal_in_if<T> , public sc_signal_write_if<T>
template <class T> class sc_inout : public sc_port<sc_signal_inout_if<T>,1>
template <class T> class sc_out : public sc_inout<T>

template <class T, sc_writer_policy WRITER_POLICY = SC_ONE_WRITER>
class sc_signal : public sc_signal_inout_if<T>, public sc_prim_channel

class sc_clock : public sc_signal<bool>
typedef sc_in<bool> sc_in_clk

 总之,sc_in、sc_out 和sc_inout 都属于sc_port的子类。sc_clock / sc_signal / sc_fifo / sc_mutex / sc_event_queue / sc_semaphore 都属于sc_interface 的子类

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
一篇讲Sigma-Delta Audio DAC 的好文章 目录: 1 Introduction 2 A little bit on jitter 2.1 Sampling jitter 2.1.1 Audibility of sample-jitter 2.1.2 Sample jitter susceptibility of DACs 2.1.2.1 Nyquist-DACs 2.1.2.2 Oversampled DACs 2.1.2.3 Delta-sigma modulators 2.1.2.4 Jitter modulation of the sampling clock 2.2 Interface jitter 2.2.1 The AES3/SP-DIF-interface; a cautionary tale 2.3 Measurement of jitter 2.3.1 Intrinsic jitter in device under test 2.3.2 Measurement of jitter transfer function 2.3.3 Data-jitter susceptibility; the J-test 2.4 So now that we know, what can we do about it? 3 The ups and downs of sample-rate conversion 3.1 The sampling process 3.2 Sample rate conversion – the concept 3.3 A short review of oversampling and undersampling 3.4 The arbitrary sample-rate converter 3.5 Requirements for the AASRC 3.5.1 Oversampling ratio L 3.5.2 The oversampling filter 3.5.3 Hold on a moment: 3.6 The frequency tracking unit 3.7 AASRCs and jitter 3.8 Summary: 4 Quantization and dithering; the noise trade 4.1 Bennett’s additive noise approximation 4.2 The characteristic function method 4.2.1 Undithered quantization 4.2.2 Dithered quantization 4.2.3 The dither signal: 4.2.4 Some dither myths resolved: 4.2.5 The output spectrum of the quantizer 4.2.5.1 Non-sampled signals: 4.2.5.2 Sampled signals: 5 The delta-sigma modulator 5.1 The functionality of delta-sigma modulators 5.2 Delta-sigma modulator issues 5.2.1 Idle tone behaviour 5.2.2 Quantizer overloading 5.2.3 Modulator stability 5.3 Multi-loop (MASH) modulators 5.4 Arbitrary NTFs and STFs; optimizing the modulator 5.5 Summary 6 The DAC and dynamic element matching 6.1 Why multibit? 6.2 How multibit 6.3 Get that mismatch in shape 6.4 Second order element dynamic element matching 7 Current State-of-the-Art 7.1 A Stereo 24-bit Audio DAC with 120dB Dynamic Range. 7.1.1 Solutions: 7.1.2 Performance: 7.2 A 126dB DR Current-mode Advanced Segmented DAC 7.2.1 Solutions: 7.2.2 Performance: 7.3 A 120dB Multi-Bit SC Audio DAC with Second
在SystemC中,用于同步和通信的基本元素是事件和过程。事件是用于通知进程发生某些特定事件的信号,而过程则是用于响应事件的代码部分。 sc_event是SystemC中的事件类,它可以用于同步和通信。wait()是SystemC中的方法,它是用于等待事件发生的方法。wait()方法是在进程中使用的,当执行到wait()方法时,进程会阻塞,直到等待的事件被触发。 下面是一个简单的例子,演示了如何使用sc_event和wait()方法进行同步: ``` #include <systemc.h> SC_MODULE(MyModule) { public: sc_in<bool> in; // 输入端口 sc_event event; // 事件 void do_something() { while (true) { // 等待事件 wait(event); // 执行任务 cout << "任务开始执行" << endl; // ... cout << "任务执行完毕" << endl; } } SC_CTOR(MyModule) { // 绑定事件 SC_THREAD(do_something); // 在构造函数中使用SC_METHOD()定义一个方法 // 该方法会在in信号发生变化时触发事件 SC_METHOD(trigger_event); sensitive << in; } void trigger_event() { // 触发事件 event.notify(); } }; int sc_main(int argc, char *argv[]) { // 创建事件和信号 sc_signal<bool> sig; sc_event event; // 创建模块并绑定输入端口和事件 MyModule m("my_module"); m.in(sig); m.event(event); // 在主函数中改变信号状态,触发事件 sig = true; event.notify(); // 等待事件处理完成 sc_start(); return 0; } ``` 在上面的代码中,MyModule模块中定义了一个事件event和一个函数do_something(),该函数在等待事件event,当事件event被触发时,会执行一些任务。在MyModule模块的构造函数中,使用SC_METHOD()定义了一个方法trigger_event(),该方法会在输入信号in发生变化时触发事件event。 在主函数中,创建了一个信号sig和一个事件event,并将它们绑定到MyModule模块的输入端口和事件上。然后,改变信号sig的状态并触发事件event。最后,调用sc_start()方法等待事件处理完成。 注意,在SystemC中,wait()方法只能在SC_THREAD线程中使用,不能在SC_METHOD中使用。同时,wait()方法必须与敏感信号一起使用,以便在信号发生变化时触发等待。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

123axj

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值