[116] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Functionnal_unit_genMealy.cpp 123 2009-06-08 20:43:30Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/include/Functionnal_unit.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_execute_loop { |
---|
| 15 | namespace execute_loop { |
---|
| 16 | namespace multi_execute_unit { |
---|
| 17 | namespace execute_unit { |
---|
| 18 | namespace functionnal_unit { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Functionnal_unit::genMealy" |
---|
| 23 | void Functionnal_unit::genMealy (void) |
---|
| 24 | { |
---|
| 25 | log_begin(Functionnal_unit,FUNCTION); |
---|
| 26 | log_function(Functionnal_unit,FUNCTION,_name.c_str()); |
---|
| 27 | |
---|
[117] | 28 | if (PORT_READ(in_NRESET) != 0) |
---|
| 29 | { |
---|
| 30 | { |
---|
[118] | 31 | // Can out if : have an instruction and is finish (latence == 0) |
---|
[117] | 32 | internal_EXECUTE_OUT_VAL = (reg_BUSY_OUT and (_execute_operation_out->_timing._latence == 0)); |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | { |
---|
[118] | 36 | // Can accept an instruction if : |
---|
| 37 | // * pipeline in is not busy (not previous instruction) |
---|
| 38 | // * pipeline in is busy ( previous instruction) and the instruction go to pipeline out |
---|
| 39 | if (_param->_have_pipeline_in) |
---|
| 40 | { |
---|
[117] | 41 | internal_EXECUTE_IN_ACK = (not reg_BUSY_IN or |
---|
| 42 | (reg_BUSY_IN and (not reg_BUSY_OUT or |
---|
| 43 | (internal_EXECUTE_OUT_VAL and PORT_READ(in_EXECUTE_OUT_ACK))))); |
---|
[118] | 44 | } |
---|
| 45 | else |
---|
| 46 | { |
---|
| 47 | internal_EXECUTE_IN_ACK = (not reg_BUSY_OUT or |
---|
| 48 | (internal_EXECUTE_OUT_VAL and PORT_READ(in_EXECUTE_OUT_ACK))); |
---|
| 49 | } |
---|
[117] | 50 | } |
---|
| 51 | } |
---|
[123] | 52 | else |
---|
| 53 | { |
---|
| 54 | // RESET |
---|
| 55 | internal_EXECUTE_IN_ACK = 0; |
---|
| 56 | internal_EXECUTE_OUT_VAL = 0; |
---|
| 57 | } |
---|
[116] | 58 | |
---|
[123] | 59 | // Write Output |
---|
| 60 | PORT_WRITE(out_EXECUTE_IN_ACK , internal_EXECUTE_IN_ACK); |
---|
| 61 | PORT_WRITE(out_EXECUTE_OUT_VAL, internal_EXECUTE_OUT_VAL); |
---|
| 62 | |
---|
[116] | 63 | log_end(Functionnal_unit,FUNCTION); |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | }; // end namespace functionnal_unit |
---|
| 67 | }; // end namespace execute_unit |
---|
| 68 | }; // end namespace multi_execute_unit |
---|
| 69 | }; // end namespace execute_loop |
---|
| 70 | }; // end namespace multi_execute_loop |
---|
| 71 | }; // end namespace core |
---|
| 72 | }; // end namespace behavioural |
---|
| 73 | }; // end namespace morpheo |
---|
| 74 | #endif |
---|