Commit f38476ae authored by Cedric Roux's avatar Cedric Roux

import VCD into the T

parent 131b1bda
......@@ -32,6 +32,14 @@
T_LOCAL_size += sizeof(int); \
} while (0)
#define T_PUT_ulong(argnum, val) \
do { \
unsigned long T_PUT_var = (val); \
T_CHECK_SIZE(sizeof(unsigned long), argnum); \
memcpy(T_LOCAL_buf + T_LOCAL_size, &T_PUT_var, sizeof(unsigned long)); \
T_LOCAL_size += sizeof(unsigned long); \
} while (0)
#define T_PUT_float(argnum, val) \
do { \
float T_PUT_var = (val); \
......@@ -535,6 +543,38 @@ extern T_cache_t *T_cache;
#define T30(...) T_CALL_ERROR
#define T32(...) T_CALL_ERROR
/* special cases for VCD logs */
#define T_VCD_VARIABLE(var, val) \
do { \
if (T_ACTIVE(((var) + VCD_FIRST_VARIABLE))) { \
if ((var) > VCD_NUM_VARIABLES) { \
printf("%s:%d:%s: VCD data out of synch for the T, contact" \
" the authors!\n", __FILE__, __LINE__, __FUNCTION__); \
abort(); \
} \
T_LOCAL_DATA \
T_HEADER(T_ID((var) + VCD_FIRST_VARIABLE)); \
T_PUT_ulong(1, (val)); \
T_SEND(); \
} \
} while (0)
#define T_VCD_FUNCTION(fun, val) \
do { \
if (T_ACTIVE(((fun) + VCD_FIRST_FUNCTION))) { \
if ((fun) > VCD_NUM_FUNCTIONS) { \
printf("%s:%d:%s: VCD data out of synch for the T, contact" \
" the authors!\n", __FILE__, __LINE__, __FUNCTION__); \
abort(); \
} \
T_LOCAL_DATA \
T_HEADER(T_ID((fun) + VCD_FIRST_FUNCTION)); \
T_PUT_int(1, (val)); \
T_SEND(); \
} \
} while (0)
#ifndef T_USE_SHARED_MEMORY
#include <stdio.h>
......
......@@ -21,4 +21,16 @@ typedef struct {
#define T_SHM_FILENAME "/T_shm_segment"
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_FUNCTIONS 139
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_VARIABLES 45
/* first VCD function (to be kept up to date! see in T_messages.txt) */
#define VCD_FIRST_FUNCTION ((uintptr_t)T_VCD_FUNCTION_RT_SLEEP)
/* first VCD variable (to be kept up to date! see in T_messages.txt) */
#define VCD_FIRST_VARIABLE ((uintptr_t)T_VCD_VARIABLE_FRAME_NUMBER_TX_ENB)
#endif /* _T_defs_H_ */
This diff is collapsed.
......@@ -36,6 +36,10 @@ event new_event(int type, int length, char *buffer, void *database)
e.e[i].type = EVENT_INT;
e.e[i].i = *(int *)(&buffer[offset]);
offset += 4;
} else if (!strcmp(f.type[i], "ulong")) {
e.e[i].type = EVENT_ULONG;
e.e[i].ul = *(unsigned long *)(&buffer[offset]);
offset += sizeof(unsigned long);
} else if (!strcmp(f.type[i], "string")) {
e.e[i].type = EVENT_STRING;
e.e[i].s = &buffer[offset];
......
......@@ -8,6 +8,7 @@
enum event_arg_type {
EVENT_INT,
EVENT_ULONG,
EVENT_STRING,
EVENT_BUFFER
};
......@@ -17,6 +18,7 @@ typedef struct {
//int offset;
union {
int i;
unsigned long ul;
char *s;
struct {
int bsize;
......
......@@ -10,7 +10,7 @@
enum format_item_type {
INSTRING,
INT, STRING, BUFFER };
INT, ULONG, STRING, BUFFER };
struct format_item {
enum format_item_type type;
......@@ -56,6 +56,7 @@ static void _event(void *p, event e)
switch(l->f[i].type) {
case INSTRING: PUTS(&l->o, l->f[i].s); break;
case INT: PUTI(&l->o, e.e[l->f[i].event_arg].i); break;
case ULONG: PUTUL(&l->o, e.e[l->f[i].event_arg].ul); break;
case STRING: PUTS_CLEAN(&l->o, e.e[l->f[i].event_arg].s); break;
case BUFFER:
PUTS(&l->o, "{buffer size:");
......@@ -86,6 +87,7 @@ static int find_argument(char *name, database_event_format f,
if (i == f.count) return 0;
*event_arg = i;
if (!strcmp(f.type[i], "int")) *it = INT;
else if (!strcmp(f.type[i], "ulong")) *it = ULONG;
else if (!strcmp(f.type[i], "string")) *it = STRING;
else if (!strcmp(f.type[i], "buffer")) *it = BUFFER;
else return 0;
......
......@@ -29,6 +29,7 @@ static void _event(void *p, event e)
subframe = e.e[l->subframe_arg].i;
switch (e.e[l->data_arg].type) {
case EVENT_INT: value = e.e[l->data_arg].i; break;
case EVENT_ULONG: value = e.e[l->data_arg].ul; break;
default: printf("%s:%d: unsupported type\n", __FILE__, __LINE__); abort();
}
......
......@@ -115,3 +115,10 @@ void PUTI(OBUF *o, int i)
sprintf(s, "%d", i);
PUTS(o, s);
}
void PUTUL(OBUF *o, unsigned long l)
{
char s[128];
sprintf(s, "%ld", l);
PUTS(o, s);
}
......@@ -36,5 +36,6 @@ void PUTC(OBUF *o, char c);
void PUTS(OBUF *o, char *s);
void PUTS_CLEAN(OBUF *o, char *s);
void PUTI(OBUF *o, int i);
void PUTUL(OBUF *o, unsigned long i);
#endif /* _UTILS_H_ */
......@@ -312,6 +312,16 @@ void vcd_signal_dumper_dump_function_by_name(vcd_signal_dump_functions function
extern int ouput_vcd;
#if T_TRACER
#define VCD_SIGNAL_DUMPER_INIT(x) /* nothing */
#define VCD_SIGNAL_DUMPER_CLOSE() /* nothing */
#define VCD_SIGNAL_DUMPER_CREATE_HEADER() /* nothing */
#define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(var, val) T_VCD_VARIABLE(var, val)
#define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(var, val) T_VCD_FUNCTION(var, val)
#else /* T_TRACER */
#if defined(ENABLE_VCD)
#define VCD_SIGNAL_DUMPER_INIT(aRgUmEnT) vcd_signal_dumper_init(aRgUmEnT)
#define VCD_SIGNAL_DUMPER_CLOSE() vcd_signal_dumper_close()
......@@ -326,5 +336,7 @@ extern int ouput_vcd;
#define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(vAr1,vAr2)
#endif
#endif /* T_TRACER */
#endif /* !defined (VCD_SIGNAL_DUMPER_H_) */
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