⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 full_adder.h

📁 一个全加器的systemc代码
💻 H
字号:
// full_adder.h

#include "half_adder.h"

SC_MODULE(full_adder){
	sc_in<bool>     a, b, carry_in;
	sc_out<bool>    sum, carry_out;

	sc_signal<bool> c1, s1, c2;

	void prc_or();
	
	half_adder *ha1_ptr, *ha2_ptr;

	SC_CTOR(full_adder){
		ha1_ptr = new half_adder("ha1");
		ha1_ptr -> a(a);
		ha1_ptr -> b(b);
		ha1_ptr -> sum(s1);
		ha1_ptr -> carry(c1);

		ha2_ptr = new half_adder("ha2");
		ha2_ptr -> a(s1);
		ha2_ptr -> b(carry_in);
		ha2_ptr -> sum(sum);
		ha2_ptr -> carry(c1);

		SC_METHOD(prc_or);
		sensitive << c1 << c2;
	}

	// A destructor
	~ full_adder(){
		delete ha1_ptr;
		delete ha2_ptr;
	}
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -