FPGAというより、コンピュータアーキテクチャかもね! カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages/






# include_directories(../vendor/gflags/include/)
set (gflags_SHARED    TRUE)
set (gflags_NOTHREADS TRUE)
include_directories ("../vendor/gflags/build/include/")
set (gflags_DIR "../vendor/gflags/build/")
find_package(gflags REQUIRED)

find_package (Threads)



add_executable (../swimmer_riscv
               swimmer_main.cpp env.cpp simulation.cpp trace.cpp inst_print.cpp inst_mnemonic.cpp inst_riscv_init.cpp
               inst_decoder.cpp inst_riscv.cpp inst_operand.cpp dec_utils.cpp
               sysreg_rw.cpp sysreg_func.cpp sysreg_str.cpp memory_block.cpp
target_link_libraries (../swimmer_riscv gflags)
target_link_libraries (../swimmer_riscv ${CMAKE_THREAD_LIBS_INIT})



// FLAGs definition
DEFINE_string (hexfile, "", "hex file to simulate.");
DEFINE_bool (debug, false, "generate debug log");
DEFINE_string (debugfile, "", "output log filename");
DEFINE_int64 (max, 65535, "max instructions to simulate");
DEFINE_string (init_pc, "0x00000000", "initial program counter value");
DEFINE_bool (stop_host, true, "Stop simulation by accessing MTOHOST");


int main (int argc, char *argv[])
    FILE *hexfp;
    FILE *debugfp = stdout;

    char debug_out = false;
    std::string debug_filename,

    gflags::SetUsageMessage("Swimmer-RISCV: RISC-V instruction set simulator");
    gflags::ParseCommandLineFlags (&argc, &argv, true); //% parse command line by gflags


swimmer_riscv: Swimmer-RISCV: RISC-V instruction set simulator

  Flags from /home/masayuki/work/swimmer_riscv/src_cpp/swimmer_main.cpp:
    -debug (generate debug log) type: bool default: false
    -debugfile (output log filename) type: string default: ""
    -hexfile (hex file to simulate.) type: string default: ""
    -init_pc (initial program counter value) type: string default: "0x00000000"
    -max (max instructions to simulate) type: int64 default: 65535
    -stop_host (Stop simulation by accessing MTOHOST) type: bool default: true

  Flags from /home/masayuki/work/swimmer_riscv/vendor/gflags/src/gflags.cc:
    -flagfile (load flags from file) type: string default: ""
    -fromenv (set flags from the environment [use 'export FLAGS_flag1=value'])
      type: string default: ""
    -tryfromenv (set flags from the environment if present) type: string
      default: ""
    -undefok (comma-separated list of flag names that it is okay to specify on
      the command line even if the program does not define a flag with that
      name.  IMPORTANT: flags in this list that have arguments MUST use the
      flag=value format) type: string default: ""

  Flags from /home/masayuki/work/swimmer_riscv/vendor/gflags/src/gflags_completions.cc:
    -tab_completion_columns (Number of columns to use in output for tab
      completion) type: int32 default: 80
    -tab_completion_word (If non-empty, HandleCommandLineCompletions() will
      hijack the process and attempt to do bash-style command line flag
      completion on this value.) type: string default: ""

  Flags from /home/masayuki/work/swimmer_riscv/vendor/gflags/src/gflags_reporting.cc:
    -help (show help on all flags [tip: all flags can have two dashes])
      type: bool default: false currently: true
    -helpfull (show help on all flags -- same as -help) type: bool
      default: false
    -helpmatch (show help on modules whose name contains the specified substr)
      type: string default: ""
    -helpon (show help on the modules named by this flag value) type: string
      default: ""
    -helppackage (show help on all modules in the main package) type: bool
      default: false
    -helpshort (show help on only the main module for this program) type: bool
      default: false
    -helpxml (produce an xml version of help) type: bool default: false
    -version (show version and build info and exit) type: bool default: false