# HG changeset patch # User Sean Halle # Date 1373396600 25200 # Node ID a4796deb8c8b570e181dc5cb63519df76aaef2b2 # Parent 5b757d5a70444d335a5e5401e1415c20b0063ae4 changed so checker fn ptrs are in the port now, so setup circuit and doers chgd diff -r 5b757d5a7044 -r a4796deb8c8b VReo__Test_App/Circuit.c --- a/VReo__Test_App/Circuit.c Wed Jun 12 15:13:34 2013 -0700 +++ b/VReo__Test_App/Circuit.c Tue Jul 09 12:03:20 2013 -0700 @@ -34,6 +34,8 @@ { VReoCircuit *circuit; VReoPort *port, *ports, **boundaryPorts; VReoIsland *islands, *island; + VReoCheckerFn **portReaderCheckerFns, **portWriterCheckerFns; + VReoDoerFn **portReaderDoerFns, **portWriterDoerFns; //create uninitialized port structs, by allocating space in array ports = PR_WL__malloc( NUM_PORTS * sizeof(VReoPort) ); @@ -67,7 +69,7 @@ island->ports[I1_PORT_Ar] = &(ports[CKT_PORT_A]); island->ports[I1_PORT_Br] = &(ports[CKT_PORT_B]); island->ports[I1_PORT_Cw] = &(ports[CKT_PORT_C]); - + //== //set up second island island = &( islands[CKT_I2] ); //easier to work with a pointer @@ -97,6 +99,15 @@ port = &(ports[CKT_PORT_A]); port->reader = &(islands[CKT_I1]); + //copy checker and doer function pointers into the port + port->numReaderCheckerFns = NUM_I1_CHECKERS_INVOLVE_PORT_A; + portReaderCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_A * sizeof(VReoCheckerFn *) ); + portReaderDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_A * sizeof(VReoDoerFn *) ); + portReaderCheckerFns[0] = &Checker_1__I1; + portReaderDoerFns[0] = &Doer_1__I1; + port->readerCheckerFns = portReaderCheckerFns; + port->readerDoerFns = portReaderDoerFns; + //initialize port port->buffer = NULL; port->portIsFull = FALSE; @@ -108,6 +119,15 @@ port = &(ports[CKT_PORT_B]); port->reader = &(islands[CKT_I1]); + //copy checker and doer function pointers into the port + port->numReaderCheckerFns = NUM_I1_CHECKERS_INVOLVE_PORT_B; + portReaderCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_B * sizeof(VReoCheckerFn *) ); + portReaderDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_B * sizeof(VReoDoerFn *) ); + portReaderCheckerFns[0] = &Checker_2__I1; + portReaderDoerFns[0] = &Doer_2__I1; + port->readerCheckerFns = portReaderCheckerFns; + port->readerDoerFns = portReaderDoerFns; + //initialize port port->buffer = NULL; port->portIsFull = FALSE; @@ -120,6 +140,26 @@ port->writer = &(islands[CKT_I1]); port->reader = &(islands[CKT_I2]); + //copy checker and doer function pointers into the port + port->numWriterCheckerFns = NUM_I1_CHECKERS_INVOLVE_PORT_C; + portWriterCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_C * sizeof(VReoCheckerFn *) ); + portWriterDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_C * sizeof(VReoDoerFn *) ); + portWriterCheckerFns[0] = &Checker_1__I1; + portWriterCheckerFns[1] = &Checker_2__I1; + portWriterDoerFns[0] = &Doer_1__I1; + portWriterDoerFns[1] = &Doer_2__I1; + port->writerCheckerFns = portWriterCheckerFns; + port->writerDoerFns = portWriterDoerFns; + + //copy checker and doer function pointers into the port + port->numReaderCheckerFns = NUM_I2_CHECKERS_INVOLVE_PORT_C; + portReaderCheckerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_PORT_C * sizeof(VReoCheckerFn *) ); + portReaderDoerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_PORT_C * sizeof(VReoDoerFn *) ); + portReaderCheckerFns[0] = &Checker_1__I2; + portReaderDoerFns[0] = &Doer_1__I2; + port->readerCheckerFns = portReaderCheckerFns; + port->readerDoerFns = portReaderDoerFns; + //initialize port port->buffer = NULL; port->portIsFull = FALSE; @@ -131,6 +171,15 @@ port = &(ports[CKT_PORT_D]); port->writer = &(islands[CKT_I2]); + //copy checker and doer function pointers into the port + port->numWriterCheckerFns = NUM_I2_CHECKERS_INVOLVE_PORT_D; + portWriterCheckerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_PORT_D * sizeof(VReoCheckerFn *) ); + portWriterDoerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_PORT_D * sizeof(VReoDoerFn *) ); + portWriterCheckerFns[0] = &Checker_1__I2; + portWriterDoerFns[0] = &Doer_1__I2; + port->writerCheckerFns = portWriterCheckerFns; + port->writerDoerFns = portWriterDoerFns; + //initialize port port->buffer = NULL; port->portIsFull = FALSE; @@ -292,8 +341,8 @@ // anyway, this second go will not satisfy any checkers.. later do an // optimization that remembers what triggered, to avoid this redundancy islandOnOtherSide = (VReoIsland *)portC->reader; - VReo__check_an_island( islandOnOtherSide, islandOnOtherSide->numCheckerFns, - islandOnOtherSide->checkerFns, islandOnOtherSide->doerFns ); + VReo__check_an_island( islandOnOtherSide, portC->numReaderCheckerFns, + portC->readerCheckerFns, portC->readerDoerFns ); //A was made full by the request handler, which wrote buffer and flags //A was full, so guaranteed to have a VP waiting to resume @@ -314,8 +363,8 @@ portC->portIsFull = TRUE; islandOnOtherSide = (VReoIsland *)portC->reader; - VReo__check_an_island( islandOnOtherSide, islandOnOtherSide->numCheckerFns, - islandOnOtherSide->checkerFns, islandOnOtherSide->doerFns ); + VReo__check_an_island( islandOnOtherSide, portC->numReaderCheckerFns, + portC->readerCheckerFns, portC->readerDoerFns ); //was full, so guaranteed to have a VP waiting to resume PR_PI__make_slave_ready_for_lang( portB->waitingWriterVP, VReo_MAGIC_NUMBER ); @@ -372,8 +421,8 @@ // anyway, this second go may not satisfy any checkers.. later do an // optimization that remembers what triggered, to avoid redundancy islandOnOtherSide = (VReoIsland *)portC->writer; - VReo__check_an_island( islandOnOtherSide, islandOnOtherSide->numCheckerFns, - islandOnOtherSide->checkerFns, islandOnOtherSide->doerFns ); + VReo__check_an_island( islandOnOtherSide, portC->numWriterCheckerFns, + portC->writerCheckerFns, portC->writerDoerFns ); } diff -r 5b757d5a7044 -r a4796deb8c8b VReo__Test_App/Circuit.h --- a/VReo__Test_App/Circuit.h Wed Jun 12 15:13:34 2013 -0700 +++ b/VReo__Test_App/Circuit.h Tue Jul 09 12:03:20 2013 -0700 @@ -39,6 +39,15 @@ #define CKT_VP2 1 #define CKT_VP3 2 +#define NUM_I1_CHECKERS_INVOLVE_PORT_A 1 +#define NUM_I1_CHECKERS_INVOLVE_PORT_B 1 +#define NUM_I1_CHECKERS_INVOLVE_PORT_C 2 + +#define NUM_I2_CHECKERS_INVOLVE_PORT_C 1 +#define NUM_I2_CHECKERS_INVOLVE_PORT_D 1 + + + //called by seedVP to create the circuit structs, including ports and islands VReoCircuit * create_circuit__Test_App( SlaveVP *animVP );