/**
 * This is a generic tuned configuration file with C++ modules for RPG.
 *
 * It is designed to be included by specialized configurations.
 *
 */

// Include language-independent definitions
#include "../shared.conf"

// The list of modules implemented in C++
core::modules = list (

    // Architectural modules
    #ifndef EXCLUDE_MODULES_ARCHITECTURAL
      "branch",
      "loop-small", "loop-large",
      "sequential-small", 
    // Commented out due to too long execution time.
    // "sequential-large",
    #endif

	// Special modules
	#ifndef EXCLUDE_MODULES_DUMMY
		"dummy",
	#endif
	#ifndef EXCLUDE_MODULES_WAITER
		"waiter",
	#endif

	#ifndef EXCLUDE_MODULES_WORKING

	// Thread safe executable modules.
	//
	// The execution of these modules is not serialized in any way.

// memspeed is too tiny		
//	    "memspeedmp",

	    "calculation-tiny",
	    "calculation-small",

	    "interleave-tiny",
	    "interleave-small",

	    "thrasher-tiny",
	    "thrasher-small",
	
	    "fft-tiny",
	    "fft-small",
	
	    // Thread unsafe executable modules
	    // 
	    // The execution of these modules is serialized in multithreaded applications.
	    
	    "lzw-small",
	    "lzw-medium",

	#ifndef EXCLUDE_MODULES_SPECCPU

	    "lbm-medium",
	    
	    "bzip2-small",
	    "bzip2-medium",
	     
	    "sjeng-small",
	    "sjeng-medium",
	     
	    "libquantum-small",
	    "libquantum-medium",
	
	    "mcf-small",
	    
	#endif

	    // Commented out due to too long execution time.
	    // "namd",
	    // "astar",
    
	#endif

)

//--------------------------------------------------------------------------
// Architectural module configurations.

branch::classname	= "branch"

sequential-small::classname = "sequential"
// sequential-large::classname = "sequential"

loop-small::classname   = "loop"
loop-large::classname   = "loop"


// Relative probabilities of generating individual architectural modules.

loop-small::probability = random-range(min=50, max=75)
loop-large::probability = random-range(min=10, max=25)

branch::probability     = random-range(min=25, max=50)

sequential-small::probability = random-range(min=50, max=75)
// sequential-large::probability = random-range(min=5, max=10)

// Number of slots for each architectural module.
// Architectural modules are recognized by having slots into which other modules are plugged.
// Executable modules have no slots and therefore become primitive components at the architectural level.

loop-small::slots		= 1
loop-large::slots		= 1

branch::slots           = random-range (min=2, max=3)

sequential-small::slots = random-range (min=2, max=5)
// sequential-large::slots = random-range (min=20, max=50)

// Loop

loop-small::loopcount   = parameter (classname = "random-range", min = 3, max = 5)

//loop-large::loopcount   = parameter (classname = "random-geometric", ex = 20)
loop-large::loopcount   = parameter (classname = "random-range", min = 8, max = 10)

//--------------------------------------------------------------------------
// Workload module configurations.

#define MODULE_PROB_RARE	10
#define MODULE_PROB_STANDARD	30
#define MODULE_PROB_FREQUENT	100

// 401.BZip2

MOD_WORK(bzip2-small, bzip2, MODULE_PROB_STANDARD)

bzip2-small::filename       = rand-str-list ( values = list ("input/bzip2-text.html.input", "input/bzip2-dryer.jpg.input", "input/bzip2-lbm-test.input"))
// size of input data for compression [128 KB blocks], the data is memcopied if the input file is smaller
bzip2-small::inputsize      = random-range ( min = 1, max = 2)

MOD_WORK(bzip2-medium, bzip2, MODULE_PROB_STANDARD)

bzip2-medium::filename       = parameter (classname = "string", value = "input/bzip2-input.program.input")
// size of input data for compression [128 KB blocks], the data is memcopied if the input file is smaller
bzip2-medium::inputsize      = random-range (min = 4, max = 32)

// 429.MCF

MOD_WORK(mcf-small, mcf, MODULE_PROB_STANDARD)
mcf-small::filename          = rand-str-list ( values = list ("input/mcf-small1.input", "input/mcf-small2.input", "input/mcf-small3.input", "input/mcf-small4.input"))


// 444.NAMD

MOD_WORK(namd, namd, MODULE_PROB_STANDARD)
namd::filename       	     = parameter (classname 	= "string", value 	= "input/namd.input")
namd::iterations             = parameter (classname 	= "integer", value 	= 1)

// 458.SJENG

MOD_WORK(sjeng-small, sjeng, MODULE_PROB_STANDARD)

sjeng-small::filename      = rand-str-list ( values = list ("input/sjeng-small1.input", "input/sjeng-small2.input", "input/sjeng-small3.input"))

MOD_WORK(sjeng-medium, sjeng, MODULE_PROB_STANDARD)

sjeng-medium::filename      = rand-str-list (values = list ("input/sjeng-medium1.input", "input/sjeng-medium2.input", "input/sjeng-medium3.input", "input/sjeng-medium4.input"))

// 462.LibQuantum

MOD_WORK(libquantum-small, libquantum, MODULE_PROB_STANDARD)

libquantum-small::number1       = rand-int-list (values = list (33, 35, 39, 45, 51, 55))
libquantum-small::number2       = parameter (classname  = "integer", value = 5)

MOD_WORK(libquantum-medium, libquantum, MODULE_PROB_STANDARD)

libquantum-medium::number1       = rand-int-list ( values = list (75, 81, 95, 99, 105, 111, 115, 117, 123, 143))
libquantum-medium::number2       = parameter (classname  = "integer", value = 25)

// 470.LBM

MOD_WORK(lbm-medium, lbm, MODULE_PROB_RARE)
   		
lbm-medium::filename       	= parameter (classname 	= "string", value 	= "input/lbm.input")
lbm-medium::steps		= random-range ( min = 1, max = 3)

// 473.A*

MOD_WORK(astar, astar, MODULE_PROB_STANDARD)
astar::filename       		= parameter (classname 	= "string", value 	= "input/astar-lake.cfg")

// RIB LZW

MOD_WORK(lzw-small, lzw, MODULE_PROB_STANDARD)

lzw-small::filename   	 	 = rand-str-list ( values = list ("input/lzw-bzip2-text.html.input", "input/lzw-bzip2-dryer.jpg.input", "input/lzw-bzip2-byoudoin.jpg.input", "input/bzip2-lbm-test.input"))
lzw-small::maxbits 		 = parameter (classname = "integer", value 	= 16)

MOD_WORK(lzw-medium, lzw, MODULE_PROB_STANDARD)

lzw-medium::filename   	 	 = parameter (classname = "string", value = "input/lzw-bzip2-input.program.input")
lzw-medium::maxbits 	 	 = random-range ( min = 12, max = 16)


// RIP Calculation

MOD_WORK(calculation-tiny, calculation, MODULE_PROB_STANDARD)

calculation-tiny::stepsize   	= 64
calculation-tiny::blocksize  	= rand-int-list ( values = list ( 1048576, 2097152 ))
calculation-tiny::mem-cycles	= random-range ( min = 800000, max = 1200000 )
calculation-tiny::comp-cycles	= random-range ( min = 1, max = 20 )

MOD_WORK(calculation-small, calculation, MODULE_PROB_STANDARD)

calculation-small::stepsize   	= 64
calculation-small::blocksize  	= rand-int-list ( values = list ( 4194304, 8388608 ))
calculation-small::mem-cycles	= random-range ( min = 1600000, max = 2400000 )
calculation-small::comp-cycles	= random-range ( min = 20, max = 100 )

// RIP FFT

MOD_WORK(fft-tiny, fft, MODULE_PROB_STANDARD)

fft-tiny::method   		= parameter (classname ="string", value = "separate")
fft-tiny::bufsize 		= parameter (classname = "integer", value = 1048576)

MOD_WORK(fft-small, fft, MODULE_PROB_STANDARD)

fft-small::method   		= parameter (classname ="string", value = "separate")
fft-small::bufsize 		= parameter (classname = "integer", value = 4194304)


// RIP Interleave

MOD_WORK(interleave-tiny, interleave, MODULE_PROB_STANDARD)

interleave-tiny::stepsize	= 64
interleave-tiny::blocksize	= rand-int-list ( values = list ( 1048576, 2097152 ))
interleave-tiny::pointers	= 16
interleave-tiny::hops		= rand-int-list ( values = list ( 16, 32, 64, 128, 256, 512, 1024 ))

MOD_WORK(interleave-small, interleave, MODULE_PROB_STANDARD)

interleave-small::stepsize	= 64
interleave-small::blocksize	= rand-int-list ( values = list ( 4194304, 8388608 ))
interleave-small::pointers	= 32
interleave-small::hops		= rand-int-list ( values = list ( 128, 256, 512, 1024 ))

// RIP MemSpeedMP

MOD_WORK(memspeedmp, memspeedmp, MODULE_PROB_STANDARD)

memspeedmp::access   		= rand-str-list (values = list ("linear", "random"))
memspeedmp::stepsize 		= 64
memspeedmp::memsize  		= 1048576
memspeedmp::write    		= rand-int-list ( values = list ( 0, 1 ))
memspeedmp::nopcount 		= random-range (min = 2, max = 10)
memspeedmp::maxnopsinfunc 	= random-range (min = 2, max = 10)
memspeedmp::pointers 		= 128

// RIP Thrasher

MOD_WORK(thrasher-tiny, thrasher, MODULE_PROB_STANDARD)

thrasher-tiny::access   	= rand-str-list (values = list ("linear", "random"))
thrasher-tiny::stepsize 	= 64
thrasher-tiny::memsize  	= rand-int-list ( values = list ( 1048576, 2097152 ))
thrasher-tiny::write    	= rand-int-list ( values = list ( 0, 1 ))
thrasher-tiny::nopcount 	= random-range (min = 10, max = 100)
thrasher-tiny::maxnopsinfunc	= 1000
thrasher-tiny::pointers 	= 16
thrasher-tiny::steps		= random-range (min = 80000, max = 120000 )

MOD_WORK(thrasher-small, thrasher, MODULE_PROB_STANDARD)

thrasher-small::access   	= rand-str-list (values = list ("linear", "random"))
thrasher-small::stepsize 	= 64
thrasher-small::memsize  	= rand-int-list ( values = list ( 4194304, 8388608 ))
thrasher-small::write    	= rand-int-list ( values = list ( 0, 1 ))
thrasher-small::nopcount 	= random-range (min = 50, max = 100)
thrasher-small::maxnopsinfunc	= 1000
thrasher-small::pointers 	= 64
thrasher-small::steps		= random-range (min = 400000, max = 600000 )

// Waiter

MOD_WORK(waiter, waiter, MODULE_PROB_RARE)
waiter::wait-ms    		= parameter (classname = "random-range", min=50, max=250)

// Dummy

MOD_WORK(dummy, dummy, MODULE_PROB_RARE)
