NVMain can be run either using traces or connected to a CPU simulator. At the moment, NVMain supports it's own trace format and traces from GEMS or gem5. Supported simulators include gem5.

Trace Simulation

Trace simulation can be performed by simply running NVMain for the desired number of CPU cycles:

./nvmain Config/myConfig.config traces/myTrace.nvt 1000000

In this example, NVMain will configure the system using the parameters from the Config/myConfig.config file and run the memory trace traces/myTrace.nvt for 1000000 cycles.

Note that the cycle count corresponds to the number of memory cycles. The memory controllers are assumed to run at the same rate as the system clock. The difference between these two can be determined by dividing CPUFreq / CLK, where CLK and CPUFreq are defined in the configuration file.

Setting the number of cycles to run as 0 will run the entire trace file. NVMain will exit after the the last line of the trace is read.

gem5 Simulation

As of NVMain commit 133 and gem5 version 9793, NVMain no longer requires it's own gem5 configuration scripts, so you may use your own or any other example script provided. Below is an example of running gem5 using NVMain once the NVMain patch has been applied (See Compiling). This example will run the binary "hello_world" found in the current directory in system emulation mode:

build/X86/ configs/example/ -c hello_world --cpu-type=detailed --caches --l2cache --mem-type=NVMainMemory --nvmain-config=/path/to/nvmain/Config/myConfig.config

NVMain must be enabled by providing the --mem-type=NVMainMemory option. Furthermore, NVMain requires that a configuration file be specified. A configuration file can be specified using the --nvmain-config=/path/to/nvmain/Config/myConfig.config option.

Note that current gem5 revisions use the atomic CPU model by default. NVMain is NOT enabled by default when the atomic CPU model is used, since this model is typically used for fast-forwarding and warmups. To enable nvmain in the atomic CPU model, use the --nvmain-atomic option. Note that cycle accurate simulation is not possible using this CPU model. A mean and variance for NVMain using the atomic CPU can be set using the --nvmain-atomic-latency=100ns and --nvmain-atomic-variance=10ns parameters, where the mean is 100ns and variance is 10ns in this example.

It may be desirable to override parameter values in the nvmain configuration files, for example, to run sweeps with different memory parameter values. Any parameter in the NVMain configuration file can be overridden using the --nvmain-PARAM option, where PARAM is the name of any configuration parameter available to nvmain. For example, if we wish to test various address mapping schemes, we can modify the scheme as follows: --nvmain-AddressMappingScheme=SA:R:RK:BK:CH:C. Since AddressMappingScheme is a parameter in the NVMain configuration file, this parameter will be changed to the value provided on the gem5 command line.

The final configuration option for NVMain is the warmup option. This option will run NVMain when the atomic CPU is running. This is useful for memory configurations containing caches, such as a DRAM cache, that may need to be warmed-up before detailed simulation begins. This can be enabled using the --nvmain-warmup option.

A list of available options can be found by running gem5 with the --help option and looking for options beginning with --nvmain.