📄 74181.h
字号:
#include <systemc.h>
SC_MODULE(a74181)
{
sc_in<bool> na[4];
sc_in<bool> nb[4];
sc_in<bool> s[4];
sc_in<bool> m, c_;
sc_out<bool> nf[4];
sc_out<bool> np, ng;
sc_out<bool> c4, ab_;
void process(void)
{
bool x[4];
bool y[4];
bool tf[4];
bool tp, tg;
x[0] = !((na[0] & nb[0] & s[3]) | (na[0] & !nb[0] & s[2]));
x[1] = !((na[1] & nb[1] & s[3]) | (na[1] & !nb[1] & s[2]));
x[2] = !((na[2] & nb[2] & s[3]) | (na[2] & !nb[2] & s[2]));
x[3] = !((na[3] & nb[3] & s[3]) | (na[3] & !nb[3] & s[2]));
y[0] = !((!nb[0] & s[1]) || (nb[0] & s[0]) || na[0]);
y[1] = !((!nb[1] & s[1]) || (nb[1] & s[0]) || na[1]);
y[2] = !((!nb[2] & s[1]) || (nb[2] & s[0]) || na[2]);
y[3] = !((!nb[3] & s[1]) || (nb[3] & s[0]) || na[3]);
tf[0] = (x[0] ^ y[0]) ^ !(c_ & !m);
tf[1] = (x[1] ^ y[1]) ^ !((y[0] & !m) | (c_ & !m & x[0]));
tf[2] = (x[2] ^ y[2]) ^ !((y[1] & !m) | (c_ & !m & x[0] & x[1]) | (y[0] & x[1] & !m));
tf[3] = (x[3] ^ y[3]) ^ !((y[2] & !m) | (c_ & !m & x[0] & x[1] & x[2]) | (y[0] & x[1] & x[2] & !m) | (y[1] & x[2] & !m));
nf[0] = tf[0];
nf[1] = tf[1];
nf[2] = tf[2];
nf[3] = tf[3];
ab_ = !(tf[0] & tf[1] & tf[2] & tf[3]);
tp = !(x[0] & x[1] & x[2] & x[3]);
tg = !(y[3] | (y[2] & x[3]) | (y[1] & x[2] & x[3]) | (y[0] & x[1] & x[2] & x[3]));
np = tp; ng = tg;
c4 = !((tg & tp) | (!c_ & tg));
}
SC_CTOR(a74181)
{
SC_METHOD(process);
sensitive<<na[0]<<na[1]<<na[2]<<na[3]<<nb[0]<<nb[1]<<nb[2]<<nb[3]<<s[0]<<s[1]<<s[2]<<s[3]<<m<<c_;
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -