summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli/cli.cc2
-rw-r--r--src/main.cc43
-rw-r--r--src/storage/dram.cc4
3 files changed, 25 insertions, 24 deletions
diff --git a/src/cli/cli.cc b/src/cli/cli.cc
index 41ac57c..e25b316 100644
--- a/src/cli/cli.cc
+++ b/src/cli/cli.cc
@@ -211,7 +211,7 @@ void Cli::initialize()
if (this->cache != nullptr)
delete this->cache;
- Dram *d = new Dram(MEM_LINES, MEM_DELAY);
+ Dram *d = new Dram(MEM_DELAY);
this->cache = new Cache(d, L1_CACHE_DELAY);
this->cycle = 1;
}
diff --git a/src/main.cc b/src/main.cc
index 08b38e6..f5eecac 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -1,6 +1,6 @@
#include "cli.h"
-#include "logger.h"
#include "definitions.h"
+#include "logger.h"
#include <getopt.h>
#include <iostream>
@@ -22,36 +22,39 @@ static std::string banner =
" _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ \n"
" _/ _/ _/_/_/_/ _/_/_/ _/ _/_/ _/ _/ _/ \n"
" _/_/ _/_/ ";
-static void print_version_number() { std::cout << banner << version_number << '\n'; }
+static void print_version_number()
+{
+ std::cout << banner << version_number << '\n';
+}
static void err()
{
std::cerr << "Usage:\n\trisc_vector [OPTIONS]\nOptions:\n\t--debug,\t-d: "
- "turn on verbose output\n\t--no-python,\t-p: run without "
- "GUI\n\t--version,\t-v: print the version information and exit\n"
+ "turn on verbose output\n\t--memory-only,\t-m: run the memory "
+ "simulator only, without a GUI.\n\t--version,\t-v: print the "
+ "version information and exit\n"
<< std::endl;
}
-static void parseArguments(int argc, char **argv, bool &python)
+static void
+parseArguments(int argc, char **argv, bool &memory_only)
{
struct option long_options[] = {
{"debug", no_argument, 0, 'd'},
- {"no-python", no_argument, 0, 'p'},
+ {"memory-only", no_argument, 0, 'm'},
{0, 0, 0, 0}};
- python = true;
-
int opt;
- while ((opt = getopt_long(argc, argv, "d:p", long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "d:m", long_options, NULL)) != -1) {
switch (opt) {
case 'd':
global_log->setLevel(DEBUG);
global_log->log(DEBUG, "DEBUG output enabled.");
break;
- case 'p':
- global_log->log(INFO, "Python will NOT be started!");
- python = false;
+ case 'm':
+ global_log->log(INFO, "Starting the storage CLI interface...");
+ memory_only = true;
break;
default:
err();
@@ -63,20 +66,18 @@ static void parseArguments(int argc, char **argv, bool &python)
int main(int argc, char **argv)
{
print_version_number();
- Cli cli;
global_log->log(INFO, "Initializing...");
- bool python = true;
- parseArguments(argc, argv, python);
+ bool memory_only = false;
+ parseArguments(argc, argv, memory_only);
- if (python) {
- // fork off python here
- ;
- global_log->log(INFO, "Python started.");
+ if (memory_only) {
+ Cli cli;
+ cli.run();
}
- cli.run();
-
+ // fork off python here
+ global_log->log(INFO, "Python started.");
global_log->log(INFO, "Cleaning up...");
global_log->log(INFO, "Goodbye!");
return EXIT_SUCCESS;
diff --git a/src/storage/dram.cc b/src/storage/dram.cc
index 56eec47..20db47e 100644
--- a/src/storage/dram.cc
+++ b/src/storage/dram.cc
@@ -8,10 +8,10 @@
#include <iterator>
#include <utils.h>
-Dram::Dram(int lines, int delay)
+Dram::Dram(int delay)
{
this->data = new std::vector<std::array<signed int, LINE_SIZE>>;
- this->data->resize(lines);
+ this->data->resize(MEM_LINES);
this->delay = delay;
this->is_waiting = false;
this->lower = nullptr;