I'm trying to monitor a number of inputs reacting to an output using a procedure, this procedure has as parameters 4 inputs :
- signal
INPUTS_OUTPUT which is an array of my inputs and output (Std_logic)
-
EXPECTED_VALUE which represent respectively the expected value of my inputs during
MONITORING_TIME and the expected value of my output in the start of monitoring and finally the expected value of my output in the end of monitoring time .(
always EXPECTED_VALUE'length = INPUTS_OUTPUT'length +1 ).
-
INPUTS_OUTPUT_NAME which is an array of STRING(1 TO 32) to represent the respective name of my inputs and output.
-
MONITORING_TIME which represent the time of the call to procedure.
The array is unconstrained and I can enter a number none limited of inputs+output to my procedure.
My type definitions and constant definition are :
CONSTANT N
OSITIVE := 4;
TYPE data_record IS ARRAY (natural range <>) OF STD_LOGIC;
TYPE data_name_record IS ARRAY(natural range <>) OF STRING(1 TO 32);
My procedure is :
Code:
---------------- BODY OF PROCEDURE ----------------
PROCEDURE MONITORING_VALUE(
SIGNAL INPUTS_OUTPUT : IN data_record ;
EXPECTED_VALUE : IN data_record ;
INPUTS_OUTPUT_NAME : IN data_name_record;
MONITORING_TIME : IN TIME
) IS
BEGIN
WAIT FOR 0 ns ;
---------------- BEGINNING CHECK OF OUTPUT ----------------
NOTE("Expected value of "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" is: "&conv_str(EXPECTED_VALUE(EXPECTED_VALUE'RIGHT - 1))
&" in the time "&conv_str(NOW));
NOTE("Observed value of "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" is: "&conv_str(INPUTS_OUTPUT(INPUTS_OUTPUT'RIGHT))
&" in the time "&conv_str(NOW));
IF (INPUTS_OUTPUT(INPUTS_OUTPUT'RIGHT) = EXPECTED_VALUE(EXPECTED_VALUE'RIGHT - 1)) THEN
pass_req(sig_test_cnt,sig_pass_cnt, "The Check of output "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" is PASSED");
ELSE
fail_req(sig_test_cnt,sig_fail_cnt, "The Check of output "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" is FAILED");
END IF;
-------------------------------------------------------------------------
---------------- BEGINNING CHECK OF INPUTS ----------------
FOR i IN 1 to INPUTS_OUTPUT'LENGTH - 1 LOOP
NOTE("Observed value of "&(INPUTS_OUTPUT_NAME(i))&" is: "&conv_str(INPUTS_OUTPUT(i))
&" in the time "&conv_str(NOW));
IF (INPUTS_OUTPUT(i) = EXPECTED_VALUE(i)) THEN
pass_req(sig_test_cnt,sig_pass_cnt, "The Check of input "&(INPUTS_OUTPUT_NAME(i))&" is PASSED");
ELSE
fail_req(sig_test_cnt,sig_fail_cnt, "The Check of input "&(INPUTS_OUTPUT_NAME(i))&" is FAILED");
END IF;
END LOOP;
-------------------------------------------------------------------------
---------------- MONITORING OF INPUTS ----------------
T_START := NOW;
WAIT UNTIL INPUTS_OUTPUT'EVENT FOR MONITORING_TIME;
T_END := NOW;
IF ( NOT(INPUTS_OUTPUT'EVENT) ) THEN
pass_req(sig_test_cnt,sig_pass_cnt, "The monitoring have been done successfully <PASSED>");
ELSE
fail_req(sig_test_cnt,sig_fail_cnt, "The monitoring have been failed <FAILED>");
END IF;
--------------------------------------------------------------------------
---------------- CHECK OF STABILITY OF THE INPUTS DURING MONITORING TIME ----------------
FOR i IN 1 to INPUTS_OUTPUT'LENGTH - 1 LOOP
NOTE("Observed value of "&(INPUTS_OUTPUT_NAME(i))&" is: "&conv_str(INPUTS_OUTPUT(i))
&" during at least "&conv_str(T_END - T_START));
IF (INPUTS_OUTPUT(i) = EXPECTED_VALUE(i)) THEN
pass_req(sig_test_cnt,sig_pass_cnt, "The Check of input " &INPUTS_OUTPUT_NAME(i)&" is PASSED");
ELSE
fail_req(sig_test_cnt,sig_fail_cnt, "The Check of input " &INPUTS_OUTPUT_NAME(i)&" is FAILED");
END IF;
END LOOP;
------------------------------------------------------------------------------------------------
---------------- FINAL CHECK OF OUTPUT ----------------
NOTE("Expected value of "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" is: "&conv_str(EXPECTED_VALUE(EXPECTED_VALUE'RIGHT))
&" in the time "&conv_str(T_END));
NOTE("Observed value of "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" is: "&conv_str(INPUTS_OUTPUT(INPUTS_OUTPUT'RIGHT))
&" in the time "&conv_str(T_END));
IF (INPUTS_OUTPUT(INPUTS_OUTPUT'RIGHT) = EXPECTED_VALUE(EXPECTED_VALUE'RIGHT)) THEN
pass_req(sig_test_cnt,sig_pass_cnt, "The Check of output "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" is PASSED");
ELSE
fail_req(sig_test_cnt,sig_fail_cnt, "The Check of output "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" is FAILED");
END IF;
NOTE("Last change on output "&INPUTS_OUTPUT_NAME(INPUTS_OUTPUT_NAME'RIGHT)&" have been occured at least "&conv_str(INPUTS_OUTPUT(INPUTS_ENTRED'RIGHT)'LAST_EVENT));
----------------------------------------------------------------------
END PROCEDURE;
P.S. pass_req and fail_req are procedures defined in a package which help to display in simulation file result the status of the check
the same for sig_test_cnt,sig_test_cnt and sig_pass_cnt which are variables which help to count number of checks and also pass and failed checks to compared to the total of check.
In my testbench, i'm calling my procedure
Code:
INPUTS_ENTRED(0) <= CBIT_MUX13_FAILURE_spy;
INPUTS_ENTRED(1) <= CONT_1_FUSE_ST_SPY ;
INPUTS_ENTRED(2) <= in_duv_data.sig_XBDC;
INPUTS_ENTRED(3) <= BDC_DSO_FAILURE_spy;
MONITORING_VALUE(INPUTS_ENTRED,('0','1','0','0','0'),
("CBIT_MUX13_FAILURE_spy ","CONT_1_FUSE_ST ",
"out_XBDC ","BDC_DSO_FAILURE_spy "),
TCONF_BDC_DSO_FAILURE_max);
With
Code:
SIGNAL INPUTS_ENTRED : data_record(0 TO 3);
Now i'm trying to solve this issue : when I assign my inputs+output to a signal , the change on them are not detected because they are not mapped to my signal
INPUT_ENTRED , HOW can I enter my signal of type data_record corresponding to INPUTS_OUTPUT parameter and my procedure keep reading dynamically its value .
P.S I have issue with LAST_EVENT been used in procedure with INPUTS_ENTRED'length instead of INPUTS_OUTPUT'length because of INPUT_OUTPUT is unconstrained, but that can be ignored.