int sc_main( int argc, char* argv[] ) { sc_signal<bool> s1; sc_signal<bool> s2; sc_signal<bool> s3; s1.write(true); s2.write(true); s3.write(false); and_gatet and_gate("and_gate"); and_gate.a(s1); and_gate.b(s2); and_gate.c(s3); and_gate.and_process(); and_gate.test_process(); // sc_start(100); return 0; }
static PyObject * ext_and_gate(PyObject *self, PyObject *args) { PyObject *py_a, *py_b; struct bit *a, *b, *out; if (!PyArg_ParseTuple(args, "OO", &py_a, &py_b)) return NULL; a = (struct bit *) PyCapsule_GetPointer(py_a, NULL); if (a == NULL) return NULL; b = (struct bit *) PyCapsule_GetPointer(py_b, NULL); if (b == NULL) return NULL; out = (struct bit *) malloc(sizeof(struct bit)); if (out == NULL) return NULL; and_gate(out, a, b); return PyCapsule_New((void *) out, NULL, bit_destructor); }