Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VReo > VReo__Prod_Cons__LangDev
changeset 1:a4796deb8c8b tip
changed so checker fn ptrs are in the port now, so setup circuit and doers chgd
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Tue, 09 Jul 2013 12:03:20 -0700 |
| parents | 5b757d5a7044 |
| children | |
| files | VReo__Test_App/Circuit.c VReo__Test_App/Circuit.h |
| diffstat | 2 files changed, 65 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/VReo__Test_App/Circuit.c Wed Jun 12 15:13:34 2013 -0700 1.2 +++ b/VReo__Test_App/Circuit.c Tue Jul 09 12:03:20 2013 -0700 1.3 @@ -34,6 +34,8 @@ 1.4 { VReoCircuit *circuit; 1.5 VReoPort *port, *ports, **boundaryPorts; 1.6 VReoIsland *islands, *island; 1.7 + VReoCheckerFn **portReaderCheckerFns, **portWriterCheckerFns; 1.8 + VReoDoerFn **portReaderDoerFns, **portWriterDoerFns; 1.9 1.10 //create uninitialized port structs, by allocating space in array 1.11 ports = PR_WL__malloc( NUM_PORTS * sizeof(VReoPort) ); 1.12 @@ -67,7 +69,7 @@ 1.13 island->ports[I1_PORT_Ar] = &(ports[CKT_PORT_A]); 1.14 island->ports[I1_PORT_Br] = &(ports[CKT_PORT_B]); 1.15 island->ports[I1_PORT_Cw] = &(ports[CKT_PORT_C]); 1.16 - 1.17 + 1.18 //== 1.19 //set up second island 1.20 island = &( islands[CKT_I2] ); //easier to work with a pointer 1.21 @@ -97,6 +99,15 @@ 1.22 port = &(ports[CKT_PORT_A]); 1.23 port->reader = &(islands[CKT_I1]); 1.24 1.25 + //copy checker and doer function pointers into the port 1.26 + port->numReaderCheckerFns = NUM_I1_CHECKERS_INVOLVE_PORT_A; 1.27 + portReaderCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_A * sizeof(VReoCheckerFn *) ); 1.28 + portReaderDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_A * sizeof(VReoDoerFn *) ); 1.29 + portReaderCheckerFns[0] = &Checker_1__I1; 1.30 + portReaderDoerFns[0] = &Doer_1__I1; 1.31 + port->readerCheckerFns = portReaderCheckerFns; 1.32 + port->readerDoerFns = portReaderDoerFns; 1.33 + 1.34 //initialize port 1.35 port->buffer = NULL; 1.36 port->portIsFull = FALSE; 1.37 @@ -108,6 +119,15 @@ 1.38 port = &(ports[CKT_PORT_B]); 1.39 port->reader = &(islands[CKT_I1]); 1.40 1.41 + //copy checker and doer function pointers into the port 1.42 + port->numReaderCheckerFns = NUM_I1_CHECKERS_INVOLVE_PORT_B; 1.43 + portReaderCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_B * sizeof(VReoCheckerFn *) ); 1.44 + portReaderDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_B * sizeof(VReoDoerFn *) ); 1.45 + portReaderCheckerFns[0] = &Checker_2__I1; 1.46 + portReaderDoerFns[0] = &Doer_2__I1; 1.47 + port->readerCheckerFns = portReaderCheckerFns; 1.48 + port->readerDoerFns = portReaderDoerFns; 1.49 + 1.50 //initialize port 1.51 port->buffer = NULL; 1.52 port->portIsFull = FALSE; 1.53 @@ -120,6 +140,26 @@ 1.54 port->writer = &(islands[CKT_I1]); 1.55 port->reader = &(islands[CKT_I2]); 1.56 1.57 + //copy checker and doer function pointers into the port 1.58 + port->numWriterCheckerFns = NUM_I1_CHECKERS_INVOLVE_PORT_C; 1.59 + portWriterCheckerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_C * sizeof(VReoCheckerFn *) ); 1.60 + portWriterDoerFns = PR_WL__malloc( NUM_I1_CHECKERS_INVOLVE_PORT_C * sizeof(VReoDoerFn *) ); 1.61 + portWriterCheckerFns[0] = &Checker_1__I1; 1.62 + portWriterCheckerFns[1] = &Checker_2__I1; 1.63 + portWriterDoerFns[0] = &Doer_1__I1; 1.64 + portWriterDoerFns[1] = &Doer_2__I1; 1.65 + port->writerCheckerFns = portWriterCheckerFns; 1.66 + port->writerDoerFns = portWriterDoerFns; 1.67 + 1.68 + //copy checker and doer function pointers into the port 1.69 + port->numReaderCheckerFns = NUM_I2_CHECKERS_INVOLVE_PORT_C; 1.70 + portReaderCheckerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_PORT_C * sizeof(VReoCheckerFn *) ); 1.71 + portReaderDoerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_PORT_C * sizeof(VReoDoerFn *) ); 1.72 + portReaderCheckerFns[0] = &Checker_1__I2; 1.73 + portReaderDoerFns[0] = &Doer_1__I2; 1.74 + port->readerCheckerFns = portReaderCheckerFns; 1.75 + port->readerDoerFns = portReaderDoerFns; 1.76 + 1.77 //initialize port 1.78 port->buffer = NULL; 1.79 port->portIsFull = FALSE; 1.80 @@ -131,6 +171,15 @@ 1.81 port = &(ports[CKT_PORT_D]); 1.82 port->writer = &(islands[CKT_I2]); 1.83 1.84 + //copy checker and doer function pointers into the port 1.85 + port->numWriterCheckerFns = NUM_I2_CHECKERS_INVOLVE_PORT_D; 1.86 + portWriterCheckerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_PORT_D * sizeof(VReoCheckerFn *) ); 1.87 + portWriterDoerFns = PR_WL__malloc( NUM_I2_CHECKERS_INVOLVE_PORT_D * sizeof(VReoDoerFn *) ); 1.88 + portWriterCheckerFns[0] = &Checker_1__I2; 1.89 + portWriterDoerFns[0] = &Doer_1__I2; 1.90 + port->writerCheckerFns = portWriterCheckerFns; 1.91 + port->writerDoerFns = portWriterDoerFns; 1.92 + 1.93 //initialize port 1.94 port->buffer = NULL; 1.95 port->portIsFull = FALSE; 1.96 @@ -292,8 +341,8 @@ 1.97 // anyway, this second go will not satisfy any checkers.. later do an 1.98 // optimization that remembers what triggered, to avoid this redundancy 1.99 islandOnOtherSide = (VReoIsland *)portC->reader; 1.100 - VReo__check_an_island( islandOnOtherSide, islandOnOtherSide->numCheckerFns, 1.101 - islandOnOtherSide->checkerFns, islandOnOtherSide->doerFns ); 1.102 + VReo__check_an_island( islandOnOtherSide, portC->numReaderCheckerFns, 1.103 + portC->readerCheckerFns, portC->readerDoerFns ); 1.104 1.105 //A was made full by the request handler, which wrote buffer and flags 1.106 //A was full, so guaranteed to have a VP waiting to resume 1.107 @@ -314,8 +363,8 @@ 1.108 portC->portIsFull = TRUE; 1.109 1.110 islandOnOtherSide = (VReoIsland *)portC->reader; 1.111 - VReo__check_an_island( islandOnOtherSide, islandOnOtherSide->numCheckerFns, 1.112 - islandOnOtherSide->checkerFns, islandOnOtherSide->doerFns ); 1.113 + VReo__check_an_island( islandOnOtherSide, portC->numReaderCheckerFns, 1.114 + portC->readerCheckerFns, portC->readerDoerFns ); 1.115 1.116 //was full, so guaranteed to have a VP waiting to resume 1.117 PR_PI__make_slave_ready_for_lang( portB->waitingWriterVP, VReo_MAGIC_NUMBER ); 1.118 @@ -372,8 +421,8 @@ 1.119 // anyway, this second go may not satisfy any checkers.. later do an 1.120 // optimization that remembers what triggered, to avoid redundancy 1.121 islandOnOtherSide = (VReoIsland *)portC->writer; 1.122 - VReo__check_an_island( islandOnOtherSide, islandOnOtherSide->numCheckerFns, 1.123 - islandOnOtherSide->checkerFns, islandOnOtherSide->doerFns ); 1.124 + VReo__check_an_island( islandOnOtherSide, portC->numWriterCheckerFns, 1.125 + portC->writerCheckerFns, portC->writerDoerFns ); 1.126 } 1.127 1.128
2.1 --- a/VReo__Test_App/Circuit.h Wed Jun 12 15:13:34 2013 -0700 2.2 +++ b/VReo__Test_App/Circuit.h Tue Jul 09 12:03:20 2013 -0700 2.3 @@ -39,6 +39,15 @@ 2.4 #define CKT_VP2 1 2.5 #define CKT_VP3 2 2.6 2.7 +#define NUM_I1_CHECKERS_INVOLVE_PORT_A 1 2.8 +#define NUM_I1_CHECKERS_INVOLVE_PORT_B 1 2.9 +#define NUM_I1_CHECKERS_INVOLVE_PORT_C 2 2.10 + 2.11 +#define NUM_I2_CHECKERS_INVOLVE_PORT_C 1 2.12 +#define NUM_I2_CHECKERS_INVOLVE_PORT_D 1 2.13 + 2.14 + 2.15 + 2.16 //called by seedVP to create the circuit structs, including ports and islands 2.17 VReoCircuit * 2.18 create_circuit__Test_App( SlaveVP *animVP );
