Commit 945a6d6c authored by winckel's avatar winckel
Browse files

Modified VCD format for variables.

Modified some ITTI VCD log points.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4555 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent c67aafd2
......@@ -292,6 +292,10 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
message_number_t message_number;
uint32_t message_id;
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG, 1L << destination_task_id);
#endif
DevAssert(message != NULL);
DevCheck(destination_task_id < itti_desc.task_max, destination_task_id, itti_desc.task_max, 0);
......@@ -305,11 +309,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
origin_task_id = ITTI_MSG_ORIGIN_ID(message);
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
destination_task_id);
#endif
priority = itti_get_message_priority (message_id);
/* Increment the global message number */
......@@ -329,6 +328,10 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
if (destination_task_id != TASK_UNKNOWN)
{
#if defined(RTAI)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE, VCD_FUNCTION_IN);
#endif
/* We cannot send a message if the task is not running */
DevCheck(itti_desc.threads[destination_thread_id].task_state == TASK_STATE_READY, itti_desc.threads[destination_thread_id].task_state,
TASK_STATE_READY, destination_thread_id);
......@@ -345,6 +348,10 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
/* Enqueue message in destination task queue */
lfds611_queue_enqueue(itti_desc.tasks[destination_task_id].message_queue, new);
#if defined(RTAI)
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE, VCD_FUNCTION_OUT);
#endif
#ifdef RTAI
if (itti_desc.threads[TASK_GET_THREAD_ID(origin_task_id)].real_time)
{
......@@ -376,8 +383,7 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
}
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG_END,
destination_task_id);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG, 0);
#endif
return 0;
......@@ -520,14 +526,12 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t
void itti_receive_msg(task_id_t task_id, MessageDef **received_msg)
{
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
task_id);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG, 0);
#endif
itti_receive_msg_internal_event_fd(task_id, 0, received_msg);
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG_END,
task_id);
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG, 1L << task_id);
#endif
}
......@@ -538,8 +542,7 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg) {
*received_msg = NULL;
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
task_id);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG, 1L << task_id);
#endif
{
......@@ -557,8 +560,7 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg) {
}
#if defined(OAI_EMU) || defined(RTAI)
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG_END,
task_id);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG, 0);
#endif
}
......
......@@ -81,11 +81,8 @@ const char* eurecomVariablesNames[] = {
"daq_mbox",
"diff2",
"itti_send_msg",
"itti_send_msg_end",
"itti_poll_msg",
"itti_poll_msg_end",
"itti_recv_msg",
"itti_recv_msg_end",
"itti_alloc_msg"
};
......@@ -161,12 +158,13 @@ const char* eurecomFunctionsNames[] = {
"phy_eNB_dlsch_scramblig",
"pdcp_apply_security",
"pdcp_validate_security",
"itti_enqueue_message",
"itti_dump_enqueue_message",
"test"
};
struct vcd_module_s vcd_modules[VCD_SIGNAL_DUMPER_MODULE_END] = {
{ "variables", VCD_SIGNAL_DUMPER_VARIABLES_END, eurecomVariablesNames, VCD_REAL, 64 },
{ "variables", VCD_SIGNAL_DUMPER_VARIABLES_END, eurecomVariablesNames, VCD_WIRE, 64 },
{ "functions", VCD_SIGNAL_DUMPER_FUNCTIONS_END, eurecomFunctionsNames, VCD_WIRE, 1 },
// { "ue_procedures_functions", VCD_SIGNAL_DUMPER_UE_PROCEDURES_FUNCTIONS_END, eurecomUEFunctionsNames, VCD_WIRE, 1 },
};
......@@ -205,9 +203,65 @@ typedef struct {
struct lfds611_queue_state *vcd_queue = NULL;
pthread_t vcd_dumper_thread;
#define BYTE_SIZE 8
#define NIBBLE_SIZE 4
static void uint64_to_binary(uint64_t value, char *binary)
{
static const char * const nibbles_start[] =
{
"", "1", "10", "11",
"100", "101", "110", "111",
"1000", "1001", "1010", "1011",
"1100", "1101", "1110", "1111",
};
static const char * const nibbles[] =
{
"0000", "0001", "0010", "0011",
"0100", "0101", "0110", "0111",
"1000", "1001", "1010", "1011",
"1100", "1101", "1110", "1111",
};
int nibble;
int nibble_value;
int nibble_size;
int zero = 1;
for (nibble = 0; nibble < (sizeof (uint64_t) * (BYTE_SIZE / NIBBLE_SIZE)); nibble++)
{
nibble_value = value >> ((sizeof (uint64_t) * BYTE_SIZE) - NIBBLE_SIZE);
if (zero)
{
if (nibble_value > 0)
{
zero = 0;
nibble_size = strlen(nibbles_start[nibble_value]);
memcpy (binary, nibbles_start[nibble_value], nibble_size);
binary += nibble_size;
}
}
else
{
memcpy (binary, nibbles[nibble_value], NIBBLE_SIZE);
binary += NIBBLE_SIZE;
}
value <<= NIBBLE_SIZE;
}
/* Add a '0' if the value was null */
if (zero)
{
binary[0] = '0';
binary ++;
}
/* Add a null value at the end of the string */
binary[0] = '\0';
}
void *vcd_dumper_thread_rt(void *args)
{
vcd_queue_user_data_t *data;
char binary_string[(sizeof (uint64_t) * BYTE_SIZE) + 1];
while(1) {
if (lfds611_queue_dequeue(vcd_queue, (void **) &data) == 0) {
/* No element -> sleep a while */
......@@ -221,7 +275,8 @@ void *vcd_dumper_thread_rt(void *args)
variable_name = (int)data->data.variable.variable_name;
fprintf(vcd_fd, "#%llu\n", data->time);
/* Set variable to value */
fprintf(vcd_fd, "r%lu %s_r\n", data->data.variable.value,
uint64_to_binary(data->data.variable.value, binary_string);
fprintf(vcd_fd, "b%s %s_w\n", binary_string,
eurecomVariablesNames[variable_name]);
}
break;
......@@ -393,7 +448,12 @@ void vcd_signal_dumper_create_header(void)
const char *signal_name;
signal_name = module->signals_names[j];
if (VCD_WIRE == module->signal_type) {
fprintf(vcd_fd, "0%s_w $end\n", signal_name);
if (module->signal_size > 1) {
fprintf(vcd_fd, "b0 %s_w $end\n", signal_name);
}
else {
fprintf(vcd_fd, "0%s_w $end\n", signal_name);
}
} else if (VCD_REAL == module->signal_type) {
fprintf(vcd_fd, "r0 %s_r $end\n", signal_name);
} else {
......@@ -426,6 +486,8 @@ void vcd_signal_dumper_dump_variable_by_name(vcd_signal_dump_variables variable_
new_data->data.variable.value = value;
lfds611_queue_enqueue(vcd_queue, new_data);
#else
char binary_string[(sizeof (uint64_t) * BYTE_SIZE) + 1];
assert(variable_name < VCD_SIGNAL_DUMPER_VARIABLES_END);
assert(variable_name >= 0);
......@@ -434,7 +496,8 @@ void vcd_signal_dumper_dump_variable_by_name(vcd_signal_dump_variables variable_
vcd_signal_dumper_print_time_since_start();
/* Set variable to value */
fprintf(vcd_fd, "r%lu %s_r\n", value, eurecomVariablesNames[variable_name]);
uint64_to_binary(value, binary_string);
fprintf(vcd_fd, "b%s %s_w\n", binary_string, eurecomVariablesNames[variable_name]);
//fflush(vcd_fd);
}
#endif
......
......@@ -50,11 +50,8 @@ typedef enum
VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX,
VCD_SIGNAL_DUMPER_VARIABLES_DIFF,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG_END,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG_END,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG_END,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_ALLOC_MSG,
VCD_SIGNAL_DUMPER_VARIABLES_LAST,
VCD_SIGNAL_DUMPER_VARIABLES_END = VCD_SIGNAL_DUMPER_VARIABLES_LAST,
......@@ -133,6 +130,7 @@ typedef enum
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE,
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE,
VCD_SIGNAL_DUMPER_FUNCTIONS_TEST,
VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment