?? main.cpp
字號:
/************************************************************************
* file name: main.cpp
* description:
*
* modification history
* --------------------
* 2003-8-6, created by zhuwei
*/
/* includes----------------------------------------------------------- */
#include "systemc.h"
/* defines------------------------------------------------------------ */
/* typedefs----------------------------------------------------------- */
SC_MODULE(DFF)
{
sc_in<bool> clk;
sc_in<int> din;
sc_out<int> dout;
void run()
{
dout = din;
cout << dout << endl;
}
// Constructor
SC_CTOR(DFF)
{
SC_METHOD(run);
sensitive_pos << clk;
}
};
struct output: sc_module
{
sc_in<bool> clk;
sc_out<int> dout;
void run()
{
dout = 7;
}
// Constructor
SC_CTOR(output)
{
SC_METHOD(run);
sensitive_pos << clk;
}
};
/* externs------------------------------------------------------------ */
/* globals------------------------------------------------------------ */
/* forward declarations----------------------------------------------- */
int sc_main(int argc, char *argv[])
{
sc_clock clk("clk", 10, SC_NS);
sc_signal<int> din;
sc_signal<int> dout;
output op1("op1");
op1(clk, din);
DFF dff1("dff1");
dff1(clk, din, dout);
sc_trace_file *tf = sc_create_vcd_trace_file("dff");
sc_trace(tf, clk, "clk");
sc_trace(tf, din, "din");
sc_trace(tf, dout, "dout");
sc_start(100, SC_NS);
sc_close_vcd_trace_file(tf);
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -