Disable delayed connect

This commit is contained in:
Rodrigo Arias 2023-11-10 12:59:36 +01:00
parent 354f2f50eb
commit d45041e00c
16 changed files with 13 additions and 135 deletions

View File

@ -49,16 +49,6 @@ process_ev(struct emu *emu)
int
model_kernel_event(struct emu *emu)
{
static int enabled = 0;
if (!enabled) {
if (model_kernel_connect(emu) != 0) {
err("kernel_connect failed");
return -1;
}
enabled = 1;
}
dbg("in kernel_event");
if (emu->ev->m != 'K') {
err("unexpected event model %c", emu->ev->m);

View File

@ -24,7 +24,7 @@ struct model_spec model_kernel = {
.version = "1.0.0",
.model = model_id,
.create = model_kernel_create,
// .connect = model_kernel_connect,
.connect = model_kernel_connect,
.event = model_kernel_event,
.probe = model_kernel_probe,
};

View File

@ -44,6 +44,7 @@ model_register(struct model *model, struct model_spec *spec)
int
model_probe(struct model *model, struct emu *emu)
{
int nenabled = 0;
for (int i = 0; i < MAX_MODELS; i++) {
if (!model->registered[i])
continue;
@ -62,9 +63,15 @@ model_probe(struct model *model, struct emu *emu)
dbg("model %c disabled", (char) i);
} else {
model->enabled[i] = 1;
dbg("model %c enabled", (char) i);
info("model %s %s [%c] enabled",
spec->name, spec->version, (char) i);
nenabled++;
}
}
if (nenabled == 0)
warn("no models enabled");
return 0;
}

View File

@ -175,16 +175,6 @@ process_ev(struct emu *emu)
int
model_mpi_event(struct emu *emu)
{
static int enabled = 0;
if (!enabled) {
if (model_mpi_connect(emu) != 0) {
err("mpi_connect failed");
return -1;
}
enabled = 1;
}
dbg("in mpi_event");
if (emu->ev->m != 'M') {
err("unexpected event model %c", emu->ev->m);

View File

@ -29,7 +29,7 @@ struct model_spec model_mpi = {
.version = "1.0.0",
.model = model_id,
.create = model_mpi_create,
// .connect = model_mpi_connect,
.connect = model_mpi_connect,
.event = model_mpi_event,
.probe = model_mpi_probe,
.finish = model_mpi_finish,

View File

@ -194,14 +194,6 @@ mux_init(struct mux *mux,
return -1;
}
/* FIXME: Mark the select channel as dirty, so it runs the select
* callback even if it doesn't have a new value. This hack must be
* removed when we get rid of the delayed connect. */
if (chan_dirty(select) != 0) {
err("chan_dirty failed");
return -1;
}
return 0;
}

View File

@ -567,19 +567,6 @@ process_ev(struct emu *emu)
int
model_nanos6_event(struct emu *emu)
{
static int enabled = 0;
if (!enabled) {
struct nanos6_emu *memu = EXT(emu, '6');
memu->event = 1;
if (model_nanos6_connect(emu) != 0) {
err("nanos6_connect failed");
return -1;
}
enabled = 1;
}
if (emu->ev->m != '6') {
err("unexpected event model %c", emu->ev->m);
return -1;

View File

@ -89,8 +89,6 @@ struct nanos6_proc {
};
struct nanos6_emu {
int connected;
int event;
struct breakdown_emu breakdown;
};

View File

@ -281,16 +281,6 @@ model_nanos6_create(struct emu *emu)
int
model_nanos6_connect(struct emu *emu)
{
struct nanos6_emu *memu = EXT(emu, model_id);
if (memu->connected)
return 0;
/* Only skip connection if event not reached and
* breakdown not enabled */
if (!memu->event && !emu->args.breakdown)
return 0;
if (model_thread_connect(emu, &th_spec) != 0) {
err("model_thread_connect failed");
return -1;
@ -323,8 +313,6 @@ model_nanos6_connect(struct emu *emu)
mux_set_default(mux, value_int64(ST_RESTING));
}
memu->connected = 1;
return 0;
}

View File

@ -105,16 +105,6 @@ process_ev(struct emu *emu)
int
model_nodes_event(struct emu *emu)
{
static int enabled = 0;
if (!enabled) {
if (model_nodes_connect(emu) != 0) {
err("nodes_connect failed");
return -1;
}
enabled = 1;
}
dbg("in nodes_event");
if (emu->ev->m != 'D') {
err("unexpected event model %c", emu->ev->m);

View File

@ -29,7 +29,7 @@ struct model_spec model_nodes = {
.version = "1.0.0",
.model = model_id,
.create = model_nodes_create,
// .connect = model_nodes_connect,
.connect = model_nodes_connect,
.event = model_nodes_event,
.probe = model_nodes_probe,
.finish = model_nodes_finish,

View File

@ -532,16 +532,6 @@ process_ev(struct emu *emu)
int
model_nosv_event(struct emu *emu)
{
static int enabled = 0;
if (!enabled) {
if (model_nosv_connect(emu) != 0) {
err("nosv_connect failed");
return -1;
}
enabled = 1;
}
dbg("in nosv_event");
if (emu->ev->m != 'V') {
err("unexpected event model %c", emu->ev->m);

View File

@ -34,7 +34,7 @@ struct model_spec model_nosv = {
.version = "1.0.0",
.model = model_id,
.create = model_nosv_create,
// .connect = model_nosv_connect,
.connect = model_nosv_connect,
.event = model_nosv_event,
.probe = model_nosv_probe,
.finish = model_nosv_finish,

View File

@ -85,16 +85,6 @@ process_ev(struct emu *emu)
int
model_tampi_event(struct emu *emu)
{
static int enabled = 0;
if (!enabled) {
if (model_tampi_connect(emu) != 0) {
err("tampi_connect failed");
return -1;
}
enabled = 1;
}
dbg("in tampi_event");
if (emu->ev->m != 'T') {
err("unexpected event model %c", emu->ev->m);

View File

@ -29,7 +29,7 @@ struct model_spec model_tampi = {
.version = "1.0.0",
.model = model_id,
.create = model_tampi_create,
// .connect = model_tampi_connect,
.connect = model_tampi_connect,
.event = model_tampi_event,
.probe = model_tampi_probe,
.finish = model_tampi_finish,

View File

@ -144,49 +144,6 @@ test_duplicate_output(struct mux *mux, int key1, int key2)
err("OK");
}
/* Ensure that the output of a mux is correct while the mux is connected
* to the bay with a clean select channel but that already contains a
* valid value of a input of the mux. The select must be marked as dirty
* */
static void
test_delayed_connect(void)
{
struct bay bay;
bay_init(&bay);
struct chan input, output, select;
chan_init(&output, CHAN_SINGLE, "output");
chan_init(&select, CHAN_SINGLE, "select");
chan_init(&input, CHAN_SINGLE, "input.0");
/* Register all channels in the bay */
OK(bay_register(&bay, &select));
OK(bay_register(&bay, &output));
OK(bay_register(&bay, &input));
/* Setup channel values */
OK(chan_set(&select, value_int64(0)));
OK(chan_set(&input, value_int64(1000)));
/* Propagate now so they are clean */
OK(bay_propagate(&bay));
/* ----- delayed connect ----- */
struct mux mux;
OK(mux_init(&mux, &bay, &select, &output, NULL, 1));
OK(mux_set_input(&mux, 0, &input));
/* Don't modify the input of the select until propagation, the
* mux_init must have marked the select as dirty. */
OK(bay_propagate(&bay));
/* The mux must have selected the first input */
check_output(&mux, value_int64(1000));
err("OK");
}
int
main(void)
{
@ -234,7 +191,6 @@ main(void)
test_input_and_select(&mux, 4);
test_mid_propagate(&mux, 5);
test_duplicate_output(&mux, 6, 7);
test_delayed_connect();
err("OK");