diff --git a/src/emu/kernel/event.c b/src/emu/kernel/event.c index 3919897..cfc5a29 100644 --- a/src/emu/kernel/event.c +++ b/src/emu/kernel/event.c @@ -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); diff --git a/src/emu/kernel/setup.c b/src/emu/kernel/setup.c index 34187e5..aaa10d6 100644 --- a/src/emu/kernel/setup.c +++ b/src/emu/kernel/setup.c @@ -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, }; diff --git a/src/emu/model.c b/src/emu/model.c index 2a4ecdc..f7a225d 100644 --- a/src/emu/model.c +++ b/src/emu/model.c @@ -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; } diff --git a/src/emu/mpi/event.c b/src/emu/mpi/event.c index ba8a4e1..faa89fa 100644 --- a/src/emu/mpi/event.c +++ b/src/emu/mpi/event.c @@ -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); diff --git a/src/emu/mpi/setup.c b/src/emu/mpi/setup.c index 9a0c98b..1cda0d7 100644 --- a/src/emu/mpi/setup.c +++ b/src/emu/mpi/setup.c @@ -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, diff --git a/src/emu/mux.c b/src/emu/mux.c index fc13591..996176d 100644 --- a/src/emu/mux.c +++ b/src/emu/mux.c @@ -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; } diff --git a/src/emu/nanos6/event.c b/src/emu/nanos6/event.c index c5b21d9..5223b1e 100644 --- a/src/emu/nanos6/event.c +++ b/src/emu/nanos6/event.c @@ -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; diff --git a/src/emu/nanos6/nanos6_priv.h b/src/emu/nanos6/nanos6_priv.h index a88e7a0..a5bbd09 100644 --- a/src/emu/nanos6/nanos6_priv.h +++ b/src/emu/nanos6/nanos6_priv.h @@ -89,8 +89,6 @@ struct nanos6_proc { }; struct nanos6_emu { - int connected; - int event; struct breakdown_emu breakdown; }; diff --git a/src/emu/nanos6/setup.c b/src/emu/nanos6/setup.c index 3886556..9ba0226 100644 --- a/src/emu/nanos6/setup.c +++ b/src/emu/nanos6/setup.c @@ -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; } diff --git a/src/emu/nodes/event.c b/src/emu/nodes/event.c index 2b6a7a4..3714579 100644 --- a/src/emu/nodes/event.c +++ b/src/emu/nodes/event.c @@ -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); diff --git a/src/emu/nodes/setup.c b/src/emu/nodes/setup.c index d02b7d2..dbc10a7 100644 --- a/src/emu/nodes/setup.c +++ b/src/emu/nodes/setup.c @@ -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, diff --git a/src/emu/nosv/event.c b/src/emu/nosv/event.c index f4fad6d..3f596ed 100644 --- a/src/emu/nosv/event.c +++ b/src/emu/nosv/event.c @@ -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); diff --git a/src/emu/nosv/setup.c b/src/emu/nosv/setup.c index 57dfcd0..07b862f 100644 --- a/src/emu/nosv/setup.c +++ b/src/emu/nosv/setup.c @@ -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, diff --git a/src/emu/tampi/event.c b/src/emu/tampi/event.c index 04496dc..c9d9f77 100644 --- a/src/emu/tampi/event.c +++ b/src/emu/tampi/event.c @@ -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); diff --git a/src/emu/tampi/setup.c b/src/emu/tampi/setup.c index 2b84c7f..8fda1c4 100644 --- a/src/emu/tampi/setup.c +++ b/src/emu/tampi/setup.c @@ -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, diff --git a/test/unit/mux.c b/test/unit/mux.c index 5c600a8..e16a423 100644 --- a/test/unit/mux.c +++ b/test/unit/mux.c @@ -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");