diff options
Diffstat (limited to 'cpu8/cpu_code_reg/cpu_code_reg.hpp')
-rw-r--r-- | cpu8/cpu_code_reg/cpu_code_reg.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cpu8/cpu_code_reg/cpu_code_reg.hpp b/cpu8/cpu_code_reg/cpu_code_reg.hpp new file mode 100644 index 0000000..c48a256 --- /dev/null +++ b/cpu8/cpu_code_reg/cpu_code_reg.hpp @@ -0,0 +1,39 @@ +#ifndef __SYSC_CPU_CODE_REG_HPP +#define __SYSC_CPU_CODE_REG_HPP + +#include "systemc.h" +#include "../cpu_and/cpu_and.hpp" +#include "../cpu_not/cpu_not.hpp" +#include "../cpu_srlatch/cpu_srlatch.hpp" + +SC_MODULE (cpu_code_reg) +{ + //Inputs + sc_port<sc_signal_in_if<bool>,0> in_d; + sc_port<sc_signal_in_if<bool>,0> in_e; + //Outputs + sc_port<sc_signal_out_if<bool>,0> out_q; + //Internal variables + bool bit=false; + + void do_code_reg() + { + //if enabled + if (in_e[0]->read()) + { + //set data + bit = in_d[0]->read(); + } + //no delay + out_q[0]->write(bit); + } + + SC_CTOR(cpu_code_reg) + { + SC_METHOD(do_code_reg); + sensitive << in_d << in_e; + } + +}; + +#endif
\ No newline at end of file |