static struct ext_module_list_s *modlist=NULL;
-int lambdasim_register_ext_module(struct ext_module_s *mod)
+int litex_sim_register_ext_module(struct ext_module_s *mod)
{
int ret=RC_OK;
struct ext_module_list_s *ml=NULL;
return ret;
}
-int lambdasim_load_ext_modules(struct ext_module_list_s **mlist)
+int litex_sim_load_ext_modules(struct ext_module_list_s **mlist)
{
int ret = RC_OK;
tinydir_dir dir;
tinydir_file file;
dylib_ref lib;
- int (*lambdasim_ext_module_init)(int (*reg)(struct ext_module_s *));
+ int (*litex_sim_ext_module_init)(int (*reg)(struct ext_module_s *));
char name[100];
if (tinydir_open(&dir, "./modules/") == -1)
{
goto out;
}
- if(!libdylib_find(lib, "lambdasim_ext_module_init"))
+ if(!libdylib_find(lib, "litex_sim_ext_module_init"))
{
ret = RC_ERROR;
- eprintf("Module has no lambdasim_ext_module_init function\n");
+ eprintf("Module has no litex_sim_ext_module_init function\n");
goto out;
}
- LIBDYLIB_BINDNAME(lib, lambdasim_ext_module_init);
- if(!lambdasim_ext_module_init)
+ LIBDYLIB_BINDNAME(lib, litex_sim_ext_module_init);
+ if(!litex_sim_ext_module_init)
{
ret = RC_ERROR;
eprintf("Can't bind %s\n", libdylib_last_error());
goto out;
}
- ret = lambdasim_ext_module_init(lambdasim_register_ext_module);
+ ret = litex_sim_ext_module_init(litex_sim_register_ext_module);
if(RC_OK != ret)
{
goto out;
return ret;
}
-int lambdasim_find_ext_module(struct ext_module_list_s *first, char *name , struct ext_module_list_s **found)
+int litex_sim_find_ext_module(struct ext_module_list_s *first, char *name , struct ext_module_list_s **found)
{
struct ext_module_list_s *list = NULL;
int ret=RC_OK;
return ret;
}
-int lambdasim_find_module(struct module_s *first, char *name , struct module_s **found)
+int litex_sim_find_module(struct module_s *first, char *name , struct module_s **found)
{
struct module_s *list = NULL;
int ret=RC_OK;
struct ext_module_list_s *next;
};
-int lambdasim_file_to_module_list(char *filename, struct module_s **mod);
-int lambdasim_load_ext_modules(struct ext_module_list_s **mlist);
-int lambdasim_find_ext_module(struct ext_module_list_s *first, char *name , struct ext_module_list_s **found);
+int litex_sim_file_to_module_list(char *filename, struct module_s **mod);
+int litex_sim_load_ext_modules(struct ext_module_list_s **mlist);
+int litex_sim_find_ext_module(struct ext_module_list_s *first, char *name , struct ext_module_list_s **found);
#endif
char *sys_clk;
};
-static int lambdasim_module_pads_get( struct pad_s *pads, char *name, void **signal)
+static int litex_sim_module_pads_get( struct pad_s *pads, char *name, void **signal)
{
int ret;
void *sig=NULL;
if(!strcmp(plist->name, "sys_clk"))
{
- lambdasim_module_pads_get(pads, "sys_clk", (void**)&s->sys_clk);
+ litex_sim_module_pads_get(pads, "sys_clk", (void**)&s->sys_clk);
}
*s->sys_clk=0;
clocker_tick
};
-int lambdasim_ext_module_init(int (*register_module)(struct ext_module_s *))
+int litex_sim_ext_module_init(int (*register_module)(struct ext_module_s *))
{
int ret=RC_OK;
ret = register_module(&ext_mod);
static struct event_base *base=NULL;
-int lambdasim_module_get_args( char *args, char *arg, char **val)
+int litex_sim_module_get_args( char *args, char *arg, char **val)
{
int ret=RC_OK;
json_object *jsobj=NULL;
return ret;
}
-static int lambdasim_module_pads_get( struct pad_s *pads, char *name, void **signal)
+static int litex_sim_module_pads_get( struct pad_s *pads, char *name, void **signal)
{
int ret;
void *sig=NULL;
}
memset(s, 0, sizeof(struct session_s));
- ret = lambdasim_module_get_args(args, "interface", &c_tap);
+ ret = litex_sim_module_get_args(args, "interface", &c_tap);
{
if(RC_OK != ret)
{
goto out;
}
}
- ret = lambdasim_module_get_args(args, "ip", &c_tap_ip);
+ ret = litex_sim_module_get_args(args, "ip", &c_tap_ip);
{
if(RC_OK != ret)
{
pads = plist->pads;
if(!strcmp(plist->name, "eth"))
{
- lambdasim_module_pads_get(pads, "sink_data", (void**)&s->rx);
- lambdasim_module_pads_get(pads, "sink_valid", (void**)&s->rx_valid);
- lambdasim_module_pads_get(pads, "sink_ready", (void**)&s->rx_ready);
- lambdasim_module_pads_get(pads, "source_data", (void**)&s->tx);
- lambdasim_module_pads_get(pads, "source_valid", (void**)&s->tx_valid);
- lambdasim_module_pads_get(pads, "source_ready", (void**)&s->tx_ready);
+ litex_sim_module_pads_get(pads, "sink_data", (void**)&s->rx);
+ litex_sim_module_pads_get(pads, "sink_valid", (void**)&s->rx_valid);
+ litex_sim_module_pads_get(pads, "sink_ready", (void**)&s->rx_ready);
+ litex_sim_module_pads_get(pads, "source_data", (void**)&s->tx);
+ litex_sim_module_pads_get(pads, "source_valid", (void**)&s->tx_valid);
+ litex_sim_module_pads_get(pads, "source_ready", (void**)&s->tx_ready);
}
if(!strcmp(plist->name, "sys_clk"))
{
- lambdasim_module_pads_get(pads, "sys_clk", (void**)&s->sys_clk);
+ litex_sim_module_pads_get(pads, "sys_clk", (void**)&s->sys_clk);
}
out:
ethernet_tick
};
-int lambdasim_ext_module_init(int (*register_module)(struct ext_module_s *))
+int litex_sim_ext_module_init(int (*register_module)(struct ext_module_s *))
{
int ret=RC_OK;
ret = register_module(&ext_mod);
};
struct event_base *base;
-static int lambdasim_module_pads_get( struct pad_s *pads, char *name, void **signal)
+static int litex_sim_module_pads_get( struct pad_s *pads, char *name, void **signal)
{
int ret;
void *sig=NULL;
pads = plist->pads;
if(!strcmp(plist->name, "serial"))
{
- lambdasim_module_pads_get(pads, "sink_data", (void**)&s->rx);
- lambdasim_module_pads_get(pads, "sink_valid", (void**)&s->rx_valid);
- lambdasim_module_pads_get(pads, "sink_ready", (void**)&s->rx_ready);
- lambdasim_module_pads_get(pads, "source_data", (void**)&s->tx);
- lambdasim_module_pads_get(pads, "source_valid", (void**)&s->tx_valid);
- lambdasim_module_pads_get(pads, "source_ready", (void**)&s->tx_ready);
+ litex_sim_module_pads_get(pads, "sink_data", (void**)&s->rx);
+ litex_sim_module_pads_get(pads, "sink_valid", (void**)&s->rx_valid);
+ litex_sim_module_pads_get(pads, "sink_ready", (void**)&s->rx_ready);
+ litex_sim_module_pads_get(pads, "source_data", (void**)&s->tx);
+ litex_sim_module_pads_get(pads, "source_valid", (void**)&s->tx_valid);
+ litex_sim_module_pads_get(pads, "source_ready", (void**)&s->tx_ready);
}
if(!strcmp(plist->name, "sys_clk"))
{
- lambdasim_module_pads_get(pads, "sys_clk", (void**)&s->sys_clk);
+ litex_sim_module_pads_get(pads, "sys_clk", (void**)&s->sys_clk);
}
serial2console_tick
};
-int lambdasim_ext_module_init(int (*register_module)(struct ext_module_s *))
+int litex_sim_ext_module_init(int (*register_module)(struct ext_module_s *))
{
int ret=RC_OK;
ret = register_module(&ext_mod);
struct event_base *base;
-int lambdasim_module_get_args( char *args, char *arg, char **val)
+int litex_sim_module_get_args( char *args, char *arg, char **val)
{
int ret=RC_OK;
json_object *jsobj=NULL;
return ret;
}
-static int lambdasim_module_pads_get( struct pad_s *pads, char *name, void **signal)
+static int litex_sim_module_pads_get( struct pad_s *pads, char *name, void **signal)
{
int ret;
void *sig=NULL;
goto out;
}
- ret = lambdasim_module_get_args(args, "port", &cport);
+ ret = litex_sim_module_get_args(args, "port", &cport);
{
if(RC_OK != ret)
{
pads = plist->pads;
if(!strcmp(plist->name, "serial"))
{
- lambdasim_module_pads_get(pads, "sink_data", (void**)&s->rx);
- lambdasim_module_pads_get(pads, "sink_valid", (void**)&s->rx_valid);
- lambdasim_module_pads_get(pads, "sink_ready", (void**)&s->rx_ready);
- lambdasim_module_pads_get(pads, "source_data", (void**)&s->tx);
- lambdasim_module_pads_get(pads, "source_valid", (void**)&s->tx_valid);
- lambdasim_module_pads_get(pads, "source_ready", (void**)&s->tx_ready);
+ litex_sim_module_pads_get(pads, "sink_data", (void**)&s->rx);
+ litex_sim_module_pads_get(pads, "sink_valid", (void**)&s->rx_valid);
+ litex_sim_module_pads_get(pads, "sink_ready", (void**)&s->rx_ready);
+ litex_sim_module_pads_get(pads, "source_data", (void**)&s->tx);
+ litex_sim_module_pads_get(pads, "source_valid", (void**)&s->tx_valid);
+ litex_sim_module_pads_get(pads, "source_ready", (void**)&s->tx_ready);
}
if(!strcmp(plist->name, "sys_clk"))
{
- lambdasim_module_pads_get(pads, "sys_clk", (void**)&s->sys_clk);
+ litex_sim_module_pads_get(pads, "sys_clk", (void**)&s->sys_clk);
}
serial2tcp_tick
};
-int lambdasim_ext_module_init(int (*register_module)(struct ext_module_s *))
+int litex_sim_ext_module_init(int (*register_module)(struct ext_module_s *))
{
int ret=RC_OK;
ret = register_module(&ext_mod);
static struct pad_list_s *padlist=NULL;
-int lambdasim_register_pads(struct pad_s *pads, char *interface_name, int index)
+int litex_sim_register_pads(struct pad_s *pads, char *interface_name, int index)
{
int ret = RC_OK;
return ret;
}
-int lambdasim_pads_get_list(struct pad_list_s **plist)
+int litex_sim_pads_get_list(struct pad_list_s **plist)
{
int ret=RC_OK;
return ret;
}
-int lambdasim_pads_find(struct pad_list_s *first, char *name, int index, struct pad_list_s **found)
+int litex_sim_pads_find(struct pad_list_s *first, char *name, int index, struct pad_list_s **found)
{
struct pad_list_s *list = NULL;
int ret=RC_OK;
struct pad_list_s *next;
};
-int lambdasim_pads_get_list(struct pad_list_s **plist);
-int lambdasim_pads_find(struct pad_list_s *first, char *name, int index, struct pad_list_s **found);
+int litex_sim_pads_get_list(struct pad_list_s **plist);
+int litex_sim_pads_find(struct pad_list_s *first, char *name, int index, struct pad_list_s **found);
#ifdef __cplusplus
-extern "C" int lambdasim_register_pads(struct pad_s *pads, char *interface_name, int index);
+extern "C" int litex_sim_register_pads(struct pad_s *pads, char *interface_name, int index);
#else
-int lambdasim_register_pads(struct pad_s *pads, char *interface_name, int index);
+int litex_sim_register_pads(struct pad_s *pads, char *interface_name, int index);
#endif
#endif
return ret;
}
-int lambdasim_file_to_module_list(char *filename, struct module_s **mod)
+int litex_sim_file_to_module_list(char *filename, struct module_s **mod)
{
struct module_s *m=NULL;
json_object *obj=NULL;
#include <event2/util.h>
#include <event2/event.h>
-void lambdasim_init(void **out);
+void litex_sim_init(void **out);
struct session_list_s {
void *session;
struct session_list_s *sesslist=NULL;
-static int lambdasim_initialize_all(void **dut, void *base)
+static int litex_sim_initialize_all(void **dut, void *base)
{
struct module_s *ml=NULL;
struct module_s *mli=NULL;
int ret = RC_OK;
/* Load external modules */
- ret = lambdasim_load_ext_modules(&mlist);
+ ret = litex_sim_load_ext_modules(&mlist);
if(RC_OK != ret)
{
goto out;
}
/* Load configuration */
- ret = lambdasim_file_to_module_list("sim_config.js", &ml);
+ ret = litex_sim_file_to_module_list("sim_config.js", &ml);
if(RC_OK != ret)
{
goto out;
}
/* Init generated */
- lambdasim_init(&vdut);
+ litex_sim_init(&vdut);
/* Get pads from generated */
- ret = lambdasim_pads_get_list(&plist);
+ ret = litex_sim_pads_get_list(&plist);
if(RC_OK != ret)
{
goto out;
/* Find the module in the external module */
pmlist = NULL;
- ret = lambdasim_find_ext_module(mlist, mli->name, &pmlist );
+ ret = litex_sim_find_ext_module(mlist, mli->name, &pmlist );
if(RC_OK != ret)
{
goto out;
{
/*Find the pads */
pplist=NULL;
- ret = lambdasim_pads_find(plist, mli->iface[i].name, mli->iface[i].index, &pplist);
+ ret = litex_sim_pads_find(plist, mli->iface[i].name, mli->iface[i].index, &pplist);
if(RC_OK != ret)
{
goto out;
return ret;
}
-int lambdasim_sort_session()
+int litex_sim_sort_session()
{
struct session_list_s *s;
struct session_list_s *sprev=sesslist;
int i;
- //lambdasim_eval(vdut);
+ //litex_sim_eval(vdut);
for(i = 0; i < 1000; i++)
{
for(s = sesslist; s; s=s->next)
if(s->tickfirst)
s->module->tick(s->session);
}
- lambdasim_eval(vdut);
+ litex_sim_eval(vdut);
for(s = sesslist; s; s=s->next)
{
if(!s->tickfirst)
s->module->tick(s->session);
}
}
- //lambdasim_eval(vdut);
+ //litex_sim_eval(vdut);
if (!evtimer_pending(ev, NULL)) {
goto out;
}
- if(RC_OK != (ret = lambdasim_initialize_all(&vdut, base)))
+ if(RC_OK != (ret = litex_sim_initialize_all(&vdut, base)))
{
goto out;
}
- if(RC_OK != (ret = lambdasim_sort_session()))
+ if(RC_OK != (ret = litex_sim_sort_session()))
{
goto out;
}
VerilatedVcdC* tfp;
-extern "C" void lambdasim_eval(void *vdut)
+extern "C" void litex_sim_eval(void *vdut)
{
Vdut *dut = (Vdut*)vdut;
dut->eval();
}
-extern "C" void lambdasim_init_tracer(void *vdut)
+extern "C" void litex_sim_init_tracer(void *vdut)
{
Vdut *dut = (Vdut*)vdut;
Verilated::traceEverOn(true);
tfp->open("dut.vcd");
}
-extern "C" void lambdasim_tracer_dump()
+extern "C" void litex_sim_tracer_dump()
{
static unsigned int ticks=0;
tfp->dump(ticks++);
#define __VERIL_H_
#ifdef __cplusplus
-extern "C" void lambdasim_eval(void *vdut);
-extern "C" void lambdasim_init_tracer(void *vdut);
-extern "C" void lambdasim_tracer_dump();
+extern "C" void litex_sim_eval(void *vdut);
+extern "C" void litex_sim_init_tracer(void *vdut);
+extern "C" void litex_sim_tracer_dump();
#else
-void lambdasim_eval(void *vdut);
-void lambdasim_init_tracer(void *vdut);
-void lambdasim_tracer_dump();
+void litex_sim_eval(void *vdut);
+void litex_sim_init_tracer(void *vdut);
+void litex_sim_tracer_dump();
#endif
#endif
content += """\
#ifndef __cplusplus
-void lambdasim_init(void **out);
+void litex_sim_init(void **out);
#endif
#endif /* __SIM_CORE_H_ */
content += ' {}{}[{}].signal = &dut->{};\n'.format(name, index, i, sigfname)
idx_int = 0 if not index else int(index)
- content += ' lambdasim_register_pads({}{}, (char*)"{}", {});\n\n'.format(name, index, name, idx_int)
+ content += ' litex_sim_register_pads({}{}, (char*)"{}", {});\n\n'.format(name, index, name, idx_int)
return content
#include <verilated.h>
#include "dut_header.h"
-extern "C" void lambdasim_init(void **out)
+extern "C" void litex_sim_init(void **out)
{
Vdut *dut;