📄 sc.cpp
字号:
#include <systemc.h>
#include "ALU32.h"
int sc_main(int, char**)
{
sc_signal <bool> na[32], nb[32], s[4];
sc_signal <bool> m, c_;
sc_signal <bool> nf[32];
sc_signal <bool> np[2], ng[2], c31;
ALU32 h("Alu32");
h.m(m);
h.c_(c_);
h.np_[0](np[0]); h.np_[1](np[1]);
h.ng_[0](ng[0]); h.ng_[1](ng[1]);
h.c31(c31);
m = 0; c_ = 0;
for(int i=0; i<16; i++)
{
na[i] = 1; nb[i] = 0;
h.na[i](na[i]); h.nb[i](nb[i]); h.nf[i](nf[i]);
}
for(int i=16; i<32; i++)
{
na[i] = 0; nb[i] = 1;
h.na[i](na[i]); h.nb[i](nb[i]); h.nf[i](nf[i]);
}
na[14] = 0; nb[16] = 0;
na[15] = 0; nb[17] = 0;
for(int i=0; i<4; i++)
{
h.s[i](s[i]);
}
for(int a = 0; a < 16; a++)
{
int ts = a;
for(int i=0; i<4; i++)
{
s[i] = ts % 2;
ts /= 2;
}
sc_start(-1);
cout<<h.c31<<" "<<h.np_[1]<<h.ng_[1]<<h.np_[0]<<h.ng_[0]<<endl;
for(int i=31; i>=0; i--)
{
cout<<!h.nf[i];
if(i%4==0)cout<<"'";
}
cout<<endl;
for(int i=31; i>=0; i--)
{
cout<<!h.na[i];
if(i%4==0)cout<<"'";
}
cout<<endl;
for(int i=31; i>=0; i--)
{
cout<<!h.nb[i];
if(i%4==0)cout<<"'";
}
cout<<endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -