From 3ba60c6f52c1262e50de974f66cf5e5ca7192fbd Mon Sep 17 00:00:00 2001 From: Sophie Mao Date: Mon, 22 Aug 2022 13:17:32 -0700 Subject: [PATCH] globals: parse simulation project directory environment variable when CL_CONTEXT_MPSIM_DEVICE_INTELFPGA is not set to force simulation flow --- include/acl.h | 2 ++ src/acl_globals.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/acl.h b/include/acl.h index 7895e772..6f5e24c3 100644 --- a/include/acl.h +++ b/include/acl.h @@ -266,6 +266,8 @@ typedef struct { /* Must match definition in aoc.pl */ #define ACL_MPSIM_DEVICE_NAME "SimulatorDevice" +/* Specifies which device simulator should simulate */ +#define INTELFPGA_SIM_DEVICE_SPEC_DIR "INTELFPGA_SIM_DEVICE_SPEC_DIR" #define ACL_RAND_HASH_SIZE 40 diff --git a/src/acl_globals.cpp b/src/acl_globals.cpp index 483aa8ee..64bbb1de 100644 --- a/src/acl_globals.cpp +++ b/src/acl_globals.cpp @@ -109,6 +109,11 @@ const char *acl_get_offline_device_user_setting(int *use_offline_only_ret) { } else { // Look for multi-process simulator before old simulator. setting = acl_getenv("CL_CONTEXT_MPSIM_DEVICE_INTELFPGA"); + // Check if simulation board spec directory is set, which implies + // CL_CONTEXT_MPSIM_DEVICE_INTELFPGA if that is not set + if (!setting && acl_getenv(INTELFPGA_SIM_DEVICE_SPEC_DIR)) { + setting = "1"; // Use 1 simulator device by default + } if (setting) { use_offline_only = ACL_CONTEXT_MPSIM; result = setting;