#include "stdsimheader.h" #include "StreamFMAKernel.h" namespace maxcompilersim { StreamFMAKernel::StreamFMAKernel(const std::string &instance_name) : ManagerBlockSync(instance_name), KernelManagerBlockSync(instance_name, 15, 2, 0, 0, "",1) , c_hw_fix_1_0_uns_bits((HWOffsetFix<1,0,UNSIGNED>(varint_u<1>(0x0l)))) , c_hw_fix_32_0_sgn_undef((HWOffsetFix<32,0,TWOSCOMPLEMENT>())) , c_hw_fix_1_0_uns_bits_1((HWOffsetFix<1,0,UNSIGNED>(varint_u<1>(0x1l)))) , c_hw_fix_49_0_uns_bits((HWOffsetFix<49,0,UNSIGNED>(varint_u<49>(0x1000000000000l)))) , c_hw_fix_49_0_uns_bits_1((HWOffsetFix<49,0,UNSIGNED>(varint_u<49>(0x0000000000000l)))) , c_hw_fix_49_0_uns_bits_2((HWOffsetFix<49,0,UNSIGNED>(varint_u<49>(0x0000000000001l)))) { { // Node ID: 22 (NodeInputMappedReg) registerMappedRegister("io_oDataT1_force_disabled", Data(1)); } { // Node ID: 0 (NodeInputMappedReg) registerMappedRegister("io_inAT1_force_disabled", Data(1)); } { // Node ID: 2 (NodeInput) m_inAT1 = registerInput("inAT1",0,5); } { // Node ID: 3 (NodeInputMappedReg) registerMappedRegister("io_inBT1_force_disabled", Data(1)); } { // Node ID: 5 (NodeInput) m_inBT1 = registerInput("inBT1",1,5); } { // Node ID: 25 (NodeOutput) m_oDataT1 = registerOutput("oDataT1",0 ); } { // Node ID: 27 (NodeInputMappedReg) registerMappedRegister("io_oDataT2_force_disabled", Data(1)); } { // Node ID: 6 (NodeInputMappedReg) registerMappedRegister("io_inAT2_force_disabled", Data(1)); } { // Node ID: 8 (NodeInput) m_inAT2 = registerInput("inAT2",2,5); } { // Node ID: 9 (NodeInputMappedReg) registerMappedRegister("io_inBT2_force_disabled", Data(1)); } { // Node ID: 11 (NodeInput) m_inBT2 = registerInput("inBT2",3,5); } { // Node ID: 30 (NodeOutput) m_oDataT2 = registerOutput("oDataT2",1 ); } { // Node ID: 32 (NodeInputMappedReg) registerMappedRegister("io_oDataT3_force_disabled", Data(1)); } { // Node ID: 12 (NodeInputMappedReg) registerMappedRegister("io_inAT3_force_disabled", Data(1)); } { // Node ID: 14 (NodeInput) m_inAT3 = registerInput("inAT3",4,5); } { // Node ID: 15 (NodeInputMappedReg) registerMappedRegister("io_inBT3_force_disabled", Data(1)); } { // Node ID: 17 (NodeInput) m_inBT3 = registerInput("inBT3",5,5); } { // Node ID: 35 (NodeOutput) m_oDataT3 = registerOutput("oDataT3",2 ); } { // Node ID: 40 (NodeConstantRawBits) id40out_value = (c_hw_fix_1_0_uns_bits_1); } { // Node ID: 50 (NodeConstantRawBits) id50out_value = (c_hw_fix_1_0_uns_bits_1); } { // Node ID: 37 (NodeConstantRawBits) id37out_value = (c_hw_fix_49_0_uns_bits); } { // Node ID: 41 (NodeOutputMappedReg) registerMappedRegister("current_run_cycle_count", Data(48), true); } { // Node ID: 49 (NodeConstantRawBits) id49out_value = (c_hw_fix_1_0_uns_bits_1); } { // Node ID: 43 (NodeConstantRawBits) id43out_value = (c_hw_fix_49_0_uns_bits); } { // Node ID: 46 (NodeInputMappedReg) registerMappedRegister("run_cycle_count", Data(48)); } } void StreamFMAKernel::resetComputation() { resetComputationAfterFlush(); } void StreamFMAKernel::resetComputationAfterFlush() { { // Node ID: 22 (NodeInputMappedReg) id22out_io_oDataT1_force_disabled = getMappedRegValue >("io_oDataT1_force_disabled"); } { // Node ID: 0 (NodeInputMappedReg) id0out_io_inAT1_force_disabled = getMappedRegValue >("io_inAT1_force_disabled"); } { // Node ID: 2 (NodeInput) (id2st_read_next_cycle) = (c_hw_fix_1_0_uns_bits); (id2st_last_read_value) = (c_hw_fix_32_0_sgn_undef); } { // Node ID: 3 (NodeInputMappedReg) id3out_io_inBT1_force_disabled = getMappedRegValue >("io_inBT1_force_disabled"); } { // Node ID: 5 (NodeInput) (id5st_read_next_cycle) = (c_hw_fix_1_0_uns_bits); (id5st_last_read_value) = (c_hw_fix_32_0_sgn_undef); } { // Node ID: 27 (NodeInputMappedReg) id27out_io_oDataT2_force_disabled = getMappedRegValue >("io_oDataT2_force_disabled"); } { // Node ID: 6 (NodeInputMappedReg) id6out_io_inAT2_force_disabled = getMappedRegValue >("io_inAT2_force_disabled"); } { // Node ID: 8 (NodeInput) (id8st_read_next_cycle) = (c_hw_fix_1_0_uns_bits); (id8st_last_read_value) = (c_hw_fix_32_0_sgn_undef); } { // Node ID: 9 (NodeInputMappedReg) id9out_io_inBT2_force_disabled = getMappedRegValue >("io_inBT2_force_disabled"); } { // Node ID: 11 (NodeInput) (id11st_read_next_cycle) = (c_hw_fix_1_0_uns_bits); (id11st_last_read_value) = (c_hw_fix_32_0_sgn_undef); } { // Node ID: 32 (NodeInputMappedReg) id32out_io_oDataT3_force_disabled = getMappedRegValue >("io_oDataT3_force_disabled"); } { // Node ID: 12 (NodeInputMappedReg) id12out_io_inAT3_force_disabled = getMappedRegValue >("io_inAT3_force_disabled"); } { // Node ID: 14 (NodeInput) (id14st_read_next_cycle) = (c_hw_fix_1_0_uns_bits); (id14st_last_read_value) = (c_hw_fix_32_0_sgn_undef); } { // Node ID: 15 (NodeInputMappedReg) id15out_io_inBT3_force_disabled = getMappedRegValue >("io_inBT3_force_disabled"); } { // Node ID: 17 (NodeInput) (id17st_read_next_cycle) = (c_hw_fix_1_0_uns_bits); (id17st_last_read_value) = (c_hw_fix_32_0_sgn_undef); } { // Node ID: 38 (NodeCounter) (id38st_count) = (c_hw_fix_49_0_uns_bits_1); } { // Node ID: 44 (NodeCounter) (id44st_count) = (c_hw_fix_49_0_uns_bits_1); } { // Node ID: 46 (NodeInputMappedReg) id46out_run_cycle_count = getMappedRegValue >("run_cycle_count"); } } void StreamFMAKernel::updateState() { { // Node ID: 22 (NodeInputMappedReg) id22out_io_oDataT1_force_disabled = getMappedRegValue >("io_oDataT1_force_disabled"); } { // Node ID: 0 (NodeInputMappedReg) id0out_io_inAT1_force_disabled = getMappedRegValue >("io_inAT1_force_disabled"); } { // Node ID: 3 (NodeInputMappedReg) id3out_io_inBT1_force_disabled = getMappedRegValue >("io_inBT1_force_disabled"); } { // Node ID: 27 (NodeInputMappedReg) id27out_io_oDataT2_force_disabled = getMappedRegValue >("io_oDataT2_force_disabled"); } { // Node ID: 6 (NodeInputMappedReg) id6out_io_inAT2_force_disabled = getMappedRegValue >("io_inAT2_force_disabled"); } { // Node ID: 9 (NodeInputMappedReg) id9out_io_inBT2_force_disabled = getMappedRegValue >("io_inBT2_force_disabled"); } { // Node ID: 32 (NodeInputMappedReg) id32out_io_oDataT3_force_disabled = getMappedRegValue >("io_oDataT3_force_disabled"); } { // Node ID: 12 (NodeInputMappedReg) id12out_io_inAT3_force_disabled = getMappedRegValue >("io_inAT3_force_disabled"); } { // Node ID: 15 (NodeInputMappedReg) id15out_io_inBT3_force_disabled = getMappedRegValue >("io_inBT3_force_disabled"); } { // Node ID: 46 (NodeInputMappedReg) id46out_run_cycle_count = getMappedRegValue >("run_cycle_count"); } } void StreamFMAKernel::preExecute() { { // Node ID: 2 (NodeInput) if(((needsToReadInput(m_inAT1))&(((getFlushLevel())<((4l)+(5)))|(!(isFlushingActive()))))) { (id2st_last_read_value) = (readInput >(m_inAT1)); } id2out_data = (id2st_last_read_value); } { // Node ID: 5 (NodeInput) if(((needsToReadInput(m_inBT1))&(((getFlushLevel())<((4l)+(5)))|(!(isFlushingActive()))))) { (id5st_last_read_value) = (readInput >(m_inBT1)); } id5out_data = (id5st_last_read_value); } { // Node ID: 8 (NodeInput) if(((needsToReadInput(m_inAT2))&(((getFlushLevel())<((4l)+(5)))|(!(isFlushingActive()))))) { (id8st_last_read_value) = (readInput >(m_inAT2)); } id8out_data = (id8st_last_read_value); } { // Node ID: 11 (NodeInput) if(((needsToReadInput(m_inBT2))&(((getFlushLevel())<((4l)+(5)))|(!(isFlushingActive()))))) { (id11st_last_read_value) = (readInput >(m_inBT2)); } id11out_data = (id11st_last_read_value); } { // Node ID: 14 (NodeInput) if(((needsToReadInput(m_inAT3))&(((getFlushLevel())<((4l)+(5)))|(!(isFlushingActive()))))) { (id14st_last_read_value) = (readInput >(m_inAT3)); } id14out_data = (id14st_last_read_value); } { // Node ID: 17 (NodeInput) if(((needsToReadInput(m_inBT3))&(((getFlushLevel())<((4l)+(5)))|(!(isFlushingActive()))))) { (id17st_last_read_value) = (readInput >(m_inBT3)); } id17out_data = (id17st_last_read_value); } } void StreamFMAKernel::runComputationCycle() { if (m_mappedElementsChanged) { m_mappedElementsChanged = false; updateState(); std::cout << "StreamFMAKernel: Mapped Elements Changed: Reloaded" << std::endl; } preExecute(); execute0(); } int StreamFMAKernel::getFlushLevelStart() { return ((1l)+(3l)); } }