aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.h27
-rw-r--r--include/instset.h4
-rw-r--r--include/salis.h6
3 files changed, 26 insertions, 11 deletions
diff --git a/include/common.h b/include/common.h
index 7386a34..50ac563 100644
--- a/include/common.h
+++ b/include/common.h
@@ -2,17 +2,34 @@
* @file common.h
* @author Paul Oliver
*
-* This module controls the 'common pipe', which is the FIFO file through which
+* This module controls the common sender and receiver functors, through which
* communication between different simulations can occur. By calling SEND,
-* processes may output local instructions through the pipe. These instructions
-* may then be read by processes running on a different simulation instance.
+* processes may output local instructions through a network. These instructions
+* may then be read by processes running on a different simulation somewhere
+* else.
*/
#ifndef SALIS_COMMON_H
#define SALIS_COMMON_H
-void _sal_comm_init(string pipe);
-void _sal_comm_quit(void);
+/* Typedef sender functor type for easy python parsing.
+*/
+typedef void (*Sender)(uint8 inst);
+
+/* Typedef receiver functor type for easy python parsing.
+*/
+typedef uint8 (*Receiver)(void);
+
+/* Set sender functor. When unset, SEND instruction does nothing.
+* @param sender Sender functor
+*/
+SALIS_API void sal_comm_set_sender(Sender sender);
+
+/* Set receiver functor. When unset, RCVE instruction does nothing.
+* @param receiver Receiver functor
+*/
+SALIS_API void sal_comm_set_receiver(Receiver receiver);
+
void _sal_comm_send(uint8 inst);
uint8 _sal_comm_receive(void);
diff --git a/include/instset.h b/include/instset.h
index eeb4600..a7f4773 100644
--- a/include/instset.h
+++ b/include/instset.h
@@ -44,8 +44,8 @@ enum {
SALIS_INST DIVN, /**< / Divide two registers */
SALIS_INST LOAD, /**< L Load instruction from memory */
SALIS_INST WRTE, /**< W Write instruction into memory */
- SALIS_INST SEND, /**< S Send instruction to common pipe */
- SALIS_INST RECV, /**< R Receive instruction from common pipe */
+ SALIS_INST SEND, /**< S Send instruction to common sender */
+ SALIS_INST RECV, /**< R Receive instruction from common receiver */
SALIS_INST PSHN, /**< # Push value to stack */
SALIS_INST POPN /**< ~ Pop value from stack */
};
diff --git a/include/salis.h b/include/salis.h
index 8b261b1..75ef9dd 100644
--- a/include/salis.h
+++ b/include/salis.h
@@ -22,9 +22,8 @@
/** Initialize Salis simulation.
* @param order Order of memory (memory_size == 1 << order)
-* @param pipe Desired path and file name of common pipe
*/
-SALIS_API void sal_main_init(uint32 order, string pipe);
+SALIS_API void sal_main_init(uint32 order);
/** Free resources and quit Salis.
*/
@@ -32,9 +31,8 @@ SALIS_API void sal_main_quit(void);
/** Load existing Salis simulation from saved file.
* @param file_name Path of the save file to be loaded
-* @param pipe Desired path and file name of common pipe
*/
-SALIS_API void sal_main_load(string file_name, string pipe);
+SALIS_API void sal_main_load(string file_name);
/** Save Salis simulation to a file.
* @param file_name Path of the save file to be created