?? producer.h
字號(hào):
/************************************************************************
* file name: producer.h
* description:
*
* modification history
* --------------------
* 2003-7-7 19:32:19, created by zhuwei
*/
#ifndef _PRODUCER_H
#define _PRODUCER_H
/* includes----------------------------------------------------------- */
#include "systemc.h"
#include "config.h"
#include "zhuwei_debug.h"
/* defines------------------------------------------------------------ */
/* typedefs----------------------------------------------------------- */
struct producer: sc_module
{
sc_in<bool> clk;
sc_out<bool> reset, wen;
sc_in<bool> fifo_full;
sc_out<int> dout;
// internal variables
int count;
// process function
void write_fifo()
{
while(true)
{
wait();
if(reset.read() || fifo_full.read())
{
wen = false;
continue;
}
assert(CLK_CYCLE > 2);
wait(2, SC_NS);
wen = true;
dout = count++;
wait(CLK_CYCLE-2, SC_NS);
wen = false;
dout = -1;
}
}
void initial()
{
reset = 1;
dout = -1;
wait(CLK_CYCLE * 2, SC_NS);
reset = 0;
}
// Constructor
SC_CTOR(producer): count(0)
{
SC_THREAD(write_fifo);
sensitive_neg << clk;
SC_THREAD(initial);
}
};
/* externs------------------------------------------------------------ */
/* globals------------------------------------------------------------ */
/* forward declarations----------------------------------------------- */
#endif /* _PRODUCER_H */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -