Full Code of cvut/qtrvsim for AI

master 4798b0b7d13b cached
380 files
1.7 MB
511.7k tokens
704 symbols
1 requests
Download .txt
Showing preview only (1,895K chars total). Download the full file or copy to clipboard to get everything.
Repository: cvut/qtrvsim
Branch: master
Commit: 4798b0b7d13b
Files: 380
Total size: 1.7 MB

Directory structure:
gitextract_up_kab8w/

├── .github/
│   └── workflows/
│       ├── debug.yml
│       ├── docs.yml
│       └── release.yml
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── LICENSE
├── Makefile
├── README.md
├── cmake/
│   ├── AddFileHashes.cmake
│   ├── BuildType.cmake
│   ├── BundleMacOS.cmake
│   ├── CopyrightTools.cmake
│   ├── FindElfUtils.cmake
│   ├── FindLibElf.cmake
│   ├── FindPythonInterp.cmake
│   ├── GPL-3.0-or-later.cmake
│   ├── LibElfinSettings.cmake
│   ├── PackageTools.cmake
│   └── TestingTools.cmake
├── data/
│   ├── cz.cvut.edu.comparch.qtrvsim.metainfo.xml.in
│   ├── gui.desktop.in
│   ├── icons/
│   │   └── macos/
│   │       └── gui.icns
│   └── wasm/
│       ├── browserconfig.xml
│       ├── index.html
│       └── manifest.json
├── default.nix
├── docs/
│   ├── developer/
│   │   ├── build&deploy/
│   │   │   ├── building-wasm.md
│   │   │   └── release.md
│   │   ├── coreview-graphics/
│   │   │   └── using-drawio-diagram.md
│   │   ├── debuging/
│   │   │   ├── logging.md
│   │   │   └── sanitizers.md
│   │   └── need-to-know.md
│   └── user/
│       ├── SUMMARY.md
│       ├── basics/
│       │   ├── basics_of_user_interface.md
│       │   ├── first_launch.md
│       │   ├── getting_started.md
│       │   ├── menus_and_the_toolbar.md
│       │   └── writing_programs.md
│       ├── book.toml
│       ├── introduction.md
│       └── reference/
│           ├── advanced_configuration/
│           │   └── environment_variables.md
│           ├── advanced_configuration.md
│           └── external_toolchains.md
├── external/
│   ├── compiler/
│   │   ├── compile.sh
│   │   └── config
│   └── svgscene/
│       ├── CMakeLists.txt
│       ├── LICENSE
│       ├── README.md
│       └── src/
│           ├── example/
│           │   ├── main.cpp
│           │   ├── mainwindow.cpp
│           │   ├── mainwindow.h
│           │   └── mainwindow.ui
│           └── svgscene/
│               ├── components/
│               │   ├── groupitem.cpp
│               │   ├── groupitem.h
│               │   ├── hyperlinkitem.cpp
│               │   ├── hyperlinkitem.h
│               │   ├── simpletextitem.cpp
│               │   └── simpletextitem.h
│               ├── graphicsview/
│               │   ├── svggraphicsview.cpp
│               │   └── svggraphicsview.h
│               ├── polyfills/
│               │   └── qt5/
│               │       ├── qstringview.h
│               │       └── qwheelevent.h
│               ├── svgdocument.cpp
│               ├── svgdocument.h
│               ├── svggraphicsscene.cpp
│               ├── svggraphicsscene.h
│               ├── svghandler.cpp
│               ├── svghandler.h
│               ├── svgmetadata.cpp
│               ├── svgmetadata.h
│               ├── svgspec.h
│               └── utils/
│                   ├── logging.h
│                   └── memory_ownership.h
├── extras/
│   ├── building/
│   │   └── build-wasm.sh
│   ├── core_graphics/
│   │   └── diagram.drawio
│   ├── crosscompiling/
│   │   ├── shell-mips-elf.nix
│   │   ├── shell-riscv-elf-with-newlib.nix
│   │   └── shell-riscv-elf.nix
│   └── packaging/
│       ├── _tools/
│       │   ├── add-to-changelog.sh
│       │   └── git-archive-submodules.sh
│       ├── add-to-changelog.sh
│       ├── appimage/
│       │   └── appimage.yml.in
│       ├── arch/
│       │   └── PKGBUILD.in
│       ├── deb/
│       │   ├── debian/
│       │   │   ├── changelog
│       │   │   ├── compat
│       │   │   ├── control.in
│       │   │   ├── copyright
│       │   │   ├── docs
│       │   │   ├── rules
│       │   │   └── source/
│       │   │       └── format
│       │   └── dsc.in
│       ├── flatpak/
│       │   └── cz.cvut.edu.comparch.qtrvsim.json
│       ├── mingw/
│       │   └── cmake-i686-w64-mingw32.conf
│       ├── nix/
│       │   └── qtrvsim.nix
│       └── rpm/
│           └── spec.in
├── qtlogging.ini
├── src/
│   ├── assembler/
│   │   ├── CMakeLists.txt
│   │   ├── fixmatheval.cpp
│   │   ├── fixmatheval.h
│   │   ├── messagetype.h
│   │   ├── simpleasm.cpp
│   │   └── simpleasm.h
│   ├── cli/
│   │   ├── CMakeLists.txt
│   │   ├── chariohandler.cpp
│   │   ├── chariohandler.h
│   │   ├── main.cpp
│   │   ├── msgreport.cpp
│   │   ├── msgreport.h
│   │   ├── reporter.cpp
│   │   ├── reporter.h
│   │   ├── tracer.cpp
│   │   └── tracer.h
│   ├── common/
│   │   ├── CMakeLists.txt
│   │   ├── containers/
│   │   │   └── cvector.h
│   │   ├── endian.h
│   │   ├── logging.h
│   │   ├── logging_format_colors.h
│   │   ├── math/
│   │   │   └── bit_ops.h
│   │   ├── memory_ownership.h
│   │   ├── polyfills/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── byteswap.h
│   │   │   ├── clz32.h
│   │   │   ├── endian_detection.h
│   │   │   ├── mulh64.h
│   │   │   ├── mulh64.test.cpp
│   │   │   ├── mulh64.test.h
│   │   │   ├── qstring_hash.h
│   │   │   └── qt5/
│   │   │       ├── qfontmetrics.h
│   │   │       ├── qlinef.h
│   │   │       └── qtableview.h
│   │   ├── string_utils.h
│   │   └── type_utils/
│   │       └── lens.h
│   ├── gui/
│   │   ├── CMakeLists.txt
│   │   ├── dialogs/
│   │   │   ├── about/
│   │   │   │   ├── aboutdialog.cpp
│   │   │   │   └── aboutdialog.h
│   │   │   ├── gotosymbol/
│   │   │   │   ├── gotosymboldialog.cpp
│   │   │   │   ├── gotosymboldialog.h
│   │   │   │   └── gotosymboldialog.ui
│   │   │   ├── new/
│   │   │   │   ├── NewDialog.ui
│   │   │   │   ├── NewDialogCache.ui
│   │   │   │   ├── newdialog.cpp
│   │   │   │   └── newdialog.h
│   │   │   └── savechanged/
│   │   │       ├── savechangeddialog.cpp
│   │   │       └── savechangeddialog.h
│   │   ├── extprocess.cpp
│   │   ├── extprocess.h
│   │   ├── fontsize.cpp
│   │   ├── fontsize.h
│   │   ├── graphicsview.cpp
│   │   ├── graphicsview.h
│   │   ├── helper/
│   │   │   └── async_modal.h
│   │   ├── hinttabledelegate.cpp
│   │   ├── hinttabledelegate.h
│   │   ├── main.cpp
│   │   ├── mainwindow/
│   │   │   ├── MainWindow.ui
│   │   │   ├── mainwindow.cpp
│   │   │   └── mainwindow.h
│   │   ├── qhtml5file.h
│   │   ├── qhtml5file_html5.cpp
│   │   ├── resources/
│   │   │   ├── icons/
│   │   │   │   ├── gui.icns
│   │   │   │   └── icons.qrc
│   │   │   └── samples/
│   │   │       ├── samples.qrc
│   │   │       ├── simple-lw-sw-ia.S
│   │   │       ├── template-os.S
│   │   │       └── template.S
│   │   ├── statictable.cpp
│   │   ├── statictable.h
│   │   ├── textsignalaction.cpp
│   │   ├── textsignalaction.h
│   │   ├── ui/
│   │   │   ├── hexlineedit.cpp
│   │   │   ├── hexlineedit.h
│   │   │   ├── pow2spinbox.cpp
│   │   │   └── pow2spinbox.h
│   │   ├── widgets/
│   │   │   ├── hidingtabwidget.cpp
│   │   │   └── hidingtabwidget.h
│   │   └── windows/
│   │       ├── cache/
│   │       │   ├── cachedock.cpp
│   │       │   ├── cachedock.h
│   │       │   ├── cacheview.cpp
│   │       │   └── cacheview.h
│   │       ├── coreview/
│   │       │   ├── components/
│   │       │   │   ├── cache.cpp
│   │       │   │   ├── cache.h
│   │       │   │   ├── value_handlers.cpp
│   │       │   │   └── value_handlers.h
│   │       │   ├── data.h
│   │       │   ├── scene.cpp
│   │       │   ├── scene.h
│   │       │   └── schemas/
│   │       │       └── schemas.qrc
│   │       ├── csr/
│   │       │   ├── csrdock.cpp
│   │       │   └── csrdock.h
│   │       ├── editor/
│   │       │   ├── editordock.cpp
│   │       │   ├── editordock.h
│   │       │   ├── editortab.cpp
│   │       │   ├── editortab.h
│   │       │   ├── highlighterasm.cpp
│   │       │   ├── highlighterasm.h
│   │       │   ├── highlighterc.cpp
│   │       │   ├── highlighterc.h
│   │       │   ├── linenumberarea.cpp
│   │       │   ├── linenumberarea.h
│   │       │   ├── srceditor.cpp
│   │       │   └── srceditor.h
│   │       ├── lcd/
│   │       │   ├── lcddisplaydock.cpp
│   │       │   ├── lcddisplaydock.h
│   │       │   ├── lcddisplayview.cpp
│   │       │   └── lcddisplayview.h
│   │       ├── memory/
│   │       │   ├── memorydock.cpp
│   │       │   ├── memorydock.h
│   │       │   ├── memorymodel.cpp
│   │       │   ├── memorymodel.h
│   │       │   ├── memorytableview.cpp
│   │       │   └── memorytableview.h
│   │       ├── messages/
│   │       │   ├── messagesdock.cpp
│   │       │   ├── messagesdock.h
│   │       │   ├── messagesmodel.cpp
│   │       │   ├── messagesmodel.h
│   │       │   ├── messagesview.cpp
│   │       │   └── messagesview.h
│   │       ├── peripherals/
│   │       │   ├── peripheralsdock.cpp
│   │       │   ├── peripheralsdock.h
│   │       │   ├── peripheralsview.cpp
│   │       │   ├── peripheralsview.h
│   │       │   └── peripheralsview.ui
│   │       ├── predictor/
│   │       │   ├── predictor_bht_dock.cpp
│   │       │   ├── predictor_bht_dock.h
│   │       │   ├── predictor_btb_dock.cpp
│   │       │   ├── predictor_btb_dock.h
│   │       │   ├── predictor_info_dock.cpp
│   │       │   └── predictor_info_dock.h
│   │       ├── program/
│   │       │   ├── programdock.cpp
│   │       │   ├── programdock.h
│   │       │   ├── programmodel.cpp
│   │       │   ├── programmodel.h
│   │       │   ├── programtableview.cpp
│   │       │   └── programtableview.h
│   │       ├── registers/
│   │       │   ├── registersdock.cpp
│   │       │   └── registersdock.h
│   │       ├── terminal/
│   │       │   ├── terminaldock.cpp
│   │       │   └── terminaldock.h
│   │       └── tlb/
│   │           ├── tlbdock.cpp
│   │           ├── tlbdock.h
│   │           ├── tlbview.cpp
│   │           └── tlbview.h
│   ├── machine/
│   │   ├── CMakeLists.txt
│   │   ├── bitfield.h
│   │   ├── config_isa.h
│   │   ├── core/
│   │   │   └── core_state.h
│   │   ├── core.cpp
│   │   ├── core.h
│   │   ├── core.test.cpp
│   │   ├── core.test.h
│   │   ├── csr/
│   │   │   ├── address.h
│   │   │   ├── controlstate.cpp
│   │   │   └── controlstate.h
│   │   ├── execute/
│   │   │   ├── alu.cpp
│   │   │   ├── alu.h
│   │   │   ├── alu.test.cpp
│   │   │   ├── alu.test.h
│   │   │   ├── alu_op.h
│   │   │   └── mul_op.h
│   │   ├── instruction.cpp
│   │   ├── instruction.h
│   │   ├── instruction.test.cpp
│   │   ├── instruction.test.h
│   │   ├── machine.cpp
│   │   ├── machine.h
│   │   ├── machineconfig.cpp
│   │   ├── machineconfig.h
│   │   ├── machinedefs.h
│   │   ├── memory/
│   │   │   ├── address.h
│   │   │   ├── address_range.h
│   │   │   ├── address_with_mode.h
│   │   │   ├── backend/
│   │   │   │   ├── aclintmswi.cpp
│   │   │   │   ├── aclintmswi.h
│   │   │   │   ├── aclintmtimer.cpp
│   │   │   │   ├── aclintmtimer.h
│   │   │   │   ├── aclintsswi.cpp
│   │   │   │   ├── aclintsswi.h
│   │   │   │   ├── backend_memory.h
│   │   │   │   ├── lcddisplay.cpp
│   │   │   │   ├── lcddisplay.h
│   │   │   │   ├── memory.cpp
│   │   │   │   ├── memory.h
│   │   │   │   ├── memory.test.cpp
│   │   │   │   ├── memory.test.h
│   │   │   │   ├── peripheral.cpp
│   │   │   │   ├── peripheral.h
│   │   │   │   ├── peripspiled.cpp
│   │   │   │   ├── peripspiled.h
│   │   │   │   ├── serialport.cpp
│   │   │   │   └── serialport.h
│   │   │   ├── cache/
│   │   │   │   ├── cache.cpp
│   │   │   │   ├── cache.h
│   │   │   │   ├── cache.test.cpp
│   │   │   │   ├── cache.test.h
│   │   │   │   ├── cache_policy.cpp
│   │   │   │   ├── cache_policy.h
│   │   │   │   └── cache_types.h
│   │   │   ├── frontend_memory.cpp
│   │   │   ├── frontend_memory.h
│   │   │   ├── memory_bus.cpp
│   │   │   ├── memory_bus.h
│   │   │   ├── memory_utils.h
│   │   │   ├── tlb/
│   │   │   │   ├── tlb.cpp
│   │   │   │   ├── tlb.h
│   │   │   │   ├── tlb_policy.cpp
│   │   │   │   └── tlb_policy.h
│   │   │   └── virtual/
│   │   │       ├── page_table_walker.cpp
│   │   │       ├── page_table_walker.h
│   │   │       ├── sv32.h
│   │   │       └── virtual_address.h
│   │   ├── pipeline.h
│   │   ├── predictor.cpp
│   │   ├── predictor.h
│   │   ├── predictor_types.h
│   │   ├── programloader.cpp
│   │   ├── programloader.h
│   │   ├── programloader.test.cpp
│   │   ├── programloader.test.h
│   │   ├── register_value.h
│   │   ├── registers.cpp
│   │   ├── registers.h
│   │   ├── registers.test.cpp
│   │   ├── registers.test.h
│   │   ├── simulator_exception.cpp
│   │   ├── simulator_exception.h
│   │   ├── symboltable.cpp
│   │   ├── symboltable.h
│   │   ├── tests/
│   │   │   ├── data/
│   │   │   │   └── cache_test_performance_data.h
│   │   │   └── utils/
│   │   │       └── integer_decomposition.h
│   │   └── utils.h
│   ├── os_emulation/
│   │   ├── CMakeLists.txt
│   │   ├── ossyscall.cpp
│   │   ├── ossyscall.h
│   │   ├── posix_polyfill.h
│   │   ├── syscall_nr.h
│   │   ├── syscallent.h
│   │   └── target_errno.h
│   └── project_info.h.in
└── tests/
    ├── cli/
    │   ├── asm_error/
    │   │   └── program.S
    │   ├── modifiers/
    │   │   ├── program.S
    │   │   └── stdout.txt
    │   ├── modifiers-pcrel/
    │   │   ├── program.S
    │   │   └── stdout.txt
    │   ├── stalls/
    │   │   ├── program.S
    │   │   └── stdout.txt
    │   └── virtual_memory/
    │       ├── dtlb/
    │       │   ├── program.S
    │       │   └── stdout.txt
    │       ├── exec/
    │       │   ├── program.S
    │       │   └── stdout.txt
    │       ├── itlb/
    │       │   ├── program.S
    │       │   └── stdout.txt
    │       ├── memrw/
    │       │   ├── program.S
    │       │   └── stdout.txt
    │       └── template/
    │           ├── program.S
    │           └── stdout.txt
    ├── riscv-official/
    │   ├── .gitignore
    │   ├── README.md
    │   ├── code/
    │   │   ├── constants.py
    │   │   ├── helpers.py
    │   │   ├── myparse.py
    │   │   ├── selftesting.py
    │   │   └── testing.py
    │   ├── env/
    │   │   └── p/
    │   │       ├── BackUp/
    │   │       │   └── riscv_test.h
    │   │       ├── link.ld
    │   │       └── riscv_test.h
    │   ├── isa/
    │   │   ├── .gitignore
    │   │   ├── Makefile
    │   │   ├── selftests/
    │   │   │   ├── Makefile
    │   │   │   ├── options_test.sh
    │   │   │   └── tests/
    │   │   │       ├── addi-fail32.S
    │   │   │       ├── addi-fail64.S
    │   │   │       ├── simple-fail32.S
    │   │   │       ├── simple-fail64.S
    │   │   │       ├── simple-pass32.S
    │   │   │       └── simple-pass64.S
    │   │   └── toolchain_setup
    │   └── qtrvsim_tester.py
    └── stud-support/
        ├── build_tests.py
        └── run_tests.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/workflows/debug.yml
================================================
name: Debug

on:
  push:
    paths-ignore:
      - "**/*.md"
      - "docs/**"
  pull_request:
    paths-ignore:
      - "**/*.md"
      - "docs/**"
  merge_group:
    paths-ignore:
      - "**/*.md"
      - "docs/**"
  workflow_dispatch:

jobs:
  build:
    name: ${{ matrix.config.name }}
    env:
      QtLatestVersion: &QtLatest "6.10.1"
      QtBrewVersion: &QtBrew "6.9.3"
      QtMinimalVersion: &QtMinimal "5.12.0"
    needs: [build-riscv-tests, build-stud-support-tests]
    # Avoid duplicate builds on PR from the same repository
    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
    runs-on: ${{ matrix.config.os }}
    strategy:
      fail-fast: false
      matrix:
        config:
          # Linux testing
          - {
              name: "Ubuntu latest (GCC) + packaged Qt6",
              os: ubuntu-latest,
              build_type: "Debug",
              cc: "gcc",
              cxx: "g++",
              build_system: "Unix Makefiles",
              qt_version: "native",
              qt_install_command: "sudo apt-get update && sudo apt-get install qt6-base-dev",
            }
          - {
              name: "Ubuntu latest (GCC) + packaged Qt5",
              os: ubuntu-latest,
              build_type: "Debug",
              cc: "gcc",
              cxx: "g++",
              build_system: "Unix Makefiles",
              qt_version: "native",
              qt_install_command: "sudo apt-get update && sudo apt-get install qtbase5-dev",
            }
          - {
              name: "Ubuntu latest (GCC) + latest Qt6",
              os: ubuntu-latest,
              build_type: "Debug",
              cc: "gcc",
              cxx: "g++",
              build_system: "Unix Makefiles",
              qt_version: *QtLatest,
            }
          - {
              name: "Ubuntu oldest (GCC) + minimal supported Qt",
              os: ubuntu-22.04,
              build_type: "Debug",
              cc: "gcc",
              cxx: "g++",
              build_system: "Unix Makefiles",
              qt_version: *QtMinimal,
            }
          # macOS testing
          - {
              name: "macOS latest ARM64 (Clang) + Qt6",
              os: macos-latest,
              build_type: "Debug",
              cc: "clang",
              cxx: "clang++",
              build_system: "Unix Makefiles",
              qt_version: *QtBrew,
              # Cached aqt is faster that brew.
            }
          - {
              name: "macOS latest AMD64 (Clang) + Qt6",
              os: macos-15-intel,
              build_type: "Debug",
              cc: "clang",
              cxx: "clang++",
              build_system: "Unix Makefiles",
              qt_version: *QtBrew,
              # Cached aqt is faster that brew.
            }
          - {
              name: "macOS oldest AMD64 (Clang) + minimal supported Qt",
              os: macos-15-intel,
              build_type: "Debug",
              cc: "clang",
              cxx: "clang++",
              build_system: "Unix Makefiles",
              qt_version: *QtMinimal,
              # Cached aqt is faster that brew.
            }
          # Windows testing
          - {
              name: "Windows latest (Clang) + Qt6",
              os: windows-latest,
              build_type: "Debug",
              # on Windows, msbuild does not support Clang with GNU-like interface
              #  and NMake does not support parallel builds
              cc: "clang",
              cxx: "clang++",
              build_system: "Ninja",
              qt_version: *QtLatest,
              qt_arch: "win64_msvc2022_64",
            }
          - {
              name: "Windows oldest (Clang) + minimal supported Qt",
              os: windows-2022,
              build_type: "Debug",
              # on Windows, msbuild does not support Clang with GNU-like interface
              #  and NMake does not support parallel builds
              cc: "clang",
              cxx: "clang++",
              build_system: "Ninja",
              qt_version: *QtMinimal,
              qt_arch: "win64_msvc2017_64",
            }
          - {
              name: "Windows 2022 (MinGW) + Qt5",
              os: windows-2022,
              build_type: "Debug",
              cc: "gcc",
              cxx: "g++",
              build_system: "Ninja",
              # Older Qt releases do not have 64bit mingw release
              qt_version: "5.12.9",
              qt_arch: "win64_mingw73",
            }

    steps:
      - uses: actions/checkout@v4
      - run: git submodule update --recursive --init

      - name: Ccache
        uses: hendrikmuhs/ccache-action@v1
        with:
          key: ${{ github.ref_name }}-${{ matrix.config.name }}

      - name: Install specified Qt version
        if: matrix.config.qt_version != 'native'
        uses: jurplel/install-qt-action@v4
        with:
          version: ${{ matrix.config.qt_version }}
          cache: true
          cache-key-prefix: ${{ runner.os }}-${{ matrix.config.qt_version }}-Qt
          arch: ${{ matrix.config.qt_arch }}
          dir: ${{ github.workspace }}/Qt

      - name: Install native Qt by package manager
        if: matrix.config.qt_version == 'native'
        run: ${{ matrix.config.qt_install_command }}

      - name: Setup Ninja
        if: matrix.config.build_system == 'Ninja'
        uses: seanmiddleditch/gha-setup-ninja@v6

      - name: Create Build Environment
        run: cmake -E make_directory ${{ github.workspace }}/build

      - name: Configure CMake
        shell: bash
        working-directory: ${{github.workspace}}/build
        run: 'cmake $GITHUB_WORKSPACE
          -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
          -DCMAKE_C_COMPILER=${{ matrix.config.cc }}
          -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }}
          -DCMAKE_C_COMPILER_LAUNCHER=ccache
          -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
          -DFORCE_COLORED_OUTPUT=true
          -G "${{ matrix.config.build_system }}"'

      - name: Build
        working-directory: ${{ github.workspace }}/build
        run: cmake --build . -j4

      - name: Deploy on Windows
        if: runner.os == 'Windows'
        working-directory: ${{ github.workspace }}/build/target
        shell: bash
        run: 'windeployqt "${{ github.workspace }}/build/target/qtrvsim_gui.exe"'

      - name: Test
        working-directory: ${{ github.workspace }}/build
        shell: bash
        run: ctest --output-on-failure --verbose

      - name: Get official RISC-V tests
        if: ${{ steps.cache-tests.outputs.cache-hit != 'true' }}
        uses: actions/download-artifact@v4
        with:
          name: riscv-official-tests
          path: tests/riscv-official/isa

      - name: Official RISC-V tests (single cycle)
        # The testing python script does not support Ubuntu 18
        if: matrix.config.os != 'ubuntu-18.04'
        working-directory: ${{ github.workspace }}/tests/riscv-official
        #run: python qtrvsim_tester.py --no-64  ${{ github.workspace }}/build/target/qtrvsim_cli
        run: python qtrvsim_tester.py -M -A ${{ github.workspace }}/build/target/qtrvsim_cli

      - name: Official RISC-V tests (pipelined)
        # The testing python script does not support Ubuntu 18
        if: matrix.config.os != 'ubuntu-18.04'
        working-directory: ${{ github.workspace }}/tests/riscv-official
        #run: python qtrvsim_tester.py --no-64  ${{ github.workspace }}/build/target/qtrvsim_cli
        run: python qtrvsim_tester.py -M -A --pipeline ${{ github.workspace }}/build/target/qtrvsim_cli

      - name: Official RISC-V tests (single cycle, cached)
        # The testing python script does not support Ubuntu 18
        if: matrix.config.os != 'ubuntu-18.04'
        working-directory: ${{ github.workspace }}/tests/riscv-official
        #run: python qtrvsim_tester.py --no-64  ${{ github.workspace }}/build/target/qtrvsim_cli
        run: python qtrvsim_tester.py -M -A --cache ${{ github.workspace }}/build/target/qtrvsim_cli

      - name: Official RISC-V tests (pipelined, cached)
        # The testing python script does not support Ubuntu 18
        if: matrix.config.os != 'ubuntu-18.04'
        working-directory: ${{ github.workspace }}/tests/riscv-official
        #run: python qtrvsim_tester.py --no-64  ${{ github.workspace }}/build/target/qtrvsim_cli
        run: python qtrvsim_tester.py -M -A --pipeline --cache ${{ github.workspace }}/build/target/qtrvsim_cli

      - name: Get stud-support tests
        uses: actions/download-artifact@v4
        with:
          name: stud-support-tests
          path: tests/stud-support/elfs

      - name: Stud-support tests (single cycle)
        if: matrix.config.os != 'ubuntu-18.04'
        working-directory: ${{ github.workspace }}/tests/stud-support
        run: python run_tests.py --qtrvsim-cli ${{ github.workspace }}/build/target/qtrvsim_cli --build-dir elfs --stud-support-path .

      - name: Stud-support tests (pipelined)
        if: matrix.config.os != 'ubuntu-18.04'
        working-directory: ${{ github.workspace }}/tests/stud-support
        run: python run_tests.py --qtrvsim-cli ${{ github.workspace }}/build/target/qtrvsim_cli --build-dir elfs --stud-support-path . --pipeline

      - name: Stud-support tests (single cycle, cached)
        if: matrix.config.os != 'ubuntu-18.04'
        working-directory: ${{ github.workspace }}/tests/stud-support
        run: python run_tests.py --qtrvsim-cli ${{ github.workspace }}/build/target/qtrvsim_cli --build-dir elfs --stud-support-path . --cache

      - name: Stud-support tests (pipelined, cached)
        if: matrix.config.os != 'ubuntu-18.04'
        working-directory: ${{ github.workspace }}/tests/stud-support
        run: python run_tests.py --qtrvsim-cli ${{ github.workspace }}/build/target/qtrvsim_cli --build-dir elfs --stud-support-path . --pipeline --cache

      - name: Store created artifacts
        uses: actions/upload-artifact@v4
        with:
          name: target-${{ runner.name }}
          path: ${{ github.workspace }}/build/target

  build-emscripten:
    name: ${{ matrix.config.name }}
    # Avoid duplicate builds on PR from the same repository
    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
    runs-on: ${{ matrix.config.os }}
    strategy:
      fail-fast: false
      matrix:
        config:
          - {
              name: "WASM Linux",
              os: ubuntu-latest,
              build_type: Release,
              qt_arch: wasm_32,
              emsdk_version: 1.39.8,
              qt_version: 5.15.2,
            }
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive

      - name: Ccache
        uses: hendrikmuhs/ccache-action@v1.2.11 # https://github.com/hendrikmuhs/ccache-action/issues/181
        with:
          key: ${{ github.ref_name }}-${{ matrix.config.name }}

      - name: Setup EMSDK cache
        id: cache-system-libraries
        uses: actions/cache@v4
        with:
          path: "emsdk-cache"
          key: ${{ runner.os }}-${{ matrix.config.emsdk_version }}-${{ matrix.config.qt_version }}-emsdk

      - name: Setup emsdk
        uses: mymindstorm/setup-emsdk@v14
        with:
          version: ${{ matrix.config.emsdk_version }}
          actions-cache-folder: "emsdk-cache"

      - name: Install Qt
        uses: jurplel/install-qt-action@v3
        with:
          version: ${{ matrix.config.qt_version }}
          cache: true
          cache-key-prefix: "wasm-qt"
          arch: ${{ matrix.config.qt_arch }}
          dir: ${{ github.workspace }}/Qt

      - name: Create Build Environment
        run: cmake -E make_directory ${{github.workspace}}/build

      - name: Configure CMake
        working-directory: ${{github.workspace}}/build
        run: "emcmake cmake $GITHUB_WORKSPACE
          -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
          -DCMAKE_PREFIX_PATH=$Qt5_DIR
          -DCMAKE_FIND_ROOT_PATH=$Qt5_DIR
          -DCMAKE_C_COMPILER_LAUNCHER=ccache
          -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
          -DFORCE_COLORED_OUTPUT=true
          -Wno-dev"

      - name: Build
        working-directory: ${{ github.workspace }}/build
        run: cmake --build . -j4

      - name: Store created artifacts
        uses: actions/upload-artifact@v4
        with:
          name: target-wasm-${{ runner.os }}-qt${{ matrix.config.qt_version }}
          path: ${{ github.workspace }}/build/target

  build-riscv-tests:
    name: Build official RISC-V tests
    # Avoid duplicate builds on PR from the same repository
    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - run: git submodule update --recursive --init

      - name: Get cache key
        uses: mathiasvr/command-output@v2.0.0
        id: subtree-hash
        with:
          run: git rev-parse HEAD:tests/riscv-official/

      - name: Cache
        id: cache-tests
        uses: actions/cache@v4
        with:
          path: ${{ github.workspace }}/tests/riscv-official/isa
          key: riscv-tests-${{ steps.subtree-hash.outputs.stdout }}

      - name: Toolchain for official RISC-V tests
        if: ${{ steps.cache-tests.outputs.cache-hit != 'true' }}
        working-directory: ${{ github.workspace }}/tests/riscv-official
        # Version 14 is needed to correctly process newer parts of RV
        run: |
          ### Ubuntu 22 already provides those
          # echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main" | sudo tee -a /etc/apt/sources.list &&
          # wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - &&
          sudo apt-get update &&
          sudo apt-get install clang-14 lldb-14 lld-14

      - name: Build official RISC-V tests
        if: ${{ steps.cache-tests.outputs.cache-hit != 'true' }}
        working-directory: ${{ github.workspace }}/tests/riscv-official/isa
        env:
          RISCV_COMPILER: clang-14
          USE_CLANG_OPTS: true
          RISCV_OBJDUMP_CMD: llvm-objdump-14
        run: make

      - name: Store created artifacts
        # Use of tar significantly improves performance as artifact upload has significant per file penalty
        uses: actions/upload-artifact@v4
        with:
          name: riscv-official-tests
          path: tests/riscv-official/isa

  build-stud-support-tests:
    name: Build stud-support tests
    # Avoid duplicate builds on PR from the same repository
    if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
    runs-on: ubuntu-22.04
    env:
      STUD_SUPPORT_REV: 53c684c05dc990e6043fcc3c9a346b2173610731
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: true

      - name: Cache stud-support tests
        id: cache-stud-support
        uses: actions/cache@v4
        with:
          path: ${{ github.workspace }}/tests/stud-support/elfs
          key: stud-support-tests-${{ env.STUD_SUPPORT_REV }}

      - name: Checkout stud-support
        if: ${{ steps.cache-stud-support.outputs.cache-hit != 'true' }}
        run: |
          git clone https://gitlab.fel.cvut.cz/b35apo/stud-support.git stud-support
          cd stud-support
          git checkout ${{ env.STUD_SUPPORT_REV }}

      - name: Install RISC-V toolchain for stud-support
        if: ${{ steps.cache-stud-support.outputs.cache-hit != 'true' }}
        run: |
          sudo apt-get update &&
          sudo apt-get install -y gcc-riscv64-unknown-elf

      - name: Build stud-support tests
        if: ${{ steps.cache-stud-support.outputs.cache-hit != 'true' }}
        working-directory: ${{ github.workspace }}/tests/stud-support
        run: python build_tests.py --stud-support-path ../../stud-support

      - name: Store stud-support artifacts
        uses: actions/upload-artifact@v4
        with:
          name: stud-support-tests
          path: tests/stud-support/elfs


================================================
FILE: .github/workflows/docs.yml
================================================
name: Docs

on:
  push:
    branches:
      - master
    paths:
      - "docs/user/**"
      - ".github/workflows/docs.yml"
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup mdBook
        uses: peaceiris/actions-mdbook@v2
        with:
          mdbook-version: "latest"

      - name: Build the book
        run: mdbook build docs/user

      - name: Setup Pages
        uses: actions/configure-pages@v5

      - name: Prepare artifact with /manual subdirectory
        run: |
          rm -rf pages
          mkdir -p pages/manual
          cp -a docs/user/book/. pages/manual/

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: pages
      - name: Create ZIP for Comparch deployment
        run: |
          cd docs/user/book
          zip -r ../../../manual.zip .
      - name: Deploy to Comparch
        run: |
          curl -X POST -H "Authorization: Bearer ${{ secrets.COMPARCH_DOCS_TOKEN }}" -F "file=@manual.zip" http://eval.comparch.edu.cvut.cz:1111/github-actions/update-manual

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4


================================================
FILE: .github/workflows/release.yml
================================================
name: Release

on: workflow_dispatch

jobs:
  build:
    name: ${{ matrix.config.name }}
    runs-on: ${{ matrix.config.os }}
    strategy:
      fail-fast: true
      matrix:
        config:
          - {
            name: "OBS bundle (Ubuntu Latest GCC)",
            os: ubuntu-latest,
            build_type: "Release",
            cc: "gcc", cxx: "g++"
          }

    steps:
      - uses: actions/checkout@v4

      # CMake will not configure without Qt installed
      - name: Install Qt
        run: sudo apt-get update && sudo apt-get install qtbase5-dev

      - name: Create Build Environment
        run: cmake -E make_directory ${{ github.workspace }}/build

      - name: Configure CMake
        shell: bash
        working-directory: ${{ github.workspace }}/build
        env:
          CC: ${{ matrix.config.cc }}
          CXX: ${{ matrix.config.cxx }}
        run: "cmake $GITHUB_WORKSPACE
                    -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
                    -DDEV_MODE=true"

      - name: Create OBS bundle
        working-directory: ${{ github.workspace }}/build
        run: make open_build_service_bundle

      - name: Store OBS bundle
        uses: actions/upload-artifact@v4
        with:
          name: obs-package-bundle
          path: ${{ github.workspace }}/build/target/pkg


================================================
FILE: .gitignore
================================================
.*
!.gitignore
!.gitmodules
!.github

# Qt stuff
*.pro.user*
*.qbs.user*

# Common test directory
test_dir
# Build directory
build
/CMakeFiles/
compile_commands.json
/src/project_info.h
# Local settings template
.dev-config.mk


================================================
FILE: .gitmodules
================================================
[submodule "riscv-tests"]
	path = tests/riscv-official/riscv-tests
	url = https://github.com/riscv-software-src/riscv-tests.git
[submodule "external/libelfin"]
	path = external/libelfin
	url = https://github.com/mortbopet/libelfin


================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.10)
cmake_policy(VERSION 3.10)

project(QtRVSim
        LANGUAGES C CXX
        VERSION 0.9.8
        DESCRIPTION "RISC-V CPU simulator for education purposes")

set(KAREL_KOCI "Karel Koci <cynerd@email.cz>")
set(PAVEL_PISA "Pavel Pisa <pisa@cmp.felk.cvut.cz>")
set(JAKUB_DUPAK "Jakub Dupak <dev@jakubdupak.com>")
set(MAX_HOLLMANN "Max Hollmann <hollmmax@fel.cvut.cz>")

set(PROJECT_HOMEPAGE_URL "https://github.com/cvut/qtrvsim")
set(GENERIC_NAME "RISC-V CPU simulator")
set(LICENCE "GPL-3.0-or-later")
set(LONG_DESCRIPTION
        "RISC-V CPU simulator for education purposes with pipeline and cache visualization.")
string(TIMESTAMP YEAR "%Y")

include(cmake/CopyrightTools.cmake)


copyright(
        "Copyright (c) 2017-2019 ${KAREL_KOCI}"
        "Copyright (c) 2019-${YEAR} ${PAVEL_PISA}"
        "Copyright (c) 2020-${YEAR} ${JAKUB_DUPAK}"
        "Copyright (c) 2020-2021 ${MAX_HOLLMANN}")

include(cmake/GPL-3.0-or-later.cmake)

# =============================================================================
# Configurable options
# =============================================================================

set(DEV_MODE false CACHE BOOL "Enable developer options in this CMake, like packaging.\
    They should be ignored, when user just wants to build this project.")
set(FORCE_ELFLIB_STATIC false CACHE BOOL
        "Use included statically linked libelf even if system one is available.")
set(SANITIZERS "address,undefined" CACHE STRING
        "Runtime sanitizers to use in debug builds.
    Column separated subset of {address, memory, undefined, thread} or none.
    Memory and address cannot be used at the same time.")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/target"
        CACHE STRING "Absolute path to place executables to.")
set(PACKAGE_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}/pkg"
        CACHE STRING "Absolute path to place generated package files.")
set(FORCE_COLORED_OUTPUT false CACHE BOOL "Always produce ANSI-colored output (GNU/Clang only).")
set(USE_ALTERNATE_LINKER "" CACHE STRING "Use alternate linker. Leave empty for system default; alternatives are 'gold', 'lld', 'bfd', 'mold'")
set(QT_VERSION_MAJOR "auto" CACHE STRING "Qt major version to use. 5|6|auto")

# =============================================================================
# Generated variables
# =============================================================================

if (NOT "${QT_VERSION_MAJOR}" MATCHES "5|6|auto")
    message(FATAL_ERROR "Invalid value for QT_VERSION_MAJOR: ${QT_VERSION_MAJOR} (expected 5, 6 or auto)")
endif ()

if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
    set(WASM true)
else ()
    set(WASM false)
endif ()
set(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
set(C_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})


macro(set_alternate_linker linker)
    find_program(LINKER_EXECUTABLE ld.${USE_ALTERNATE_LINKER} ${USE_ALTERNATE_LINKER})
    if (LINKER_EXECUTABLE)
        if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 12.0.0)
            add_link_options("-ld-path=${USE_ALTERNATE_LINKER}")
        else ()
            add_link_options("-fuse-ld=${USE_ALTERNATE_LINKER}")
        endif ()
    else ()
        set(USE_ALTERNATE_LINKER "" CACHE STRING "Use alternate linker" FORCE)
    endif ()
endmacro()
if (NOT "${USE_ALTERNATE_LINKER}" STREQUAL "")
    set_alternate_linker(${USE_ALTERNATE_LINKER})
endif ()

# I don't want to relly on the assumption, that this file is invoked as root
# project. Therefore I propagate the information to all subprojects
# MAIN_PROJECT_*. Lowercase and uppercase are used for executable names and
# C defines, respectively.
set(MAIN_PROJECT_NAME "${PROJECT_NAME}")
set(MAIN_PROJECT_VERSION "${PROJECT_VERSION}")
set(MAIN_PROJECT_APPID "cz.cvut.edu.comparch.qtrvsim")
set(MAIN_PROJECT_ORGANIZATION "FEE CTU")
set(MAIN_PROJECT_HOMEPAGE_URL "${PROJECT_HOMEPAGE_URL}")
string(TOLOWER "${PROJECT_NAME}" MAIN_PROJECT_NAME_LOWER)
string(TOUPPER "${PROJECT_NAME}" MAIN_PROJECT_NAME_UPPER)

# =============================================================================
# CMake config and tools
# =============================================================================

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

if (CMAKE_VERSION VERSION_LESS "3.7.0")
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif ()

include(cmake/BuildType.cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# =============================================================================
# Build options
# - common to all subdirs
# =============================================================================

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# MSVC is not supported, Clang+MSVC currently does not seem to support sanitizers in with debug CRT,
#  MinGW does not support sanitizers at all; all together, just skip sanitizers on Windows and re-investigate
#  in a year or two whether Clang sanitizer support has improved
if (NOT "${SANITIZERS}" MATCHES "none" AND NOT "${WASM}" AND NOT "${WIN32}")
    set(CMAKE_C_FLAGS_DEBUG
            "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=${SANITIZERS} -g -g3 -ggdb")
    set(CMAKE_CXX_FLAGS_DEBUG
            "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=${SANITIZERS} -g -g3 -ggdb")
    set(CMAKE_LINKER_FLAGS_DEBUG
            "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=${SANITIZERS}")
endif ()

if (NOT "${BUILD_DEBUG}")
    message(STATUS "Debug prints globally suppressed.")
    add_definitions(-DQT_NO_DEBUG_OUTPUT=1)
endif ()

add_compile_definitions(QT_USE_QSTRINGBUILDER)

# Profiling flags
if (NOT "${WASM}" AND NOT "${WIN32}")
    set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")
    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")
    set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} -fno-omit-frame-pointer")
endif ()

include_directories("src" "src/machine")


if (${FORCE_COLORED_OUTPUT})
    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
        add_compile_options(-fdiagnostics-color=always)
    elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
        add_compile_options(-fcolor-diagnostics)
    endif ()
endif ()

## ============================================================================
## Warning level
## ============================================================================

if (WIN32)
    # otherwise CRT complains that `strerror` is deprecated
    add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif ()

if (MSVC)
    add_compile_options(/W4 /WX)
else ()
    add_compile_options(-Wall -Wextra -Werror=switch)
    if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
        # This is currently a wont-fix and it will be OK in cpp20.
        add_compile_options(-Wno-c99-designator)
    endif ()
endif ()

# =============================================================================
# Dependencies
# =============================================================================

if ("${WASM}")
    message(STATUS "WASM build detected")

    message(STATUS "Enabled WASM exception handling")
    add_compile_options("-fexceptions")
    # Extra options for WASM linking
    add_link_options("-fexceptions")
    add_link_options("-flto")
    # Activate Embind C/C++ bindings
    # https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html
    add_link_options("--bind")
    # Enable C++ exception catching
    # https://emscripten.org/docs/optimizing/Optimizing-Code.html#c-exceptions
    add_link_options("SHELL:-s DISABLE_EXCEPTION_CATCHING=0")
    # Enable Fetch API
    # https://emscripten.org/docs/api_reference/fetch.html
    add_link_options("SHELL:-s FETCH=1")
    add_link_options("SHELL:-s WASM=1")
    # Emulate missing OpenGL ES2/ES3 features
    # https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#opengl-es-2-0-3-0-emulation
    add_link_options("SHELL:-s FULL_ES2=1")
    add_link_options("SHELL:-s FULL_ES3=1")
    # Activate WebGL 2 (in addition to WebGL 1)
    # https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html#webgl-friendly-subset-of-opengl-es-2-0-3-0
    add_link_options("SHELL:-s USE_WEBGL2=1")
    # Run static dtors at teardown
    # https://emscripten.org/docs/getting_started/FAQ.html#what-does-exiting-the-runtime-mean-why-don-t-atexit-s-run
    add_link_options("SHELL:-s ALLOW_MEMORY_GROWTH=1")
    # Export UTF16ToString,stringToUTF16
    # Required by https://codereview.qt-project.org/c/qt/qtbase/+/286997 (since Qt 5.14)
    add_link_options("SHELL:-s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"]")
    # Enable demangling of C++ stack traces
    # https://emscripten.org/docs/porting/Debugging.html
    add_link_options("SHELL:-s DEMANGLE_SUPPORT=1")
    # Run static dtors at teardown
    # https://emscripten.org/docs/getting_started/FAQ.html#what-does-exiting-the-runtime-mean-why-don-t-atexit-s-run
    add_link_options("SHELL:-s EXIT_RUNTIME=1")

    # Debug build
    if ("${BUILD_DEBUG}")
        message(STATUS "Enabled WASM debug")
        add_link_options("SHELL:-s ERROR_ON_WASM_CHANGES_AFTER_LINK")
        add_link_options("SHELL:-s WASM_BIGINT")
        add_link_options("-O1")
    endif ()

    add_definitions(-DQT_NO_DEBUG_OUTPUT=1)
    message(STATUS "Debug output disabled")
else ()
    # Not available for WASM
    enable_testing()
endif ()

set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
set(CMAKE_PROJECT_libelfin_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibElfinSettings.cmake")
add_subdirectory("external/libelfin")

# Detect Qt used qt version
# Based on article https://www.steinzone.de/wordpress/how-to-support-both-qt5-and-qt6-using-cmake/
# Cannot use version-less approach due to Qt 5.9.5 support constraint.

if ("${QT_VERSION_MAJOR}" STREQUAL "auto")
    find_package(QT NAMES Qt5 Qt6 COMPONENTS Core REQUIRED)
endif ()

# Normally, we would use variable Qt5 or Qt6 to reference the Qt library. Here we do that through
# this variable based on detected version major of Qt.
set(QtLib "Qt${QT_VERSION_MAJOR}")
find_package(${QtLib}
        REQUIRED COMPONENTS Core Widgets Gui Test
        OPTIONAL_COMPONENTS PrintSupport)

message(STATUS "${QtLib} version: ${${QtLib}Core_VERSION}")
message(STATUS "${QtLib} print support: ${${QtLib}PrintSupport_FOUND}")

if ("${WASM}")
    string(TIMESTAMP DATE "%Y%m%d")
    file(READ "${${QtLib}Core_DIR}/../../../plugins/platforms/qtloader.js" QTLOADER)
    string(REPLACE "applicationName + \".js\"" "applicationName + \".js?v=${DATE}\"" QTLOADER "${QTLOADER}")
    string(REPLACE "applicationName + \".wasm\"" "applicationName + \".wasm?v=${DATE}\"" QTLOADER "${QTLOADER}")
    file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/target/qtloader.js" "${QTLOADER}")
endif ()


# Qt 5.9.5 is the oldest supported
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050905)

add_subdirectory("external/svgscene")

# =============================================================================
# Sources
# =============================================================================

add_subdirectory("src/common")
add_subdirectory("src/machine")
add_subdirectory("src/assembler")
add_subdirectory("src/os_emulation")
add_subdirectory("src/gui")
if (NOT "${WASM}")
    add_subdirectory("src/cli")
    add_custom_target(all_unit_tests
            DEPENDS common_unit_tests machine_unit_tests)
endif ()

# =============================================================================
# Installation
# =============================================================================

# Prior to CMake version 3.13, installation must be performed in the subdirectory,
# there the target was created. Therefore executable installation is to be found
# in corresponding CMakeLists.txt.

if (NOT "${WASM}")
    configure_file(data/gui.desktop.in
            "${EXECUTABLE_OUTPUT_PATH}/${MAIN_PROJECT_NAME_LOWER}.desktop")
    configure_file("data/${MAIN_PROJECT_APPID}.metainfo.xml.in"
            "${EXECUTABLE_OUTPUT_PATH}/${MAIN_PROJECT_APPID}.metainfo.xml")

    install(FILES "data/icons/gui.svg"
            DESTINATION "share/icons/hicolor/scalable/apps"
            RENAME "${MAIN_PROJECT_NAME_LOWER}_gui.svg")
    install(FILES "data/icons/48x48/gui.png"
            DESTINATION "share/icons/hicolor/48x48/apps"
            RENAME "${MAIN_PROJECT_NAME_LOWER}_gui.png")
    install(FILES "${EXECUTABLE_OUTPUT_PATH}/${MAIN_PROJECT_NAME_LOWER}.desktop"
            DESTINATION share/applications)

    install(FILES "${EXECUTABLE_OUTPUT_PATH}/${MAIN_PROJECT_APPID}.metainfo.xml"
            DESTINATION share/metainfo)
endif ()

# =============================================================================
# Packages
# =============================================================================

if ("${DEV_MODE}")
    # The condition prevents execution of this section during regular user installation.
    # It created files useless to normal users and requires additional tools (git, xz).
    message(STATUS "Packaging tools enabled.")

    set(PACKAGE_NAME "${MAIN_PROJECT_NAME_LOWER}")
    set(PACKAGE_VERSION "${PROJECT_VERSION}")
    set(PACKAGE_RELEASE "1")
    set(PACKAGE_SOURCE_ARCHIVE_FILE "${PACKAGE_NAME}_${PACKAGE_VERSION}.orig.tar.xz")
    set(PACKAGE_SOURCE_ARCHIVE_PATH "${PACKAGE_OUTPUT_PATH}/${PACKAGE_SOURCE_ARCHIVE_FILE}")
    set(PACKAGE_TOPLEVEL_DIR "${PACKAGE_NAME}-${PACKAGE_VERSION}")
    set(PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}")
    set(PACKAGE_LONG_DESCRIPTION "${LONG_DESCRIPTION}")
    set(PACKAGE_MAINTAINER "${JAKUB_DUPAK}")
    set(PACKAGE_URL "${PROJECT_HOMEPAGE_URL}")
    set(PACKAGE_GIT "github.com:cvut/qtrvsim.git")
    set(PACKAGE_LICENCE "${LICENCE}")

    include(cmake/PackageTools.cmake)

    # Inject up-to-date information into package config files.
    package_config_file(appimage appimage.yml extras/packaging/appimage/appimage.yml.in)
    package_config_file(archlinux PKGBUILD extras/packaging/arch/PKGBUILD.in)
    package_config_file(rpm ${PACKAGE_NAME}.spec extras/packaging/rpm/spec.in)
    # Debian uses whole directory which has to be saved to archive and shipped.
    package_debian_quilt(deb
            ${PACKAGE_NAME}_${PACKAGE_VERSION}-${PACKAGE_RELEASE}.dsc
            extras/packaging/deb/dsc.in
            extras/packaging/deb/debian
            ${PACKAGE_NAME}_${PACKAGE_VERSION}-${PACKAGE_RELEASE}.debian.tar.xz)
    # Creates bunch of files in ${CMAKE_BINARY_DIR}/target/pkg that you can just pass to
    # Open Build Service and it will build all packaging.
    # TODO: Currently changelog is not handled automatically.
    add_custom_target(open_build_service_bundle
            DEPENDS ${PACKAGE_SOURCE_ARCHIVE_FILE} appimage archlinux deb rpm
            WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/pkg)
endif ()

configure_file(src/project_info.h.in ${CMAKE_CURRENT_LIST_DIR}/src/project_info.h @ONLY)


================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    {one line to give the program's name and a brief idea of what it does.}
    Copyright (C) {year}  {name of author}

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    {project}  Copyright (C) {year}  {fullname}
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.


================================================
FILE: Makefile
================================================
include .dev-config.mk

.dev-config.mk:
	[ ! -f .dev-config.mk ] && cp .dev-config.mk.default .dev-config.mk

release:
	mkdir -p build/Release
	cd build/Release && cmake -DCMAKE_BUILD_TYPE=Release ../..
	cd build/Release && cmake --build .

debug:
	mkdir -p build/Debug
	cd build/Debug && cmake -DCMAKE_BUILD_TYPE=Debug ../..
	cd build/Debug && cmake --build .

########################################################################################################################
# WASM
########################################################################################################################

wasm:
	bash extras/building/build-wasm.sh $(EMSCRIPTEN_VERSION) $(QT_WASM_PATH) $(EMSDK_PATH)

wasm-clean:
	rm -rf $(WASM_BUILD_DIR)

wasm-clean-deep: wasm-clean
	rm -rf $(EMSDK_PATH)/upstream/cache/*
	rm -rf $(EMSDK_PATH)/upstream/emscripten/cache/*

wasm-serve:
	cp data/wasm/* $(WASM_BUILD_DIR)/target
	# Server is necessary due to CORS
	cd $(WASM_BUILD_DIR)/target/ && python -m http.server
	open localhost:8000

wasm-install-qt:
	python -m aqt install $(QT_WASM_VERSION) linux desktop wasm_32 --outputdir $(QT_INSTALL_DIR)

.PHONY: release debug wasm wasm-clean wasm-clean-deep wasm-serve wasm-install-qt

================================================
FILE: README.md
================================================
# QtRvSim–RISC-V CPU simulator for education

![QtRvSim screenshot](data/screenshots/intro.webp)

Developed by the [Computer Architectures Education](http://comparch.edu.cvut.cz) project
at [Czech Technical University](http://www.cvut.cz/).

**Are you using QtRvSim at your organization?** [Please, let us know in the discussion!](https://github.com/cvut/qtrvsim/discussions/136)

## Table of contents

<!-- TOC start -->

- [Try it out! (WebAssembly)](#try-it-out-webassembly)
- [Build and packages](#build-and-packages)
  - [Build Dependencies](#build-dependencies)
  - [General Compilation](#general-compilation)
  - [Building from source on macOS](#building-from-source-on-macos)
  - [Download Binary Packages](#download-binary-packages)
  - [Nix package](#nix-package)
  - [Tests](#tests)
- [Documentation](#documentation)
- [Accepted Binary Formats](#accepted-binary-formats)
  - [LLVM toolchain usage](#llvm-toolchain-usage)
  - [GNU toolchain usage](#gnu-toolchain-usage)
  - [GNU 64-bit toolchain use for RV32I target](#gnu-64-bit-toolchain-use-for-rv32i-target)
- [Integrated Assembler](#integrated-assembler)
- [Support to call external make utility](#support-to-call-external-make-utility)
- [Advanced functionalities](#advanced-functionalities)
  - [Peripherals](#peripherals)
  - [Interrupts and Control and Status Registers](#interrupts-and-control-and-status-registers)
  - [System Calls Support](#system-calls-support)
- [Limitations of the Implementation](#limitations-of-the-implementation)
  - [QtRvSim limitations](#qtrvsim-limitations)
  - [List of Currently Supported Instructions](#list-of-currently-supported-instructions)
- [Links to Resources and Similar Projects](#links-to-resources-and-similar-projects)
- [Copyright](#copyright)
- [License](#license)

<!-- TOC end -->

## Try it out! (WebAssembly)

QtRVSim is experimentally available for [WebAssembly](https://webassembly.org/) and it can be run in most browsers
without installation. **[QtRVSim online](https://comparch.edu.cvut.cz/qtrvsim/app)**

**Note, that WebAssembly version is experimental.**
Please, report any difficulties via [GitHub issues](https://github.com/cvut/qtrvsim/issues/new).

## Build and packages

[![Packaging status](https://repology.org/badge/vertical-allrepos/qtrvsim.svg)](https://repology.org/project/qtrvsim/versions)

[![build result](https://build.opensuse.org/projects/home:jdupak/packages/qtrvsim/badge.svg?type=default)](https://build.opensuse.org/package/show/home:jdupak/qtrvsim)

### Build Dependencies

- Qt 5 (minimal tested version is 5.9.5), experimental support of Qt 6
- elfutils (optional; libelf works too but there can be some problems)

### Quick Compilation on Linux

On Linux, you can use a wrapper Makefile and run `make` in the project root directory. It will create a build directory
and run CMake in it. Available targets are: `release` (default) and `debug`.

Note for packagers: This Makefile is deleted by CMake when source archive is created to avoid any ambiguity. Packages
should invoke CMake directly.

### General Compilation

```shell
cmake -DCMAKE_BUILD_TYPE=Release /path/to/qtrvsim
make
```

Where `/path/to/qtrvsim` is path to this project root. The built binaries are to be found in the directory `target`in
the build directory (the one, where cmake was called).

`-DCMAKE_BUILD_TYPE=Debug` builds development version including sanitizers.

If no build type is supplied, `Debug` is the default.

### Building from source on macOS

Install the latest version of **Xcode** from the App Store. Then open a terminal and execute `xcode-select --install` to
install Command Line Tools. Then open Xcode, accept the license agreement and wait for it to install any additional
components. After you finally see the "Welcome to Xcode" screen, from the top bar
choose `Xcode -> Preferences -> Locations -> Command Line Tools` and select an SDK version.

Install [Homebrew](https://brew.sh/) and use it to install Qt. (macOS builds must use the bundled libelf)

```shell
brew install qt
```

Now build the project the same way as in general compilation ([above](#general-compilation)).

### Download Binary Packages

- [https://github.com/cvut/qtrvsim/releases](https://github.com/cvut/qtrvsim/releases)
    - archives with Windows and generic GNU/Linux binaries
- [https://build.opensuse.org/repositories/home:jdupak/qtrvsim](https://build.opensuse.org/repositories/home:jdupak/qtrvsim)
- [https://software.opensuse.org/download.html?project=home%3Ajdupak&package=qtrvsim](https://software.opensuse.org/download.html?project=home%3Ajdupak&package=qtrvsim)
    - Open Build Service binary packages
- [https://launchpad.net/~qtrvsimteam/+archive/ubuntu/ppa](https://launchpad.net/~qtrvsimteam/+archive/ubuntu/ppa)
    - Ubuntu PPA archive

```bash
sudo add-apt-repository ppa:qtrvsimteam/ppa
sudo apt-get update
sudo apt-get install qtrvsim
```

### Nix package

QtRVSim provides a Nix package as a part of the repository. You can build and install it by a command bellow. Updates
have to be done manually by checking out the git. NIXPKGS package is in PR phase.

```shell
nix-env -if .
```

### Tests

Tests are managed by CTest (part of CMake). To build and run all tests, use this commands:

```bash
cmake -DCMAKE_BUILD_TYPE=Release /path/to/QtRVSim
make
ctest
```

## Documentation

Main documentation is provided in this README and in subdirectories [`docs/user`](docs/user)
and [`docs/developer`](docs/developer).

The project was developed and extended as theses of Karel Kočí, Jakub Dupak and Max Hollmann. See section [Resources and Publications](#resources-and-publications) for links and references.

## Accepted Binary Formats

The simulator accepts statically linked little-endian ELF executables compiled for
the RISC-V target, either 32-bit (GCC options `-mabi=ilp32 -march=rv32i` to `rv32ima_zicsr`)
or 64-bit (`-mabi=lp64 -march=rv64i` to `rv64ima_zicsr`).
Simulation will execute them as XLEN=32 or XLEN=64 according to the ELF file header.
There is even initial support for endianness selection based on the ELF file header.

- 64-bit RISC-V ISA RV64IM and 32-bit RV32IM ELF executables are supported.
- Compressed instructions are not yet supported.

You can use compile the code for simulation using specialized RISC-V GCC/Binutils toolchain (`riscv32-elf`) or using
unified Clang/LLVM toolchain with [LLD](https://lld.llvm.org/). If you have Clang installed, you don't need any
additional tools. Clang can be used on Linux, Windows, macOS and others...

### LLVM toolchain usage

```shell
clang --target=riscv32 -march=rv32g -nostdlib -static -fuse-ld=lld test.S -o test
llvm-objdump -S test
```

### GNU toolchain usage

```shell
riscv32-elf-as test.S -o test.o
riscv32-elf-ld test.o -o test
riscv32-elf-objdump -S test
```

or

```shell
riscv32-elf-gcc test.S -o test
riscv32-elf-objdump -S test
```

### GNU 64-bit toolchain use for RV32I target

Multilib supporting 64-bit embedded toolchain can be used for to build executable

```shell
riscv64-unknown-elf-gcc -march=rv32i -mabi=ilp32 -nostdlib -o test test.c crt0local.S -lgcc
```

The global pointer and stack has to be set to setup runtime C code conformant environment. When no other C library is
used then next simple `crt0local.S` can be used.

<details>
  <summary>example code</summary>

```asm
/* minimal replacement of crt0.o which is else provided by C library */

.globl main
.globl _start
.globl __start

.option norelax

.text

__start:
_start:
        .option push
        .option norelax
        la gp, __global_pointer$
        .option pop
        la      sp, __stack_end
        addi    a0, zero, 0
        addi    a1, zero, 0
        jal     main
quit:
        addi    a0, zero, 0
        addi    a7, zero, 93  /* SYS_exit */
        ecall

loop:   ebreak
        beq     zero, zero, loop

.bss

__stack_start:
        .skip   4096
__stack_end:

.end _start
```

</details>

## Integrated Assembler

Basic integrated assembler is included in the simulator. Small subset of
[GNU assembler](https://sourceware.org/binutils/docs/as/) directives is recognized as well. Next directives are
recognized: `.word`, `.orig`, `.set`
/`.equ`, `.ascii` and `.asciz`. Some other directives are simply ignored: `.data`, `.text`, `.globl`, `.end` and `.ent`.
This allows to write code which can be compiled by both - integrated and full-featured assembler. Addresses are assigned
to labels/symbols which are stored in symbol table. Addition, subtraction, multiplication, divide and bitwise and or are
recognized.

## Support to call external make utility

The action "Build executable by external make" call "make" program. If the action is invoked, and some source editors
selected in main windows tabs then the "make" is started in the corresponding directory. Else directory of last selected
editor is chosen. If no editor is open then directory of last loaded ELF executable are used as "make" start path. If
even that is not an option then default directory when the emulator has been started is used.

## Advanced functionalities

### Peripherals

<details>
  <summary>Emuated LCD, knobs, buttons, serial port, timer...</summary>

The simulator implements emulation of two peripherals for now.

The first is simple serial port (UART). It support transmission
(Tx) and reception (Rx). Receiver status register (`SERP_RX_ST_REG`)
implements two bits. Read-only bit 0 (`SERP_RX_ST_REG_READY`)
is set to one if there is unread character available in the receiver data register (`SERP_RX_DATA_REG`). The bit 1
(`SERP_RX_ST_REG_IE`) can be written to 1 to enable interrupt request when unread character is available. The
transmitter status register (`SERP_TX_ST_REG`) bit 0
(SERP_TX_ST_REG_READY) signals by value 1 that UART is ready and can accept next character to be sent. The bit 1
(`SERP_TX_ST_REG_IE`) enables generation of interrupt. The register `SERP_TX_DATA_REG` is actual Tx buffer. The LSB byte
of written word is transmitted to the terminal window. Definition of peripheral base address and registers
offsets (`_o`) and individual fields masks (`_m`) follows

```
#define SERIAL_PORT_BASE   0xffffc000

#define SERP_RX_ST_REG_o           0x00
#define SERP_RX_ST_REG_READY_m      0x1
#define SERP_RX_ST_REG_IE_m         0x2

#define SERP_RX_DATA_REG_o         0x04

#define SERP_TX_ST_REG_o           0x08
#define SERP_TX_ST_REG_READY_m      0x1
#define SERP_TX_ST_REG_IE_m         0x2

#define SERP_TX_DATA_REG_o         0x0c
```

The UART registers region is mirrored on the address 0xffff0000 to enable use of programs initially written
for [SPIM](http://spimsimulator.sourceforge.net/) or [MARS](http://courses.missouristate.edu/KenVollmar/MARS/)
emulators.

The another peripheral allows to set three byte values concatenated to single word (read-only `KNOBS_8BIT` register)
from user panel set by knobs and display one word in hexadecimal, decimal and binary format (`LED_LINE` register). There
are two other words writable which control color of RGB LED 1 and 2
(registers `LED_RGB1` and `LED_RGB2`).

```
#define SPILED_REG_BASE    0xffffc100

#define SPILED_REG_LED_LINE_o           0x004
#define SPILED_REG_LED_RGB1_o           0x010
#define SPILED_REG_LED_RGB2_o           0x014
#define SPILED_REG_LED_KBDWR_DIRECT_o   0x018

#define SPILED_REG_KBDRD_KNOBS_DIRECT_o 0x020
#define SPILED_REG_KNOBS_8BIT_o         0x024
```

The simple 16-bit per pixel (RGB565) framebuffer and LCD are implemented. The framebuffer is mapped into range starting
at `LCD_FB_START` address. The display size is 480 x 320 pixel. Pixel format RGB565 expect red component in bits 11..
15, green component in bits 5..10 and blue component in bits 0..4.

```
#define LCD_FB_START       0xffe00000
#define LCD_FB_END         0xffe4afff
```

The basic implementation of RISC-V Advanced Core Local Interruptor
is implemented with basic support for

- Machine-level Timer Device (MTIMER)
- Machine-level Software Interrupt Device (MSWI)

```
#define ACLINT_MSWI        0xfffd0000 // core 0 machine SW interrupt request
#define ACLINT_MTIMECMP    0xfffd4000 // core 0 compare value
#define ACLINT_MTIME       0xfffdbff8 // timer base 10 MHz
#define ACLINT_SSWI        0xfffd0000 // core 0 system SW interrupt request
```

More information about ACLINT can be found in [RISC-V Advanced Core Local Interruptor Specification](https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc).

</details>

### Interrupts and Control and Status Registers

<details>
  <summary>Implemented CSR registers and their usage</summary>

List of interrupt sources:

| Irq number | mie / mip Bit    | Source                                       |
|-----------:|-----------------:|:---------------------------------------------|
| 3          | 3                | Machine software interrupt request           |
| 7          | 7                | Machine timer interrupt                      |
| 16         | 16               | There is received character ready to be read |
| 17         | 17               | Serial port ready to accept character to Tx  |

Following Control Status registers are recognized

| Number | Name       | Description                                                         |
|-------:|:-----------|:--------------------------------------------------------------------|
|  0x300 | mstatus    | Machine status register. |
|  0x304 | mie        | Machine interrupt-enable register. |
|  0x305 | mtvec      | Machine trap-handler base address. |
|  0x340 | mscratch   | Scratch register for machine trap handlers. |
|  0x341 | mepc       | Machine exception program counter. |
|  0x342 | mcause     | Machine trap cause. |
|  0x343 | mtval      | Machine bad address or instruction. |
|  0x344 | mip        | Machine interrupt pending. |
|  0x34A | mtinsr     | Machine trap instruction (transformed). |
|  0x34B | mtval2     | Machine bad guest physical address. |
|  0xB00 | mcycle     | Machine cycle counter. |
|  0xB02 | minstret   | Machine instructions-retired counter. |
|  0xF11 | mvendorid  | Vendor ID. |
|  0xF12 | marchid    | Architecture ID. |
|  0xF13 | mimpid     | Implementation ID. |
|  0xF14 | mhardid    | Hardware thread ID. |

`csrr`, `csrw`, `csrrs` , `csrrs` and `csrrw` are used to copy and exchange value from/to RISC-V control status registers.

Sequence to enable serial port receive interrupt:

Decide location of interrupt service routine the first. The address of the common trap handler is defined by `mtvec` register and then PC is set to this address when exception or interrupt is accepted.

Enable bit 16 in the machine Interrupt-Enable register (`mie`). Ensure that bit 3 (`mstatus.mie` - machine global interrupt-enable) of Machine Status register is set to one.

Enable interrupt in the receiver status register (bit 1 of `SERP_RX_ST_REG`).

Write character to the terminal. It should be immediately consumed by the serial port receiver if interrupt is enabled
in `SERP_RX_ST_REG`. CPU should report interrupt exception and when it propagates to the execution phase `PC` is set to
the interrupt routine start address.

</details>

### System Calls Support

<details>
  <summary>Syscall table and documentation</summary>

The emulator includes support for a few Linux kernel system calls. The RV32G ilp32 ABI is used.

| Register                           | use on input          | use on output   | Calling Convention             |
|:-----------------------------------|:----------------------|:----------------|:-------------------------------|
| zero (x0)                          | —                     | -               | Hard-wired zero                |
| ra (x1)                            | —                     | (preserved)     | Return address                 |
| sp (x2)                            | —                     | (callee saved)  | Stack pointer                  |
| gp (x3)                            | —                     | (preserved)     | Global pointer                  |
| tp (x4)                            | —                     | (preserved)     | Thread pointer                 |
| t0 .. t2 (x5 .. x7)                | —                     | -               | Temporaries                    |
| s0/fp (x8)                         | —                     | (callee saved)  | Saved register/frame pointer   |
| s1 (x9)                            | —                     | (callee saved)  | Saved register                 |
| a0 (x10)                           | 1st syscall argument  | return value    | Function argument/return value |
| a1 (x11)                           | 2nd syscall argument  | -               | Function argument/return value |
| a2 .. a5 (x12 .. x15)              | syscall arguments     | -               | Function arguments             |
| a6 (x16)                           | -                     | -               | Function arguments             |
| a7 (x17)                           | syscall number        | -               | Function arguments             |
| s2 .. s11 (x18 .. x27)             | —                     | (callee saved)  | Saved registers                |
| t3 .. t6 (x28 .. x31)              | —                     | -               | Temporaries                    |

The all system call input arguments are passed in register.

Supported syscalls:

#### void [exit](http://man7.org/linux/man-pages/man2/exit.2.html)(int status) __NR_exit (93)

Stop/end execution of the program. The argument is exit status code, zero means OK, other values informs about error.

#### ssize_t [read](http://man7.org/linux/man-pages/man2/read.2.html)(int fd, void *buf, size_t count) __NR_read (63)

Read `count` bytes from open file descriptor `fd`. The emulator maps file descriptors 0, 1 and 2 to the internal
terminal/console emulator. They can be used without `open` call. If there are no more characters to read from the
console, newline is appended. At most the count bytes read are stored to the memory location specified by `buf`
argument. Actual number of read bytes is returned.

#### ssize_t [write](http://man7.org/linux/man-pages/man2/write.2.html)(int fd, const void *buf, size_t count) __NR_write (64)

Write `count` bytes from memory location `buf` to the open file descriptor
`fd`. The same about console for file handles 0, 1 and 2 is valid as for `read`.

#### int [close](http://man7.org/linux/man-pages/man2/close.2.html)(int fd) __NR_close (57)

Close file associated to descriptor `fd` and release descriptor.

#### int [openat](http://man7.org/linux/man-pages/man2/open.2.html)(int dirfd, const char *pathname, int flags, mode_t mode) __NR_openat (56)

Open file and associate it with the first unused file descriptor number and return that number. If the
option `OS Emulation`->`Filesystem root`
is not empty then the file path `pathname` received from emulated environment is appended to the path specified
by `Filesystem root`. The host filesystem is protected against attempt to traverse to random directory by use of `..`
path elements. If the root is not specified then all open files are targetted to the emulated terminal. Only `TARGET_AT_FDCWD` (`dirfd` = -100) mode is supported.

#### void * [brk](http://man7.org/linux/man-pages/man2/brk.2.html)(void *addr) __NR_brk (214)

Set end of the area used by standard heap after end of the program data/bss. The syscall is emulated by dummy
implementation. Whole address space up to 0xffff0000 is backuped by automatically attached RAM.

#### int [ftruncate](http://man7.org/linux/man-pages/man2/ftruncate.2.html)(int fd, off_t length) __NR_truncate (46)

Set length of the open file specified by `fd` to the new `length`. The `length`
argument is 64-bit even on 32-bit system and it is passed as the lower part and the higher part in the
second and third argument.

#### ssize_t [readv](http://man7.org/linux/man-pages/man2/readv.2.html)(int fd, const struct iovec *iov, int iovcnt) __NR_Linux (65)

The variant of `read` system call where data to read are would be stored to locations specified by `iovcnt` pairs of
base address, length pairs stored in memory at address pass in `iov`.

#### ssize_t [writev](http://man7.org/linux/man-pages/man2/writev.2.html)(int fd, const struct iovec *iov, int iovcnt) __NR_Linux (66)

The variant of `write` system call where data to write are defined by `iovcnt`
pairs of base address, length pairs stored in memory at address pass in `iov`.

</details>

## Limitations of the Implementation

- See list of currently supported instructions.

### QtRvSim limitations

* Only very minimal support for privileged instruction is implemented for now (mret).
* Only machine mode and minimal subset of machine CSRs is implemented.
* TLB and virtual memory are not implemented.
* No floating point support
* Memory access stall (stalling execution because of cache miss would be pretty annoying for users so difference between
  cache and memory is just in collected statistics)
* Only limited support for interrupts and exceptions. When `ecall`
  instruction is recognized, small subset of the Linux kernel system calls
  can be emulated or simulator can be configured to continue by trap handler
  on `mtvec` address.

### List of Currently Supported Instructions

- **RV32I**:
  - **LOAD**: `lw, lh, lb, lwu, lhu, lbu`
  - **STORE**: `sw, sh, sb, swu, shu, sbu`
  - **OP**: `add, sub, sll, slt, sltu, xor, srl, sra, or, and`
  - **MISC-MEM**: `fence, fence.i`
  - **OP-IMM**: `addi, sll, slti, sltiu, xori, srli, srai, ori, andi, auipc, lui`
  - **BRANCH**: `beq, bne, btl, bge, bltu, bgtu`
  - **JUMP**: `jal, jalr`
  - **SYSTEM**: `ecall, mret, ebreak, csrrw, csrrs, csrrc, csrrwi, csrrsi, csrrci`
- **RV64I**:
  - **LOAD/STORE**: `lwu, ld, sd`
  - **OP-32**: `addw, subw, sllw, srlw, sraw, or, and`
  - **OP-IMM-32**: `addiw, sllw, srliw, sraiw`
- **Pseudoinstructions**
  - **BASIC**: `nop`
  - **LOAD**: `la, li`,
  - **OP**: `mv, not, neg, negw, sext.b, sext.h, sext.w, zext.b, zext.h, zext.w, seqz, snez, sltz, slgz`
  - **BRANCH**: `beqz, bnez, blez, bgez, bltz, bgtz, bgt, ble, bgtu, bleu`
  - **JUMP**: `j, jal, jr, jalr, ret, call, tail`
- **Extensions**
  - **RV32M/RV64M**: `mul, mulh, mulhsu, div, divu, rem, remu`
  - **RV64M**: `mulw, divw, divuw, remw, remuw`
  - **RV32A/RV64A**: `lr.w, sc.w, amoswap.w, amoadd.w, amoxor.w, amoand.w, amoor.w, amomin.w, amomax.w, amominu.w, amomaxu.w`
  - **RV64A**: `lr.d, sc.d, amoswap.d, amoadd.d, amoxor.d, amoand.d, amoor.d, amomin.d, amomax.d, amominu.d, amomaxu.d`
  - **Zicsr**: `csrrw, csrrs, csrrc, csrrwi, csrrsi, csrrci`

For details about RISC-V, refer to the ISA specification:
[https://riscv.org/technical/specifications/](https://riscv.org/technical/specifications/).

## Links to Resources and Similar Projects

### Resources and Publications

- Computer architectures pages at Czech Technical University in Prague [https://comparch.edu.cvut.cz/](https://comparch.edu.cvut.cz/)

- Dupak, J.; Pisa, P.; Stepanovsky, M.; Koci, K. [QtRVSim – RISC-V Simulator for Computer Architectures Classes](https://comparch.edu.cvut.cz/publications/ewC2022-Dupak-Pisa-Stepanovsky-QtRvSim.pdf) In: [embedded world Conference 2022](https://events.weka-fachmedien.de/embedded-world-conference). Haar: WEKA FACHMEDIEN GmbH, 2022. p. 775-778. ISBN 978-3-645-50194-1. ([Slides](https://comparch.edu.cvut.cz/slides/ewc22-qtrvsim.pdf))

Please reference above article, if you use QtRvSim in education or research related materials and publications.

- [FEE CTU - B35APO - Computer Architectures](https://cw.fel.cvut.cz/wiki/courses/b35apo)
  - Undergraduate computer architecture class materials (
    Czech) ([English](https://cw.fel.cvut.cz/wiki/courses/b35apo/en/start))
- [FEE CTU - B4M35PAP - Advanced Computer Architectures](https://cw.fel.cvut.cz/wiki/courses/b4m35pap/start)
  - Graduate computer architecture class materials (Czech/English)
- [Graphical RISC-V Architecture Simulator - Memory Model and Project Management](https://dspace.cvut.cz/bitstream/handle/10467/94446/F3-BP-2021-Dupak-Jakub-thesis.pdf)
  - Jakub Dupak's thesis
  - Documents 2020-2021 QtMips and QtRvSim development
- [Graphical CPU Simulator with Cache Visualization](https://dspace.cvut.cz/bitstream/handle/10467/76764/F3-DP-2018-Koci-Karel-diploma.pdf)
  - Karel Koci's thesis
  - Documents initial QtMips development

### Projects

- **QtMips** - MIPS predecessor of this simulator [https://github.com/cvut/QtMips/](https://github.com/cvut/QtMips/)

- **RARS** - RISC-V Assembler and Runtime
  Simulator [https://github.com/TheThirdOne/rars](https://github.com/TheThirdOne/rars)

## Copyright

- Copyright (c) 2017-2019 Karel Koci <cynerd@email.cz>
- Copyright (c) 2019-2025 Pavel Pisa <pisa@cmp.felk.cvut.cz>
- Copyright (c) 2020-2025 Jakub Dupak <dev@jakubdupak.com>
- Copyright (c) 2020-2021 Max Hollmann <hollmmax@fel.cvut.cz>

## License

This project is licensed under `GPL-3.0-or-later`. The full text of the license is in the [LICENSE](LICENSE) file. The
license applies to all files except for directories named `external` and files in them. Files in external directories
have a separate license compatible with the projects license.

> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
>
> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
>
> You should have received a copy of the GNU General Public License along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).

![Faculty of Electrical Engineering](./data/ctu/logo-fee.svg) ![Faculty of Information Technology](./data/ctu/logo-fit.svg) ![Czech Technical University](./data/ctu/logo-ctu.svg)


================================================
FILE: cmake/AddFileHashes.cmake
================================================
# Add file hashes to placeholder location in a template file.
# Used for packaging.
#
# Example:
# cmake -DTEMPLATE=PKGBUILD.in -DOUTPUT=PKGBUILD -DFILE=qtrvsim_0.8.0.tar.xz -P AddFileHashes.cmake
#
# See extras/packaging/arch/PKGBUILD.in for template examples.
# Note that most files are configured (injected with information) twice:
# First, during configure phase, package information is added and FILE_*
# placeholders are left intact. Second, after source packing, FILE_*
# placeholders are resolved.

file(MD5 ${FILE} FILE_MD5)
file(SHA1 ${FILE} FILE_SHA1)
file(SHA256 ${FILE} FILE_SHA256)
file(SIZE ${FILE} FILE_SIZE)
configure_file(${TEMPLATE} ${OUTPUT})

================================================
FILE: cmake/BuildType.cmake
================================================
# Source (BSD-3) https://github.com/openchemistry/tomviz/blob/master/cmake/BuildType.cmake

# Set a default build type if none was specified
set(default_build_type "Release")

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
	message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
	set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
	    STRING "Choose the type of build." FORCE)
	# Set the possible values of build type for cmake-gui
	set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
	             "MinSizeRel" "RelWithDebInfo")
endif()

# Set variable to detect given build type
if(CMAKE_BUILD_TYPE)
    string(TOUPPER "${CMAKE_BUILD_TYPE}" _upper_build_type)
    set(BUILD_${_upper_build_type} 1)
endif()

================================================
FILE: cmake/BundleMacOS.cmake
================================================
find_program(MACDEPLOYQT
             NAMES macdeployqt)


================================================
FILE: cmake/CopyrightTools.cmake
================================================
function(copyright_to_html OUTPUT INPUT)
	string(REPLACE ";" "<br>" TMP1 "${INPUT}")
	string(REGEX REPLACE "<([^<>]+@[^<>]+)>" "<a href='mailto:\\1'>\\1</a>" TMP2 ${TMP1})
	set(${OUTPUT} ${TMP2} PARENT_SCOPE)
endfunction()

function(copyright_to_comment OUTPUT INPUT)
	string(REGEX REPLACE "([^;]+)" "# \\1" ${OUTPUT} "${INPUT}")
	string(REPLACE ";" "\n" ${OUTPUT} "${${OUTPUT}}")
	set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE)
endfunction()

macro(copyright)
	set(COPYRIGHT_LIST "${ARGN}")
	copyright_to_html(COPYRIGHT_HTML "${COPYRIGHT_LIST}")
	copyright_to_comment(COPYRIGHT_HASH_COMMENT "${COPYRIGHT_LIST}")
endmacro()


================================================
FILE: cmake/FindElfUtils.cmake
================================================
# Source (GPLv2): https://github.com/SimonKagstrom/kcov/blob/master/cmake/FindElfutils.cmake

# - Try to find libdwarf
# Once done this will define
#
#  LIBDWARF_FOUND - system has libdwarf
#  LIBDWARF_INCLUDE_DIRS - the libdwarf include directory
#  LIBDWARF_LIBRARIES - Link these to use libdwarf
#  LIBDWARF_DEFINITIONS - Compiler switches required for using libdwarf
#

# Locate libelf library at first
if (NOT LIBELF_FOUND)
    find_package(LibElf)
endif (NOT LIBELF_FOUND)

if (LIBDWARF_LIBRARIES AND LIBDWARF_INCLUDE_DIRS)
    set(LibDwarf_FIND_QUIETLY ON)
endif (LIBDWARF_LIBRARIES AND LIBDWARF_INCLUDE_DIRS)

find_package(PkgConfig QUIET)

if (PKG_CONFIG_FOUND)
    set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
    pkg_check_modules(PC_LIBDW QUIET libdw)
endif ()

find_path(DWARF_INCLUDE_DIR
        NAMES
        dwarf.h
        HINTS
        ${PC_LIBDW_INCLUDE_DIRS}
        PATHS
        /usr/include
        /usr/local/include
        /opt/local/include
        /sw/include
        ENV CPATH) # PATH and INCLUDE will also work
find_path(LIBDW_INCLUDE_DIR
        NAMES
        elfutils/libdw.h
        HINTS
        ${PC_LIBDW_INCLUDE_DIRS}
        PATHS
        /usr/include
        /usr/local/include
        /opt/local/include
        /sw/include
        ENV CPATH)
if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR)
    set(LIBDWARF_INCLUDE_DIRS ${DWARF_INCLUDE_DIR} ${LIBDW_INCLUDE_DIR})
endif (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR)

find_library(LIBDW_LIBRARY
        NAMES
        dw
        HINTS
        ${PC_LIBDW_LIBRARY_DIRS}
        PATHS
        /usr/lib
        /usr/local/lib
        /opt/local/lib
        /sw/lib
        ENV LIBRARY_PATH   # PATH and LIB will also work
        ENV LD_LIBRARY_PATH)

include(FindPackageHandleStandardArgs)


# handle the QUIETLY and REQUIRED arguments and set LIBDWARF_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(ElfUtils DEFAULT_MSG
        LIBDW_LIBRARY
        LIBDW_INCLUDE_DIR)

mark_as_advanced(LIBDW_INCLUDE_DIR LIBDW_LIBRARY)

set(LIBDW_LIBRARIES ${LIBDW_LIBRARY})
set(LIBDW_INCLUDE_DIRS ${LIBDW_INCLUDE_DIR})

================================================
FILE: cmake/FindLibElf.cmake
================================================
# Source (GPLv2): https://github.com/SimonKagstrom/kcov/blob/master/cmake/FindLibElf.cmake

# - Try to find libelf
# Once done this will define
#
#  LIBELF_FOUND - system has libelf
#  LIBELF_INCLUDE_DIRS - the libelf include directory
#  LIBELF_LIBRARIES - Link these to use libelf
#  LIBELF_DEFINITIONS - Compiler switches required for using libelf
#
#  Copyright (c) 2008 Bernhard Walle <bernhard.walle@gmx.de>
#
#  Redistribution and use is allowed according to the terms of the New
#  BSD license.
#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#

if (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS)
    set(LibElf_FIND_QUIETLY ON)
endif (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS)

find_package(PkgConfig QUIET)

if (PKG_CONFIG_FOUND)
    set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
    pkg_check_modules(PC_LIBELF QUIET libelf)
endif ()

find_path(LIBELF_INCLUDE_DIR
        NAMES
        libelf.h
        HINTS
        ${PC_LIBELF_INCLUDE_DIRS}
        PATHS
        /usr/include
        /usr/include/libelf
        /usr/local/include
        /usr/local/include/libelf
        /opt/local/include
        /opt/local/include/libelf
        /sw/include
        /sw/include/libelf
        ENV CPATH)

find_library(LIBELF_LIBRARY
        NAMES
        elf
        HINTS
        ${PC_LIBELF_LIBRARY_DIRS}
        PATHS
        /usr/lib
        /usr/local/lib
        /opt/local/lib
        /sw/lib
        ENV LIBRARY_PATH
        ENV LD_LIBRARY_PATH)

include(FindPackageHandleStandardArgs)


# handle the QUIETLY and REQUIRED arguments and set LIBELF_FOUND to TRUE if all listed variables are TRUE
find_package_handle_standard_args(LibElf DEFAULT_MSG
        LIBELF_LIBRARY
        LIBELF_INCLUDE_DIR)


mark_as_advanced(LIBELF_INCLUDE_DIR LIBELF_LIBRARY)

set(LIBELF_LIBRARIES ${LIBELF_LIBRARY})
set(LIBELF_INCLUDE_DIRS ${LIBELF_INCLUDE_DIR})

================================================
FILE: cmake/FindPythonInterp.cmake
================================================
# Compatibility wrapper for CMake > 3.12 where FindPythonInterp is deprecated/removed
# This allows external projects using the old module to work with newer CMake and Python3

find_package(Python3 COMPONENTS Interpreter QUIET)

if(Python3_Interpreter_FOUND)
    set(PYTHONINTERP_FOUND TRUE)
    set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
    set(PYTHON_VERSION_STRING ${Python3_VERSION})
    set(PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR})
    set(PYTHON_VERSION_MINOR ${Python3_VERSION_MINOR})
    set(PYTHON_VERSION_PATCH ${Python3_VERSION_PATCH})
    
    if(NOT PythonInterp_FIND_QUIETLY)
        message(STATUS "Found PythonInterp (via Python3): ${PYTHON_EXECUTABLE} (found version \"${PYTHON_VERSION_STRING}\")")
    endif()
else()
    if(PythonInterp_FIND_REQUIRED)
        message(FATAL_ERROR "Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)")
    endif()
endif()


================================================
FILE: cmake/GPL-3.0-or-later.cmake
================================================
# Licence related data to be included in project files

set(LICENCE_IDENTIFIER "GPL-3.0-or-later")
set(LICENCE_SHORT "\
This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not,
see <https://www.gnu.org/licenses/>.")
set(LICENCE_SHORT_HTML "\
<p>This program is free software: you can redistribute it and/or modify it under the terms of the \
GNU General Public License as published by the Free Software Foundation, either version 3 of the \
License, or (at your option) any later version.</p> \
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; \
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
GNU General Public License for more details.</p> \
<p>You should have received a copy of the GNU General Public License along with this program. \
If not, see <a href='https://www.gnu.org/licenses/'>https://www.gnu.org/licenses/</a>.</p>")

================================================
FILE: cmake/LibElfinSettings.cmake
================================================
if(POLICY CMP0148)
    cmake_policy(SET CMP0148 OLD)
endif()

# Libelfin requires Threads for dwarf++ library
find_package(Threads REQUIRED)



================================================
FILE: cmake/PackageTools.cmake
================================================
# Support code for package handling.
# Mainly intended to generate inputs for Open Build Service.

# Keep file properties placeholder in configure phase, they are replaced in build phase
set(FILE_NAME "\@FILE_NAME\@")
set(FILE_SIZE "\@FILE_SIZE\@")
set(FILE_MD5 "\@FILE_MD5\@")
set(FILE_SHA1 "\@FILE_SHA1\@")
set(FILE_SHA256 "\@FILE_SHA256\@")
set(FILE2_NAME "\@FILE2_NAME\@")
set(FILE2_SIZE "\@FILE2_SIZE\@")
set(FILE2_MD5 "\@FILE2_MD5\@")
set(FILE2_SHA1 "\@FILE2_SHA1\@")
set(FILE2_SHA256 "\@FILE2_SHA256\@")


# Source file tar generation.

# Make sure that destination path exists as it wont be created automatically.
file(MAKE_DIRECTORY ${PACKAGE_OUTPUT_PATH})

find_program(BASH bash REQUIRED)
find_program(GIT git REQUIRED)
find_program(XZ xz REQUIRED)
find_program(TAR tar REQUIRED)

# Command to build source archive from git HEAD.
add_custom_command(OUTPUT ${PACKAGE_SOURCE_ARCHIVE_FILE}
		COMMAND ${BASH} ${CMAKE_SOURCE_DIR}/extras/packaging/_tools/git-archive-submodules.sh
		${CMAKE_SOURCE_DIR} ${PACKAGE_OUTPUT_PATH} ${PACKAGE_SOURCE_ARCHIVE_FILE}
		${PACKAGE_NAME} ${PACKAGE_VERSION} ${GIT} ${TAR} ${XZ}
		WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
add_custom_target(source_archive
		DEPENDS ${PACKAGE_SOURCE_ARCHIVE_FILE})

# Procedure adding support for individual OS distributions.
#
# @param target_name            name of created target for simple reference (recommended: OS name)
# @param config_file_name       name of resulting config file
# @param template               path to cmake template file (relative from source dir)
#
# NOTE: ${PACKAGE_SOURCE_ARCHIVE_FILE} is assumed to exist in scope and be unique for project
#

macro(package_config_file target_name config_file_name template)
	# The @ONLY option disable replacement of ${} which may be used by shell as well.
	configure_file(${template} ${config_file_name}.in @ONLY)
	add_custom_command(OUTPUT ${config_file_name}
			COMMAND ${CMAKE_COMMAND} -DFILE="${PACKAGE_SOURCE_ARCHIVE_PATH}"
			-DTEMPLATE="${CMAKE_BINARY_DIR}/${config_file_name}.in"
			-DOUTPUT=${PACKAGE_OUTPUT_PATH}/${config_file_name}
			-P "${CMAKE_SOURCE_DIR}/cmake/AddFileHashes.cmake"
			DEPENDS source_archive)
	add_custom_target(${target_name}
			DEPENDS ${config_file_name})
endmacro()

macro(package_debian_quilt target_name config_file_name template debian_dir output_archive)
	file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian)
	# The @ONLY option disable replacement of ${} which may be used by shell as well.
	configure_file(${debian_dir}/control.in ${CMAKE_BINARY_DIR}/debian/control @ONLY)
	file(COPY ${CMAKE_BINARY_DIR}/debian/control DESTINATION ${CMAKE_BINARY_DIR}/debian
			FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
	file(COPY ${debian_dir}/compat
			DESTINATION ${CMAKE_BINARY_DIR}/debian
			FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
	file(COPY ${debian_dir}/rules
			DESTINATION ${CMAKE_BINARY_DIR}/debian
			FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE GROUP_EXECUTE)
	file(COPY ${debian_dir}/docs
			DESTINATION ${CMAKE_BINARY_DIR}/debian
			FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
	file(COPY ${debian_dir}/changelog
			DESTINATION ${CMAKE_BINARY_DIR}/debian
			FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
	file(COPY ${debian_dir}/source/format
			DESTINATION ${CMAKE_BINARY_DIR}/debian/source
			FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
	file(ARCHIVE_CREATE
			OUTPUT ${PACKAGE_OUTPUT_PATH}/${output_archive}
			PATHS ${CMAKE_BINARY_DIR}/debian
			FORMAT gnutar
			COMPRESSION XZ)
	set(DEBIAN_ARCHIVE_FILE ${output_archive})
	file(MD5 ${PACKAGE_OUTPUT_PATH}/${output_archive} DEBIAN_MD5)
	file(SHA1 ${PACKAGE_OUTPUT_PATH}/${output_archive} DEBIAN_SHA1)
	file(SHA256 ${PACKAGE_OUTPUT_PATH}/${output_archive} DEBIAN_SHA256)
	file(SIZE ${PACKAGE_OUTPUT_PATH}/${output_archive} DEBIAN_SIZE)
	configure_file(${template} ${config_file_name}.in @ONLY)
	add_custom_command(OUTPUT ${config_file_name}
			COMMAND ${CMAKE_COMMAND} -DFILE="${PACKAGE_SOURCE_ARCHIVE_PATH}"
			-DTEMPLATE="${CMAKE_BINARY_DIR}/${config_file_name}.in"
			-DOUTPUT=${PACKAGE_OUTPUT_PATH}/${config_file_name}
			-P "${CMAKE_SOURCE_DIR}/cmake/AddFileHashes.cmake"
			DEPENDS source_archive)
	add_custom_target(${target_name}
			DEPENDS ${config_file_name})

	message(STATUS "Debian archive created")
endmacro()

================================================
FILE: cmake/TestingTools.cmake
================================================
# Helper functions for integration testing

# Creates a new CLI test. The test consists of two parts: the first runs the command and checks nonzero return value,
# the second compares the stdout with provided files. Currently there diff is not displayed as cmake does not provide a
# portable way to do that.
#
# TODO: show diff whenever available.
#
# NOTE:
#   If CLI was build in debug mode (which is recommended) the test will run with sanitizers and any memory errors
#   including memory leaks will fail the test.
#
# Usage:
#   add_cli_test(
#		NAME <name>
#		ARGS
#			--asm "${CMAKE_SOURCE_DIR}/tests/cli/<name>/program.S"
#			<other CLI commands>
#		EXPECTED_OUTPUT "tests/cli/<name>/stdout.txt"
#   )

function(add_cli_test)
	cmake_parse_arguments(
			CLI_TEST
			""
			"NAME;EXPECTED_OUTPUT"
			"ARGS"
			${ARGN}
	)
	add_custom_target(
			cli_test_${CLI_TEST_NAME}
			COMMAND ${CMAKE_COMMAND} -E make_directory "Testing"
			COMMAND cli ${CLI_TEST_ARGS} > "Testing/stall_test.out"
			COMMAND ${CMAKE_COMMAND} -E compare_files "Testing/stall_test.out"
			"${CMAKE_SOURCE_DIR}/${CLI_TEST_EXPECTED_OUTPUT}"
			WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
			DEPENDS cli
	)

	add_test(
			NAME "cli_${CLI_TEST_NAME}"
			COMMAND ${CMAKE_COMMAND} --build . --target "cli_test_${CLI_TEST_NAME}"
			WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
endfunction()


================================================
FILE: data/cz.cvut.edu.comparch.qtrvsim.metainfo.xml.in
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2022 David Heidelberg -->
<component type="desktop-application">
  <id>@MAIN_PROJECT_APPID@</id>
  <name>@GENERIC_NAME@</name>
  <developer_name>Czech Technical University in Prague</developer_name>
  <summary>RISC-V CPU simulator for education purposes</summary>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>GPL-3.0-or-later</project_license>
  <launchable type="desktop-id">@MAIN_PROJECT_NAME_LOWER@.desktop</launchable>
  <content_rating type="oars-1.1"/>

  <description>
    <p>
      RISC-V processor architecture simulator for education purposes with pipeline and cache visualization.
    </p>
  </description>

  <releases>
    <release version="@MAIN_PROJECT_VERSION@" date="2024-10-01">
      <description>
        <p>Current project release.</p>
      </description>
    </release>
    <release version="0.9.7" date="2024-02-16">
      <description>
        <p>GUI fix crash when no tab is selected, use bundled LibElf on macOS as Homebrew misses RISC-V</p>
      </description>
    </release>
    <release version="0.9.6" date="2023-12-11">
      <description>
        <p>RISC-V A extension, ACLINT MTIMER, IRQ support, L2 cache, GUI editor tabs</p>
      </description>
    </release>
    <release version="0.9.5" date="2023-01-16">
      <description>
        <p>More CSR updates, fix branch range, CLI OS emulation, coreview diagrams updates, RV64IM in CI</p>
      </description>
    </release>
    <release version="0.9.4" date="2022-10-26">
      <description>
        <p>Support for 64-bit RV64IM target and official tests in CI</p>
      </description>
    </release>
    <release version="0.9.3" date="2022-04-22">
      <description>
        <p>Corrected peripherals, LCD endianness and memory stalls.</p>
      </description>
    </release>
    <release version="0.9.2" date="2022-03-14">
      <description>
        <p>Initial Flatpak release.</p>
      </description>
    </release>
  </releases>

  <screenshots>
    <screenshot type="default" width="1526" height="888">
      <image>https://raw.githubusercontent.com/cvut/qtrvsim/master/data/screenshots/0.png</image>
    </screenshot>
    <screenshot type="default" width="1526" height="888">
      <image>https://raw.githubusercontent.com/cvut/qtrvsim/master/data/screenshots/1.png</image>
    </screenshot>
  </screenshots>

  <url type="homepage">https://github.com/cvut/qtrvsim</url>
  <url type="bugtracker">https://github.com/cvut/qtrvsim/issues</url>

  <requires>
    <display_length compare="ge">768</display_length>
  </requires>

  <recommends>
    <control>keyboard</control>
    <control>pointing</control>
  </recommends>

  <kudos>
    <kudo>ModernToolkit</kudo>
  </kudos>

  <update_contact>david_AT_ixit.cz</update_contact>

  <custom>
    <value key="Purism::form_factor">workstation</value>
  </custom>
</component>


================================================
FILE: data/gui.desktop.in
================================================
[Desktop Entry]
Name=@PROJECT_NAME@
GenericName=@GENERIC_NAME@
Exec=@MAIN_PROJECT_NAME_LOWER@_gui
Icon=@MAIN_PROJECT_NAME_LOWER@_gui
Type=Application
Comment=@GENERIC_NAME@
Terminal=false
Categories=System;Emulator;
Keywords=emulator;RISC-V;education;


================================================
FILE: data/wasm/browserconfig.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
    <msapplication>
        <tile>
            <square150x150logo src="/mstile-150x150.png"/>
            <TileColor>#da532c</TileColor>
        </tile>
    </msapplication>
</browserconfig>


================================================
FILE: data/wasm/index.html
================================================
<!doctype html>
<!-- BASED ON: qt/5.15.2/wasm_32/plugins/platforms/wasm_shell.html -->
<html lang="en-us">
<head>
    <meta charset="utf-8">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>QtRVSim: RISV-V simulator for education</title>
    <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">
    <link rel="manifest" href="./manifest.json">
    <link rel="mask-icon" href="./safari-pinned-tab.svg" color="#d5875b">
    <meta name="apple-mobile-web-app-title" content="QtRVSim">
    <meta name="application-name" content="QtRVSim">
    <meta name="msapplication-TileColor" content="#da532c">
    <meta name="theme-color" content="#ffffff">

    <style>
        html, body {
            padding: 0;
            margin: 0;
            overflow: hidden;
            height: 100%
        }

        /* the canvas *must not* have any border or padding, or mouse coords will be wrong */
        canvas {
            border: 0 none;
            background-color: white;
            height: 100%;
            width: 100%;
        }

        /* The content editable property is set to true for the canvas in order to support
           clipboard events. Hide the resulting focus frame and set the cursor back to
           the default cursor. */
        canvas {
            outline: 0 solid transparent;
            caret-color: transparent;
            cursor: default
        }
    </style>
</head>
<body onload="init()">
<figure id="qtspinner" style="overflow:visible;">
    <div style="margin-top:1.5em; line-height:150%; text-align: center;">
        <img height=200; src="logo.svg" style="display:block; margin: auto;" width="320" alt="Qt">
        <strong>Qt for WebAssembly: qtrvsim_gui</strong>
        <div id="qtstatus"></div>
        <noscript>JavaScript is disabled. Please enable JavaScript to use this application.</noscript>
    </div>
</figure>
<canvas contenteditable="true" id="qtcanvas" oncontextmenu="event.preventDefault()"></canvas>

<script type='text/javascript'>
    function init() {
        var spinner = document.querySelector('#qtspinner');
        var canvas = document.querySelector('#qtcanvas');
        var status = document.querySelector('#qtstatus')

        var qtLoader = QtLoader({
            canvasElements: [canvas],
            showLoader: function (loaderStatus) {
                spinner.style.display = 'block';
                canvas.style.display = 'none';
                status.innerHTML = loaderStatus + "...";
            },
            showError: function (errorText) {
                status.innerHTML = errorText;
                spinner.style.display = 'block';
                canvas.style.display = 'none';
            },
            showExit: function () {
                status.innerHTML = "Application exit";
                if (qtLoader.exitCode !== undefined)
                    status.innerHTML += " with code " + qtLoader.exitCode;
                if (qtLoader.exitText !== undefined)
                    status.innerHTML += " (" + qtLoader.exitText + ")";
                spinner.style.display = 'block';
                canvas.style.display = 'none';
            },
            showCanvas: function () {
                spinner.style.display = 'none';
                canvas.style.display = 'block';
            },
        });
        qtLoader.loadEmscriptenModule("qtrvsim_gui");
    }
</script>
<script src="qtloader.js" type="text/javascript"></script>
</body>
</html>


================================================
FILE: data/wasm/manifest.json
================================================
{
    "name": "QtRVSim: RISC-V simulator for education",
    "short_name": "QtRVSim",
    "icons": [
        {
            "src": "./android-chrome-192x192.png",
            "sizes": "192x192",
            "type": "image/png"
        },
        {
            "src": "./android-chrome-512x512.png",
            "sizes": "512x512",
            "type": "image/png"
        }
    ],
    "theme_color": "#ffffff",
    "background_color": "#ffffff",
    "display": "standalone",
    "start_url": "./index.hml"
}


================================================
FILE: default.nix
================================================
let
  pkgs = import <nixpkgs> { };
in
{
    qtrvsim = pkgs.libsForQt5.callPackage (import extras/packaging/nix/qtrvsim.nix) {};
}


================================================
FILE: docs/developer/build&deploy/building-wasm.md
================================================
# Building and deploying WebAssembly release of the simulator

## Jump start

WASM release is automatically build by the GitHub actions. Resulting files are available in `Actions`
/`<detail of build you want to use>`, section `Artifacts`, file `target-wasm-Linux-qtx.xx.x`. Download the files and
skip to deploy. Details on the build process can be found in `.github/workflows/cmake.yml`.

## Jump start 2

Install `emsdk` and `aqt` (details below).

Use prepared helper make in the root of the project.

```shell
make wasm # build
make wasm-clean # clean wasm build
make wasm-clean-deap # also clean cached external libraries - when changing compile settings, of when it just does not work ;)
make wasm-install-qt # install appropriate qt for wasm using aqt
```

Behavior of this commands is customized to local system in `.dev-config.local.mk`. The file is provided as a template
and further changes are ignored.

## Dependencies

- WASM compiler (Emscripten/EMSDK)
- WASM compiled Qt
- bash compatible shell (not fish, unfortunately)

Steps:

- Install `emsdk` toolkit. Installing just the Emscripten compiler might work, but I would discourage it.
- Choose version of the toolkit and run `emsdk activate <version>`. You can choose freely as long as all your components
  are compiled with the compatible version. Qt5 distributed release is build with version `1.39.8`. Some distributions
  provide packages like `qt5-wasm`. It is imperative to compile the project with the same toolchain, otherwise it might
  not link.
- Source the toolkit as suggested by the output of the activate command.
- Download or compile qt to wasm. Common way is to store it in `/opt/`. I use an unofficial qt downloader
  [`aqtinstall`](https://pypi.org/project/aqtinstall/).
  - `python -m aqt install 5.12.2 linux desktop wasm_32 --outputdir "/opt/qt"`

## Build

- Move to build directory a build directory (I use`build/wasm`) and
  run (replace the paths accordingly and use your favorite buildsystem):
  ```shell
  emcmake cmake ../..
        -DCMAKE_BUILD_TYPE=Release
        -DCMAKE_PREFIX_PATH=/opt/qt/5.13.1/wasm_32/ 
        -DCMAKE_FIND_ROOT_PATH=/opt/qt/5.13.1/wasm_32/ -Wno-dev -G Ninja
  ```
- Move the resulting `.js` and `.wasm` files to `target/wasm` along with all content of `data/wasm`. It contains
  loader script, icons and other support files.

## Deploy

- Move the contents of `target/wasm` to a webserver. Done.
- Note: the webserver must use https due to CORS.

## Tricks

### Fish and co.

If you wish to use bash incompatible shell. Run bash, source the file, and the run the shell with the environment of the
bash. 


================================================
FILE: docs/developer/build&deploy/release.md
================================================
# Release process

- Check version in root `CMakeLists.txt`
- Update debian changelog
- Make sure, CMake was configured with flag `-DDEV_MODE=true` to enable packaging tools. Without this flag, CMake will
  not try to do anything, that would require an external tool.
- Run `make open_build_service_bundle`.
- Deploy the contents of `<build_dir>/target/pkg` to Open Build Service (and Launchpad).

## Debian changelog

Debian changelog has very strict (and little weird) format. Bash script `extras/packaging/add-to-changelog.sh
<version>` generates a new entry in the changelog and opens it in `$EDITOR`. Edit CAREFULLY, the format is fragile.
After that, changes are committed and git tag is updated.

### TODO

- Decide, whether this should be replaced with CMake.
- Get version from CMake

## `open_build_service_bundle` target

At configure time, package related files are injected with up to date information from CMake (variables prefixed
`PACKAGE_`) and copied to `<executable output directory>`/`pkg`. This target bundles sources to `tar.xz` and updates
hashes in the package files.

### Generate using GitHub Actions (CI)

In the repository page at GitHub go to actions tab and choose release in the left menu.

![](./media/obs-ci-step-1.png)

Click `run workflow` and select a branch.

![](./media/obs-ci-step-2.png)

One the workflow has finished, the bundle is to be found in the artifacts section. Upload this bundle to OBS.

![](./media/obs-ci-step-3.png)

### TODO

- Package signing

## Open Build Service

The easiest way to deploy files to OBS is the `osc` cli tool.

- Setup credentials. The first run of `osc` will lead you.
- Download the repository:

```shell
osc co home:jdupak qtrvsim
```

- Copy files to `home:jdupak`/`qtrvsim`.
- Add files to tracking (in the `qtrvsim` directory):

```shell
osc addremove *
```

- Commit changes and push:

```shell
osc commit
```

- If something went wrong, delete th directory and start from th beginning.



================================================
FILE: docs/developer/coreview-graphics/using-drawio-diagram.md
================================================
# Using .drawio diagram

For easier manipulation the coreview diagrams are created i a diagramming tool [diagrams.net](https://app.diagrams.net),
formerly known as __draw.io__. It is fully sufficient to use it in browser, but installable version is available as
well.

## Prepare your workspace

Before you begin and open the diagram, you have to enable some plugins in menu `Extra`/`Plugins...`. Tou will
need `tags`. Choose it and reload the app.

You will need to enable the tools `Tabs` and `Hidden Tabs` in the `Extras` menu. I also recommend enabling `Layers` tool
in view.

## Export

You have to export 3 SVG files.

In the `Tags` window, empty the field and click `Hide`. Everything will disappear. Then type `simple` and click show. It
will show only components tagged as simple. No hit `File`/`Export as...`/`SVG...`. Uncheck
the `include a copy of diagram` option and git export. Save as `simple.svg`
to `device` and move it to project directory (`src/gui/core`). Hit hide and repeat for other versions (
currently `simple`,`pipeline` and `forwarding`).

## Editing

You can load the diagram from device or from GitHub. Device is preferred as it will not create many useless commits. All
shapes I have used are on [my GitHub](https://github.com/jdupak/Diagrams.net-CPU-scheme-kit). You can open it in `File`
/`Open library from`. If you need write access just open an issue.

The editor itself is quite intuitive, so here are only special functions and highlights:

- When using texts, make sure, that formatted text option is disabled. It would use SVG foreign objects, which are not
  supported in most simple renderers and parsers. The option is cca in the middle of the text tab on the right.
- If you need to ensure that some elements are inside others in the resulting SVG, you have to use `Custom element`,
  otherwise the SVG is flattened. Currently, it is how cache works. In the style tab, you can see inspect it by the `
  edit shape` button. Make sure to select the element and not some group. You can create new one in 
  `Arrange`/`Insert`/`Shape...`. The language is 
  similar to SVG but not
  the same, and it is documented here: [https://www.diagrams.net/doc/faq/shape-complex-create-edit](https://www.
  diagrams.net/doc/faq/shape-complex-create-edit) with complete language reference
  here: [https://jgraph.github. io/mxgraph/docs/stencils.xsd](https://jgraph.github.io/mxgraph/docs/stencils.xsd). This
  is the code of the cache:
  ```xml
    <shape name="cache" h="50" w="60" aspect="fixed" strokewidth="inherit">
      <background>
        <roundrect x="0" y="0" w="60" h="50" arcsize="2" />
      </background>
      <foreground>
        <fillstroke />
        <fontsize size="6" />
        <fontstyle style="1" />
        <fontfamily family="sans-serif" />
        <text str="Cache" x="30" y="10" align="center" />
        <text str="Hit:" x="5" y="25" align="left" />
        <text str="Miss:" x="5" y="34" align="left" />
        <text str="0" x="20" y="25" align="left" />
        <text str="0" x="25" y="34" align="left" />
      </foreground>
    </shape>
  ```
- Components with dynamic values are created in `Edit data` in context menu (`CTRL+M`). Example (written here as a
  json):
  ```json
    {
      "component": "instruction-value",
      "source": "decode"
    }
  ```
  Components are handled in `src/gui/coreview/scene.cpp`, defined in `src/gui/coreview/domponents` and data bindings
  (source attribute) are controlled in `src/gui/coreview/data.h`.
  ![](./media/data.png).
- In context menu - `Edit link...` you can create hyperlinks, what will open some part of gui on doubleclick. The
  connect to `CoreViewScene` signals using table in `src/gui/coreview/data.h`.
- To control in which variant the given element appears, you can use `tags` in `Edit data` of gui tool, which can be
  displayed in `Extras`/`Hidden tags...`
  ![](./media/tags.png).


================================================
FILE: docs/developer/debuging/logging.md
================================================
# Logging

The project uses the Qt logging framework. For quick introduction
see [this KDAB presentation](https://www.kdab.com/wp-content/uploads/stories/slides/Day2/KaiKoehne_Qt%20Logging%20Framework%2016_9_0.pdf)
.

To enable logging in a `cpp` file, add the following snippet.

```c++
#include "common/logging.h"

LOG_CATEGORY("<project>.<file/class>");
```

This creates a category object in the scope and enables seamless use of logging macros `DEBUG` `LOG` `WARN` and `INFO`.
If you need to use logging in a header file, call the `LOG_CATEGORY` macro only in a local scope to avoid interfering
with log categories in source files.

Debug logs are intended to provide fine level of information and should be hidden by default and enabled only for
currently debugged category. Debug logs are removed from all `release` builds.

## Using the log

Qt supports both C++ streams and `printf`-like interface. **In this project, only `printf` style logs should be used.**
Logs are considered to be part of the documentation and stream are too hard to read. The only exception is compatibility
with used libraries (curretly *svgscene*).

To print any Qt type, just wrap it with `qPrintable` macro.

**Example:**

```
QT_LOGGING_CONF=/data/Dev/school/QtRvSim/qtlogging.ini;
```

```cpp
DEBUG("Link triggered (href: %s).", qPrintable(getTargetName()));
```

## Configuring the log

To filter shown logs, modify `qtlogging.ini` file in the root of the project. If this config is not found automatically,
use `QT_LOGGING_CONF`environment variable.

**Example:**

```shell
QT_LOGGING_CONF=/data/Dev/school/QtRvSim/qtlogging.ini
```

**Configuration example** (shows debug logs from `instruction.cpp` only):

```ini
[Rules]
*.debug=false
machine.Instruction.debug=true
```

================================================
FILE: docs/developer/debuging/sanitizers.md
================================================
# Runtime sanitizers

## Using sanitizers in this project

All debug builds are by default built with address and undefined runtime
sanitizers. To disable them (which is strongly discouraged) run cmake with
options none.

```shell
cmake -DSANITIZERS=none
```

To run other selection of sanitiser use, pass colon separated list to the
command.

```shell
cmake -DSANITIZERS=memory,undefined
```

NOTE: Some sanitizer cannot be used together, like address and memory.

### Sanitizer debug info and Clang

If you are using sanitizers with clang and you don't files and line numbers,
make sure that `llvm-symbolizer` is installed and if that does not help, add
env `ASAN_SYMBOLIZER_PATH=` with path to your symbolizer executable. Most of the
time, having it in `PATH` should be enough. 



================================================
FILE: docs/developer/need-to-know.md
================================================
# Need To Know

**Critical information for every developer.**

## Modal Windows, Dialogues, Message Boxes

In typical, native, Qt setting, modal windows allocated on stack and block upon opening. To manage the modal window, Qt
spins up a second event loop. However, that is not technically possible in Web-Assembly environment. *(This might be
solved in new Qt with “asyncify” build flag, but it does not work with currently used Qt 5.15.2)*

[Read more](http://qtandeverything.blogspot.com/2019/05/exec-on-qt-webassembly.html)

### Broken API usage

```cpp
QMessageBox msg;
msg.exec();
```

```cpp
QMessageBox::critical("Hello");
```

The `.exec()` method and single line call are typical warning signs.

Some parts of code employ special code for Web-Assembly (like HTML file selector) and the native part may use blocking
solution. However, in performance non-critical parts (which most dialogs are), unified asynchronous solution is
preferred.

### Solution

The modal window object has to be allocated dynamically and started using asynchronous method `open`. Answer has to be
obtained via `connect` callback.

For ease of use, wrapper functions are prepared in `gui/helper/async_modal.h`.

Free can be accomplished using special call `msg->setAttribute(Qt::WA_DeleteOnClose)` before opening. This method is
automatically employed in `async_modal.h`.

Docs: [WA_DeleteOnClose](https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum)
, [QCloseEvent](https://doc.qt.io/qt-5/qcloseevent.html)

================================================
FILE: docs/user/SUMMARY.md
================================================
# Summary

[Introduction](introduction.md)

# The basics

- [Getting Started](basics/getting_started.md)
- [First Launch](basics/first_launch.md)
- [Basics of the User Interface](basics/basics_of_user_interface.md)
  - [Menus and the Toolbar](basics/menus_and_the_toolbar.md)
- [Writing Programs](basics/writing_programs.md)

# Reference

- [External Toolchains](reference/external_toolchains.md)
- [Advanced Configuration](reference/advanced_configuration.md)
  - [Environment Variables](reference/advanced_configuration/environment_variables.md)


================================================
FILE: docs/user/basics/basics_of_user_interface.md
================================================
# User Interface Overview

After selecting a configuration preset (or loading an example) in the initial dialog, the main **QtRvSim window** appears.
This chapter introduces the primary functional areas of the interface necessary for basic operation.
![QtRvSim main window (empty workspace)](media/gui_elements/user_interface.webp)
The interface can be divided into five main areas:
![The QtRvSim interface, divided into main sections](media/gui_elements/user_interface_annotated.webp)

## 1. Menu Bar & Toolbar (Blue Area)

- Located at the **top of the window**.
- The **Menu Bar** provides full access to all commands (`File`, `Machine`, `Windows`, etc.).
- The **Toolbar** below offers quick access to the most commonly used commands via icons.

**Key Toolbar Buttons (basic simulation):**
- <img src="../media/icons/compfile-256.png" style="vertical-align: middle; width: 20px; height: 20px"> **Compile Source** – Assemble your code.
- <img src="../media/icons/play.png" style="vertical-align: middle; width: 20px; height: 20px"> **Run** – Execute the program continuously.
- <img src="../media/icons/next.png" style="vertical-align: middle; width: 20px; height: 20px"> **Step** – Advance execution one instruction (or one cycle) at a time.
- <img src="../media/icons/reload.png" style="vertical-align: middle; width: 20px; height: 20px"> **Reset** – Reset the simulation state to the beginning.

## 2. Program Panel (Green Area)

- Toggles via **`Windows -> Program`** or **Ctrl+P**.
- Displays the **sequence of assembly instructions** for the currently loaded program.
- During execution, the **currently processed instruction** is highlighted (blue).
- A dropdown menu allows you to follow a particular **pipeline stage** (fetch, decode, execute, etc.):
  - Default: **Follow Fetch** – ideal to get started.

This panel makes it easy to trace the flow of instructions and observe where execution currently is.

## 3. Datapath Visualization / Core View (Red Area)

- The central and most distinctive panel of QtRvSim.
- Visually represents the processor’s **datapath** based on the selected configuration (single-cycle/pipelined).
- Shows how instructions flow through components such as the **registers, ALU and memory**.

This view makes abstract computer architecture concepts concrete by showing the processor "at work."

## 4. Simulation Counters (Purple Area)

- Located in the **top-right corner** of the window.
- Displays important **statistics** about the simulation:
  - **Cycles** – Total number of clock cycles since the last reset.
  - **Stalls** – Number of pipeline stalls encountered (in pipelined configurations).

Values update continuously during execution (`Run`) or after each `Step`.
Counters reset when you **Reset** or **Reload** the simulation.

## 5. Additional Information Windows

QtRvSim offers several **dockable panels** to inspect system state in detail.
These can be opened from the **`Windows`** menu:

![QtRvSim with the windows menu open](media/gui_elements/windows_menu.webp)

You can rearrange, dock, tab, or float these windows to customize your workspace. Use **`Windows -> Reset Windows`** to restore the default layout.

**Essential Panels for Beginners:**
- **Registers** (`Windows -> Registers` or **Ctrl+D**) – Displays general-purpose registers **x0–x31** and the Program Counter.
- **Memory** (`Windows -> Memory` or **Ctrl+M**) – Displays the contents of simulated memory.
- **Terminal** (`Windows -> Terminal`) – For text I/O when programs interact with the console.

## Next Steps

In the following chapter, we will look more closely at the available menus and toolbar options.
*(If you are just starting out, you may skip ahead to chapter _____ and return later as needed.)*


================================================
FILE: docs/user/basics/first_launch.md
================================================
# First Launch

When you start QtRvSim, or when you select **`File > New Simulation`**, the **Pre-sets and ELF File** dialog will appear.
This dialog allows you to select a hardware configuration (pre-set) and, optionally, load a program to run.

![QtRvSim launch window](media/gui_elements/launch_window.webp)

## Dialog Options

- **Config Pages (Left Pane)**
  Displays the different categories of hardware settings (ISA, caches, etc.).
  For now, focus on the **Pre-sets and ELF File** page.
  The other pages will be covered in later chapters.

- **Pre-set (Radio Buttons)**
  Choose a predefined hardware configuration:
  - **No pipeline, no cache**: Simplest single-cycle processor model without cache memory. Ideal for learning basic instruction behavior.
  - **No pipeline, with cache**: Single-cycle processor with cache enabled.
  - **Pipelined, no hazard unit, no cache**: Classic 5-stage pipeline without automatic hazard handling. Useful to demonstrate data/control hazards. No cache.
  - **Pipelined, hazard unit, with cache**: More realistic 5-stage pipeline with hazard detection/forwarding enabled, plus caches.
  - **Custom**: Advanced mode – configure settings manually through the other Config pages.

- **Reset at compile time (reload after make)**
  If enabled, the simulator automatically reapplies the selected configuration each time you assemble a program.
  *Recommended: Keep this option checked.*

- **ELF Executable**
  Use the **Browse** button to load a precompiled RISC-V ELF program (`.elf`).
  *Tip: For most workflows, you’ll write and assemble assembly (`.s`) code directly in the editor instead.*

- **Action Buttons**
  - **Example**: Loads a default example assembly program into the editor with the selected pre-set. *This is the easiest way to get started.*
  - **Start empty**: Opens the simulator with the selected pre-set and an empty editor, ready for you to write or load code.
  - **Load machine**: Applies the selected pre-set and loads the chosen ELF executable.
  - **Cancel**: Closes the dialog without applying changes.

---

For your first run, we recommend selecting either:
- **`No pipeline, no cache`** (simplest model), or
- **`Pipelined with hazard unit and cache`** (closer to a realistic processor).

Then click **`Example`** (to load a sample program) or **`Start empty`** (to write your own).

For this manual, we’ll begin with **`Start empty`** and the **`No pipeline, no cache`** configuration.


================================================
FILE: docs/user/basics/getting_started.md
================================================
# Getting started

## System Requirements

QtRvSim is built using the Qt framework and supports multiple platforms. Please ensure your system meets the following minimum requirements before installation.

### Supported Operating Systems

- **Linux** (64-bit distributions with Qt 5.12+)
- **macOS** (10.10 (Yosemite) or later)
- **Windows** (Windows 7 or later)
- **WebAssembly (Browser-based)**
  - Modern versions of Firefox, Chromium-based browsers or Safari

## Installation

Download the appropriate installation files from the official QtRvSim releases page: <https://github.com/cvut/qtrvsim/releases>

### WebAssembly

Just open [comparch.edu.cvut.cz/qtrvsim/app](https://comparch.edu.cvut.cz/qtrvsim/app) in your web browser to run QtRvSim without any installation.


### Linux Installation

Choose the installation method that best suits your distribution:

[![Packaging status](https://repology.org/badge/vertical-allrepos/qtrvsim.svg)](https://repology.org/project/qtrvsim/versions)

#### Ubuntu 18.04+ and Derivatives

```bash
sudo add-apt-repository ppa:qtrvsimteam/ppa
sudo apt-get update
sudo apt-get install qtrvsim
```

#### Arch, CentOS, Debian, Fedora, openSUSE, Raspbian/Raspberry Pi OS

1. Visit the [Open Build Service download page](https://software.opensuse.org/download.html?project=home%3Ajdupak&package=qtrvsim)
2. Select your specific distribution and version
3. Follow the provided instructions to add the repository and install it

#### Arch Linux (AUR)

You can install QtRvSim from the Arch User Repository (AUR) using an AUR helper like `yay`:

```bash
yay -S qtrvsim
# or
yay -S qtrvsim-git  # for the latest development version
```


#### Flatpak (Universal Package)
```bash
flatpak install flathub cz.cvut.edu.comparch.qtrvsim
```
Launch with:
```bash
flatpak run cz.cvut.edu.comparch.qtrvsim
```

#### NixOS/Nix

Install the package directly from the official `nixpkgs` [repository](https://search.nixos.org/packages?channel=unstable&show=qtrvsim&query=qtrvsim).

<details>
<summary><strong>Permanent installation</strong></summary>

Add `qtrvsim` to your `configuration.nix` file:

```nix
environment.systemPackages = [
    pkgs.qtrvsim
];
```

</details>

<details>
<summary><strong>Temporary usage</strong></summary>

```bash
nix-shell -p qtrvsim --run qtrvsim_gui
```

</details>

### Windows Installation

1. Download the Windows archive: `qtrvsim-mingw32-[version].zip`
2. Extract the contents to your preferred location (e.g., `C:\QtRvSim`)
3. Launch `qtrvsim.exe` from the extracted folder
4. No additional installation steps required

### macOS Installation

#### Method 1: Disk Image (Recommended)
1. Download the macOS disk image: `qtrvsim-macos-[version].dmg`
2. Open the .dmg file
3. Drag the QtRvSim application to your Applications folder
4. **First launch**: Right-click the application in Applications, select "Open," and confirm if prompted by Gatekeeper

#### Method 2: Archive File
1. Download the macOS archive: `qtrvsim-macos-[version].zip`
2. Extract the QtRvSim.app bundle
3. Move QtRvSim.app to your Applications folder
4. Follow step 4 from Method 1 for first launch


================================================
FILE: docs/user/basics/menus_and_the_toolbar.md
================================================
### Menu Bar

The menu bar provides access to all features of QtRvSim. It is divided into standard menus: **File**, **Machine**, **Windows**, **Options**, and **Help**.

---

#### File Menu
Handles operations related to simulation setup, source files, and the application itself.

- <img src="../media/icons/document-import.png" style="vertical-align: middle; width: 20px; height: 20px"> **New simulation...** (Ctrl+N)
  Opens the *Pre-sets and ELF File* configuration dialog to start a new simulation.
- <img src="../media/icons/reload.png" style="vertical-align: middle; width: 20px; height: 20px"> **Reload simulation** (Ctrl+Shift+R)
  Reassembles the source code currently in the editor and resets the simulation state (registers, memory, cycle count).
- **Print** (Ctrl+Alt+P)
  Prints the contents of the active panel or editor.
- <img src="../media/icons/new.png" style="vertical-align: middle; width: 20px; height: 20px"> **New source** (Ctrl+F)
  Opens a new editor tab to write a fresh assembly program.
- <img src="../media/icons/open.png" style="vertical-align: middle; width: 20px; height: 20px"> **Open source** (Ctrl+O)
  Loads an existing RISC-V assembly source file (`.s`) into the editor.
- <img src="../media/icons/save.png" style="vertical-align: middle; width: 20px; height: 20px"> **Save source** (Ctrl+S)
  Saves the current editor contents. If previously unsaved, behaves like "Save source as."
- **Save source as**
  Prompts for a filename and saves the editor contents to that path.
- <img src="../media/icons/closetab.png" style="vertical-align: middle; width: 20px; height: 20px"> **Close source** (Ctrl+W)
  Closes the current editor tab (prompts to save unsaved work).
- **Examples**
  Opens a submenu of example RISC-V programs bundled with QtRvSim. Selecting one loads it into the editor.
- <img src="../media/icons/application-exit.png" style="vertical-align: middle; width: 20px; height: 20px"> **Exit** (Ctrl+Q)
  Exits the QtRvSim application.

---

#### Machine Menu
Controls simulation execution and machine-specific options.

- <img src="../media/icons/play.png" style="vertical-align: middle; width: 20px; height: 20px"> **Run** (Ctrl+R)
  Starts continuous execution at the configured speed.
- <img src="../media/icons/pause.png" style="vertical-align: middle; width: 20px; height: 20px"> **Pause** (Ctrl+P)
  Halts execution if running.
- <img src="../media/icons/next.png" style="vertical-align: middle; width: 20px; height: 20px"> **Step** (Ctrl+T)
  Executes only one instruction.
- **Speed Controls**
  Set the execution rate when using **Run**:
  - 1 instruction/s (Ctrl+1)
  - 2 instructions/s (Ctrl+2)
  - 5 instructions/s (Ctrl+5)
  - 10 instructions/s (Ctrl+0)
  - 25 instructions/s (Ctrl+F5)
  - Unlimited (Ctrl+U) – fastest possible speed
  - Max (Ctrl+A) – fastest speed, with reduced GUI updates (higher performance)
- **Restart**
  Resets registers, memory, peripherals, and counters to state after the last assembly.
- **Mnemonics Registers** (checkbox)
  Toggle register view to show mnemonic names (`ra`, `sp`) instead of raw (`x1`, `x2`).
- **Show Symbol**
  ? to be added ?
- <img src="../media/icons/compfile-256.png" style="vertical-align: middle; width: 20px; height: 20px"> **Compile Source** (Ctrl+E)
  Assembles source code in the editor using the built-in assembler.
- <img src="../media/icons/build-256.png" style="vertical-align: middle; width: 20px; height: 20px"> **Build Executable** (Ctrl+B)
  Builds a standalone ELF file using an external RISC-V toolchain (e.g., GCC/Clang).

#### Windows Menu
Manages visibility of all simulation panels.

- **Registers** (Ctrl+D) – Register state viewer.
![alt text](media/gui_elements/registers.webp)
- **Program** (Ctrl+P) – Code view with current instruction highlighting.
![alt text](media/gui_elements/program.webp)
- **Memory** (Ctrl+M) – Memory contents.
![alt text](media/gui_elements/memory.webp)
- **Program Cache** (Ctrl+Shift+P) – Instruction cache visualization (if enabled).
![alt text](media/gui_elements/program_cache.webp)
- **Data Cache** (Ctrl+Shift+M) – Data cache visualization (if enabled).
![alt text](media/gui_elements/data_cache.webp)
- **L2 Cache** – Second-level cache view (if enabled).
![alt text](media/gui_elements/l2_cache.webp)
- **Branch Predictor** – Displays prediction tables and data (if configured).
![alt text](media/gui_elements/branch_predictor.webp)
- **Peripherals** – Container for simulated I/O devices.
![alt text](media/gui_elements/peripherals.webp)
- **Terminal** – Simulated serial terminal.
![alt text](media/gui_elements/terminal.webp)
- **LCD Display** – Simulated LCD.
![alt text](media/gui_elements/lcd_display.webp)
- **Control and Status Registers (CSR)** (Ctrl+I) – CSR panel.
![alt text](media/gui_elements/control_and_status_registers.webp)
- **Core View** – Datapath visualization (CPU core).
![alt text](media/gui_elements/core.webp)
- **Messages** – Log and feedback panel.
![alt text](media/gui_elements/messages.webp)
- **Reset Windows** – Restores all panels to their default positions.

---

#### Options Menu
- **Show Line Numbers** (checkbox) – Toggle line numbers in the code editor.

---

#### Help Menu
Provides information about QtRvSim, version details, and licensing.

---

### Toolbar
![Toolbar screenshot](media/gui_elements/toolbar.webp)

The toolbar provides quick access to frequently used actions:

- <img src="../media/icons/document-import.png" style="vertical-align: middle; width: 20px; height: 20px"> **New Simulation** – Equivalent to *File → New simulation...* (Ctrl+N).
- <img src="../media/icons/reload.png" style="vertical-align: middle; width: 20px; height: 20px"> **Reload** – Resets simulator state (equivalent to *Machine → Restart*).
- <img src="../media/icons/play.png" style="vertical-align: middle; width: 20px; height: 20px"> **Run** – Start program execution (Ctrl+R).
- <img src="../media/icons/pause.png" style="vertical-align: middle; width: 20px; height: 20px"> **Pause** – Pause execution (Ctrl+P).
- <img src="../media/icons/next.png" style="vertical-align: middle; width: 20px; height: 20px"> **Step** – Execute one instruction (Ctrl+T).
- **Speed Controls** – Select execution speed (same as *Machine → Speed Controls*).
- <img src="../media/icons/new.png" style="vertical-align: middle; width: 20px; height: 20px"> **New Source** – Open a new editor tab (Ctrl+F).
- <img src="../media/icons/open.png" style="vertical-align: middle; width: 20px; height: 20px"> **Open Source** – Load an existing `.s` or `.elf` file (Ctrl+O).
- <img src="../media/icons/save.png" style="vertical-align: middle; width: 20px; height: 20px"> **Save Source** – Save current file (Ctrl+S).
- <img src="../media/icons/closetab.png" style="vertical-align: middle; width: 20px; height: 20px"> **Close Source** – Close active code editor tab (Ctrl+W).
- <img src="../media/icons/compfile-256.png" style="vertical-align: middle; width: 20px; height: 20px"> **Compile Source** – Assemble current RISC-V program with the built-in assembler (Ctrl+E).
- <img src="../media/icons/build-256.png" style="vertical-align: middle; width: 20px; height: 20px"> **Build Executable** – Build ELF with external RISC-V toolchain (Ctrl+B).


================================================
FILE: docs/user/basics/writing_programs.md
================================================
# Writing Programs

This chapter covers how to write and run RISC-V assembly programs in QtRvSim.

## Using the Built-in Assembler

QtRvSim includes a built-in assembler that can compile RISC-V assembly code directly within the application:

1. Write your assembly code in the editor
2. Click **Compile Source** (<kbd>Ctrl+E</kbd>) to assemble the code
3. The program is loaded into simulated memory and ready to execute

This is the recommended workflow for learning and experimenting with RISC-V assembly.

## RISC-V Register Reference

RISC-V has 32 general-purpose registers. The simulator supports both numeric names (`x0`–`x31`) and ABI mnemonic names:

| Register | ABI Name | Description |
|----------|----------|-------------|
| x0 | zero | Hard-wired zero |
| x1 | ra | Return address |
| x2 | sp | Stack pointer |
| x3 | gp | Global pointer |
| x4 | tp | Thread pointer |
| x5–x7 | t0–t2 | Temporary registers |
| x8 | s0/fp | Saved register / Frame pointer |
| x9 | s1 | Saved register |
| x10–x11 | a0–a1 | Function arguments / Return values |
| x12–x17 | a2–a7 | Function arguments |
| x18–x27 | s2–s11 | Saved registers |
| x28–x31 | t3–t6 | Temporary registers |

Toggle between numeric and mnemonic names via **Machine → Mnemonic Registers**.

## Simple Assembly Program Template

Here is a minimal RISC-V assembly template for use with the built-in assembler:

```asm
.globl _start
.text

_start:
    # Your code here
    
    # Example: Load immediate values
    li a0, 42          # Load 42 into a0
    li a1, 10          # Load 10 into a1
    add a2, a0, a1     # a2 = a0 + a1

end:
    ebreak             # Stop execution
    j end              # Loop forever if continued
```

The `ebreak` instruction triggers a breakpoint exception, which causes the simulator to pause execution.

## Breakpoints and Debugging

### Software Breakpoints

The `ebreak` instruction causes the simulator to pause execution. This is useful for stopping at specific points in your program:

```asm
    # ... some code ...
    ebreak           # Pause here
    # ... more code ...
```

When `ebreak` is encountered, the simulator stops. You can then inspect registers and memory, and continue execution with **Step** or **Run**.

### Hardware Breakpoints

You can also set breakpoints directly in the QtRvSim interface:
1. In the **Program** panel, click on the address or instruction where you want to break
2. The simulator will pause when that instruction is fetched

## Loading Programs

There are several ways to load programs into QtRvSim:

1. **Built-in editor**: Write assembly in the editor and compile with <kbd>Ctrl+E</kbd>
2. **Open source file**: Use **File → Open Source** to load a `.s` file, then compile
3. **Load ELF**: In the launch dialog, use **Browse** to select a precompiled `.elf` file
4. **Build Executable**: Use **Machine → Build Executable** (<kbd>Ctrl+B</kbd>) to compile using an external toolchain

## Next Steps

Once you're comfortable writing basic assembly programs, you may want to explore:
- Using an [external RISC-V toolchain](external_toolchains.md) for compiling C programs or more complex projects

================================================
FILE: docs/user/book.toml
================================================
[book]
title = "QtRVSim User Manual"
authors = ["Filip Kraus"]
language = "en"
src = "."


================================================
FILE: docs/user/introduction.md
================================================
# Introduction

Welcome to the **QtRvSim User Manual**.

QtRvSim is a graphical simulator designed to support learning the fundamentals of computer architecture using the **RISC-V instruction set**. It provides an interactive environment for writing, assembling, and simulating simple RISC-V assembly programs. By visualizing instruction execution on different processor models, QtRvSim helps make abstract computer architecture concepts clear and tangible.

The project is developed by the [Computer Architectures Education](http://comparch.edu.cvut.cz) project at [Czech Technical University](http://www.cvut.cz/) and souce code is available on [GitHub](https://github.com/cvut/qtrvsim).

## Key Features

- **Visual Datapaths** – Observe execution on both single-cycle and 5-stage pipelined processor models.
- **Integrated Tools** – Write code with the built-in text editor and assemble directly within the simulator.
- **State Inspection** – Inspect register contents, memory, and cache status in real time.
- **Peripheral Emulation** – Experiment with simulated devices, including a terminal, LCD, and LEDs/buttons.
- **Cross-Platform Support** – Available on Linux, Windows, macOS, and via WebAssembly (browser-based).

## About This Manual

This manual will guide you through:
- Installing QtRvSim on your preferred platform
- Understanding the user interface
- ...

Whether you are a student learning the basics of computer architecture or an instructor looking for an accessible teaching tool, QtRvSim provides an intuitive and hands-on way to experiment with RISC-V systems.


================================================
FILE: docs/user/reference/advanced_configuration/environment_variables.md
================================================
# Environment Variables

QtRvSim supports several environment variables to customize its behavior. These are primarily useful for advanced users, portable deployments, and development purposes.

---

## GUI Configuration

### Portable Application Mode

By default, QtRvSim GUI stores application state (window positions, last selected configuration, etc.) using the system's standard configuration location. To make the simulator fully portable (e.g., running from a USB drive), you can specify a custom configuration file path.

**`QTRVSIM_CONFIG_FILE`**

Set this variable to the path of a `.ini` file where QtRvSim should store its GUI state.

**Example (Linux/macOS):**
```bash
export QTRVSIM_CONFIG_FILE=/path/to/portable/qtrvsim_config.ini
./qtrvsim_gui
```

**Example (Windows):**
```cmd
set QTRVSIM_CONFIG_FILE=D:\QtRvSim\config.ini
qtrvsim_gui.exe
```

---

### Scale GUi Fonts for Classroom Projector

The fonts can be to small for students to see them from the more distant places or projector resolution can be interpolated or scaled that text in editors and menus is hard to read. The next option allows to scale fonts for the whole application.

```bash
QT_SCALE_FACTOR=1.4 ./qtrvsim_gui
```

---

## Logging

Logging environment variables are primarily intended for development and debugging purposes. For detailed information about available logging options, please refer to the developer documentation.


================================================
FILE: docs/user/reference/advanced_configuration.md
================================================
# Advanced Configuration

This section covers advanced configuration options for QtRvSim, including environment variables and other settings for power users.

- [Environment Variables](advanced_configuration/environment_variables.md) – Customize simulator behavior through environment variables, including portable application mode.


================================================
FILE: docs/user/reference/external_toolchains.md
================================================
# External Toolchains

For more complex programs or C code, you can use an external RISC-V cross-compiler toolchain instead of the built-in assembler.

## Installing the Toolchain

**Ubuntu/Debian:**
```bash
sudo apt install gcc-riscv64-unknown-elf
```

**Fedora:**
```bash
sudo dnf install riscv64-elf-gcc
```

**Arch Linux:**
```bash
sudo pacman -S riscv64-elf-gcc
```

**macOS (Homebrew):**
```bash
brew install riscv64-elf-gcc
```

## Compiling Assembly Programs

To compile a simple assembly program:

```bash
riscv64-unknown-elf-gcc -march=rv32i -mabi=ilp32 -nostdlib -nostartfiles -o program.elf program.s
```

Or for RV64:
```bash
riscv64-unknown-elf-gcc -march=rv64i -mabi=lp64 -nostdlib -nostartfiles -o program.elf program.s
```

The above choice is for basic RISC-V integer ISA with 32 registers.

QtRvSim supports even following extensions:

- M (`-march=rv32im`/`-march=rv64im`) - hardware multiply and divide instructions
- A (with M `-march=rv32ima`/`-march=rv64ima`) - atomic operations
- Zicsr (with A and M `-march=rv32ima_zicsr`/`-march=rv64ima_zicsr`) support for control registers

The A, M and XLEN should match setting in the `Core ISA and Hazards` setup dialog tab.

## Compiling C Programs

For C programs, you need a minimal startup file and appropriate compiler flags.

**Startup code (`crt0.s`):**
```asm
/* minimal replacement of crt0.o which is else provided by C library */

.globl main
.globl _start
.globl _heap_stack_start
.globl _heap_stack_end

.text

_start:
        .option push
        .option norelax
        /* set a global pointer to allow access to C global variables */
        la gp, __global_pointer$
        /* it has to be done without "relax", because else it is
         * optimized to a gp register relative operation by linker
         */
        .option pop
        la      sp, _heap_stack_end
        addi    a0, zero, 0
        addi    a1, zero, 0
        jal     main
_exit:
        addi    a0, zero, 0
        addi    a7, zero, 93  /* SYS_exit */
        ecall
        /* catch case when syscalls are disabled */
        ebreak
        j       _exit

.bss

.align 4

/* the area which can be used for a heap from the bootom
 * and stack from the top
 */
_heap_stack_start:
        .skip   16384
_heap_stack_end:

.end
```

**Example C program (`hello.c`):**
```c
#define SERIAL_PORT_BASE   0xffffc000
#define SERP_TX_ST_REG     (*(volatile unsigned *)(SERIAL_PORT_BASE + 0x00))
#define SERP_TX_DATA_REG   (*(volatile unsigned *)(SERIAL_PORT_BASE + 0x04))

void print_char(char c) {
    while (SERP_TX_ST_REG & 0x1);  // Wait while busy
    SERP_TX_DATA_REG = c;
}

void print_string(const char *s) {
    while (*s) {
        print_char(*s++);
    }
}

int main(void) {
    print_string("Hello from QtRvSim!\n");
    return 0;
}
```

**Compilation:**
```bash
riscv64-unknown-elf-gcc -march=rv32i -mabi=ilp32 -c crt0.s -o crt0.o
riscv64-unknown-elf-gcc -march=rv32i -mabi=ilp32 -O2 -c hello.c -o hello.o
riscv64-unknown-elf-gcc -march=rv32i -mabi=ilp32 -nostdlib -static -T linker.ld crt0.o hello.o -o hello.elf
```

## Linker Script

A simple linker script (`linker.ld`) for QtRvSim:

```ld
ENTRY(_start)

MEMORY {
    RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 64K
}

SECTIONS {
    .text : {
        *(.text)
        *(.text.*)
    } > RAM

    .rodata : {
        *(.rodata)
        *(.rodata.*)
    } > RAM

    .data : {
        *(.data)
        *(.data.*)
    } > RAM

    .bss : {
        *(.bss)
        *(.bss.*)
        *(COMMON)
    } > RAM
}
```

## Using Make for Build Automation

For larger projects, a `Makefile` automates the build process:

```makefile
CROSS = riscv64-unknown-elf-
CC = $(CROSS)gcc
AS = $(CROSS)as
LD = $(CROSS)ld
OBJCOPY = $(CROSS)objcopy
OBJDUMP = $(CROSS)objdump

ARCH_FLAGS = -march=rv32i -mabi=ilp32
CFLAGS = $(ARCH_FLAGS) -O2 -Wall -nostdlib -ffreestanding
LDFLAGS = $(ARCH_FLAGS) -nostdlib -static -T linker.ld

SOURCES = crt0.s main.c
TARGET = program.elf

OBJECTS = $(SOURCES:.s=.o)
OBJECTS := $(OBJECTS:.c=.o)

all: $(TARGET)

%.o: %.s
	$(CC) $(ARCH_FLAGS) -c $< -o $@

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

$(TARGET): $(OBJECTS)
	$(CC) $(LDFLAGS) $^ -o $@

disasm: $(TARGET)
	$(OBJDUMP) -d $(TARGET)

clean:
	rm -f $(OBJECTS) $(TARGET)

.PHONY: all clean disasm
```

## Loading ELF Files

To load a compiled ELF file into QtRvSim:

1. In the launch dialog, use **Browse** to select the `.elf` file, then click **Load machine**
2. Or use **Machine → Build Executable** (<kbd>Ctrl+B</kbd>) to compile and load using an external toolchain directly from the editor

================================================
FILE: external/compiler/compile.sh
================================================
#!/usr/bin/env bash
# This script compiles compilation tools for mips to be used with qtmips
set -e

INST_PREFIX="$(pwd)"

INST_CT_PREFIX="$INST_PREFIX/ct-ng"
mkdir -p "$INST_CT_PREFIX"

# First update git submodule
pushd "$(dirname "$0")" >/dev/null
git submodule update crosstool-ng

pushd crosstool-ng >/dev/null

# Now compile it
# TODO don't compile it in place?
./bootstrap
./configure --prefix="$INST_CT_PREFIX"
make
make install
# TODO do cleanups?

popd >/dev/null

popd >/dev/null

# Copy configuration
cp "$(dirname "$0")/config" ct-ng/.config

pushd ct-ng >/dev/null

# And compile
./bin/ct-ng oldconfig
CT_PREFIX="$INST_PREFIX" ./bin/ct-ng build

popd >/dev/null

# Cleanup installed crosstool-ng
rm -rf ct-ng


================================================
FILE: external/compiler/config
================================================
#
# Automatically generated file; DO NOT EDIT.
# Crosstool-NG Configuration
#
CT_CONFIGURE_has_static_link=y
CT_CONFIGURE_has_wget=y
CT_CONFIGURE_has_curl=y
CT_CONFIGURE_has_stat_flavor_GNU=y
CT_CONFIGURE_has_make_3_81_or_newer=y
CT_CONFIGURE_has_libtool_2_4_or_newer=y
CT_CONFIGURE_has_libtoolize_2_4_or_newer=y
CT_CONFIGURE_has_autoconf_2_63_or_newer=y
CT_CONFIGURE_has_autoreconf_2_63_or_newer=y
CT_CONFIGURE_has_automake_1_15_or_newer=y
CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y
CT_CONFIGURE_has_svn=y
CT_CONFIGURE_has_git=y
CT_MODULES=y

#
# Paths and misc options
#

#
# crosstool-NG behavior
#
# CT_OBSOLETE is not set
# CT_EXPERIMENTAL is not set
# CT_DEBUG_CT is not set

#
# Paths
#
CT_LOCAL_TARBALLS_DIR="${HOME}/src"
CT_SAVE_TARBALLS=y
CT_WORK_DIR="${CT_TOP_DIR}/.build"
CT_BUILD_TOP_DIR="${CT_WORK_DIR}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"
CT_PREFIX_DIR="${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"
CT_RM_RF_PREFIX_DIR=y
CT_REMOVE_DOCS=y
CT_PREFIX_DIR_RO=y
CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y
# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set

#
# Downloading
#
CT_DOWNLOAD_AGENT_WGET=y
# CT_DOWNLOAD_AGENT_CURL is not set
# CT_DOWNLOAD_AGENT_NONE is not set
# CT_FORBID_DOWNLOAD is not set
# CT_FORCE_DOWNLOAD is not set
CT_CONNECT_TIMEOUT=10
CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary"
# CT_ONLY_DOWNLOAD is not set
# CT_USE_MIRROR is not set

#
# Extracting
#
# CT_FORCE_EXTRACT is not set
CT_OVERRIDE_CONFIG_GUESS_SUB=y
# CT_ONLY_EXTRACT is not set
CT_PATCH_BUNDLED=y
# CT_PATCH_LOCAL is not set
# CT_PATCH_BUNDLED_LOCAL is not set
# CT_PATCH_LOCAL_BUNDLED is not set
# CT_PATCH_BUNDLED_FALLBACK_LOCAL is not set
# CT_PATCH_LOCAL_FALLBACK_BUNDLED is not set
# CT_PATCH_NONE is not set
CT_PATCH_ORDER="bundled"

#
# Build behavior
#
CT_PARALLEL_JOBS=0
CT_LOAD=""
CT_USE_PIPES=y
CT_EXTRA_CFLAGS_FOR_BUILD=""
CT_EXTRA_LDFLAGS_FOR_BUILD=""
CT_EXTRA_CFLAGS_FOR_HOST=""
CT_EXTRA_LDFLAGS_FOR_HOST=""
# CT_CONFIG_SHELL_SH is not set
# CT_CONFIG_SHELL_ASH is not set
CT_CONFIG_SHELL_BASH=y
# CT_CONFIG_SHELL_CUSTOM is not set
CT_CONFIG_SHELL="${bash}"

#
# Logging
#
# CT_LOG_ERROR is not set
# CT_LOG_WARN is not set
# CT_LOG_INFO is not set
CT_LOG_EXTRA=y
# CT_LOG_ALL is not set
# CT_LOG_DEBUG is not set
CT_LOG_LEVEL_MAX="EXTRA"
# CT_LOG_SEE_TOOLS_WARN is not set
CT_LOG_PROGRESS_BAR=y
CT_LOG_TO_FILE=y
CT_LOG_FILE_COMPRESS=y

#
# Target options
#
CT_ARCH="mips"
# CT_ARCH_alpha is not set
# CT_ARCH_arm is not set
# CT_ARCH_avr is not set
# CT_ARCH_m68k is not set
CT_ARCH_mips=y
# CT_ARCH_nios2 is not set
# CT_ARCH_powerpc is not set
# CT_ARCH_s390 is not set
# CT_ARCH_sh is not set
# CT_ARCH_sparc is not set
# CT_ARCH_x86 is not set
# CT_ARCH_xtensa is not set
CT_ARCH_alpha_AVAILABLE=y
CT_ARCH_arm_AVAILABLE=y
CT_ARCH_avr_AVAILABLE=y
CT_ARCH_m68k_AVAILABLE=y
CT_ARCH_microblaze_AVAILABLE=y
CT_ARCH_mips_AVAILABLE=y
CT_ARCH_nios2_AVAILABLE=y
CT_ARCH_powerpc_AVAILABLE=y
CT_ARCH_s390_AVAILABLE=y
CT_ARCH_sh_AVAILABLE=y
CT_ARCH_sparc_AVAILABLE=y
CT_ARCH_x86_AVAILABLE=y
CT_ARCH_xtensa_AVAILABLE=y
CT_ARCH_SUFFIX=""

#
# Generic target options
#
# CT_MULTILIB is not set
CT_DEMULTILIB=y
CT_ARCH_USE_MMU=y
CT_ARCH_SUPPORTS_BOTH_ENDIAN=y
CT_ARCH_DEFAULT_BE=y
CT_ARCH_BE=y
# CT_ARCH_LE is not set
CT_ARCH_ENDIAN="big"
CT_ARCH_SUPPORTS_32=y
CT_ARCH_SUPPORTS_64=y
CT_ARCH_DEFAULT_32=y
CT_ARCH_BITNESS=32
CT_ARCH_32=y
# CT_ARCH_64 is not set

#
# Target optimisations
#
CT_ARCH_SUPPORTS_WITH_ARCH=y
CT_ARCH_SUPPORTS_WITH_TUNE=y
CT_ARCH_SUPPORTS_WITH_FLOAT=y
CT_ARCH_ARCH=""
CT_ARCH_TUNE=""
# CT_ARCH_FLOAT_AUTO is not set
# CT_ARCH_FLOAT_HW is not set
CT_ARCH_FLOAT_SW=y
CT_TARGET_CFLAGS=""
CT_TARGET_LDFLAGS=""
CT_ARCH_FLOAT="soft"

#
# mips other options
#
CT_ARCH_mips_o32=y
CT_ARCH_mips_ABI="32"

#
# Toolchain options
#

#
# General toolchain options
#
CT_WANTS_STATIC_LINK=y
CT_WANTS_STATIC_LINK_CXX=y
CT_STATIC_TOOLCHAIN=y
CT_TOOLCHAIN_PKGVERSION=""
CT_TOOLCHAIN_BUGURL=""

#
# Tuple completion and aliasing
#
CT_TARGET_VENDOR="qtmips"
CT_TARGET_ALIAS_SED_EXPR=""
CT_TARGET_ALIAS=""

#
# Toolchain type
#
CT_CROSS=y
# CT_CANADIAN is not set
CT_TOOLCHAIN_TYPE="cross"

#
# Build system
#
CT_BUILD=""
CT_BUILD_PREFIX=""
CT_BUILD_SUFFIX=""

#
# Misc options
#
# CT_TOOLCHAIN_ENABLE_NLS is not set

#
# Operating System
#
CT_BARE_METAL=y
CT_KERNEL="bare-metal"
CT_KERNEL_bare_metal=y
# CT_KERNEL_linux is not set
CT_KERNEL_bare_metal_AVAILABLE=y
CT_KERNEL_linux_AVAILABLE=y
CT_KERNEL_windows_AVAILABLE=y

#
# Common kernel options
#

#
# Binary utilities
#
CT_ARCH_BINFMT_ELF=y
CT_BINUTILS="binutils"
CT_BINUTILS_binutils=y

#
# GNU binutils
#
CT_BINUTILS_VERSION="2.28"
# CT_BINUTILS_SHOW_LINARO is not set
CT_BINUTILS_V_2_28=y
# CT_BINUTILS_V_2_27 is not set
# CT_BINUTILS_V_2_26 is not set
CT_BINUTILS_2_27_or_later=y
CT_BINUTILS_2_26_or_later=y
CT_BINUTILS_2_25_1_or_later=y
CT_BINUTILS_2_25_or_later=y
CT_BINUTILS_2_24_or_later=y
CT_BINUTILS_2_23_2_or_later=y
CT_BINUTILS_HAS_HASH_STYLE=y
CT_BINUTILS_HAS_GOLD=y
CT_BINUTILS_HAS_PLUGINS=y
CT_BINUTILS_HAS_PKGVERSION_BUGURL=y
CT_BINUTILS_LINKER_LD=y
CT_BINUTILS_LINKERS_LIST="ld"
CT_BINUTILS_LINKER_DEFAULT="bfd"
CT_BINUTILS_EXTRA_CONFIG_ARRAY=""

#
# binutils other options
#

#
# C-library
#
CT_LIBC="newlib"
CT_LIBC_VERSION="2.5.0.20170323"
CT_LIBC_newlib=y
# CT_LIBC_none is not set
CT_LIBC_avr_libc_AVAILABLE=y
CT_LIBC_glibc_AVAILABLE=y
CT_THREADS="none"
CT_LIBC_mingw_AVAILABLE=y
CT_LIBC_musl_AVAILABLE=y
CT_LIBC_newlib_AVAILABLE=y
# CT_CC_NEWLIB_SHOW_LINARO is not set
CT_LIBC_NEWLIB_V_2_5_0=y
# CT_LIBC_NEWLIB_V_2_4_0 is not set
# CT_LIBC_NEWLIB_V_2_3_0 is not set
# CT_LIBC_NEWLIB_V_2_2_0 is not set
# CT_LIBC_NEWLIB_V_2_1_0 is not set
# CT_LIBC_NEWLIB_V_2_0_0 is not set
# CT_LIBC_NEWLIB_V_1_20_0 is not set
# CT_LIBC_NEWLIB_V_1_19_0 is not set
# CT_LIBC_NEWLIB_V_1_18_0 is not set
# CT_LIBC_NEWLIB_V_1_17_0 is not set
CT_LIBC_NEWLIB_2_5=y
CT_LIBC_NEWLIB_2_5_or_later=y
CT_LIBC_NEWLIB_2_4_or_later=y
CT_LIBC_NEWLIB_2_3_or_later=y
CT_LIBC_NEWLIB_2_2_or_later=y
CT_LIBC_NEWLIB_2_1_or_later=y
CT_LIBC_NEWLIB_2_0_or_later=y
CT_LIBC_NEWLIB_TARGET_CFLAGS=""
CT_LIBC_none_AVAILABLE=y
CT_LIBC_uClibc_AVAILABLE=y
CT_LIBC_SUPPORT_THREADS_NONE=y
CT_LIBC_PROVIDES_CXA_ATEXIT=y

#
# Common C library options
#
CT_THREADS_NONE=y

#
# newlib other options
#
# CT_LIBC_NEWLIB_IO_C99FMT is not set
# CT_LIBC_NEWLIB_IO_LL is not set
# CT_LIBC_NEWLIB_IO_FLOAT is not set
# CT_LIBC_NEWLIB_IO_POS_ARGS is not set
CT_LIBC_NEWLIB_FVWRITE_IN_STREAMIO=y
CT_LIBC_NEWLIB_UNBUF_STREAM_OPT=y
CT_LIBC_NEWLIB_FSEEK_OPTIMIZATION=y
# CT_LIBC_NEWLIB_DISABLE_SUPPLIED_SYSCALLS is not set
# CT_LIBC_NEWLIB_REGISTER_FINI is not set
CT_LIBC_NEWLIB_ATEXIT_DYNAMIC_ALLOC=y
# CT_LIBC_NEWLIB_GLOBAL_ATEXIT is not set
# CT_LIBC_NEWLIB_LITE_EXIT is not set
# CT_LIBC_NEWLIB_REENT_SMALL is not set
CT_LIBC_NEWLIB_MULTITHREAD=y
# CT_LIBC_NEWLIB_EXTRA_SECTIONS is not set
CT_LIBC_NEWLIB_WIDE_ORIENT=y
CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE=y
# CT_LIBC_NEWLIB_NANO_MALLOC is not set
# CT_LIBC_NEWLIB_NANO_FORMATTED_IO is not set
CT_LIBC_NEWLIB_EXTRA_CONFIG_ARRAY=""

#
# C compiler
#
CT_CC="gcc"
CT_CC_CORE_PASS_2_NEEDED=y
CT_CC_gcc=y
CT_CC_GCC_VERSION="5.4.0"
# CT_CC_GCC_SHOW_LINARO is not set
# CT_CC_GCC_V_6_3_0 is not set
CT_CC_GCC_V_5_4_0=y
# CT_CC_GCC_V_4_9_4 is not set
CT_CC_GCC_4_8_or_later=y
CT_CC_GCC_4_9_or_later=y
CT_CC_GCC_5=y
CT_CC_GCC_5_or_later=y
CT_CC_GCC_HAS_LIBMPX=y
CT_CC_GCC_ENABLE_CXX_FLAGS=""
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=""
CT_CC_GCC_EXTRA_CONFIG_ARRAY=""
# CT_CC_GCC_TARGET_FINAL is not set
CT_CC_GCC_STATIC_LIBSTDCXX=y
# CT_CC_GCC_SYSTEM_ZLIB is not set
CT_CC_GCC_CONFIG_TLS=m

#
# Optimisation features
#
CT_CC_GCC_USE_GRAPHITE=y

#
# Settings for libraries running on target
#
CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y
# CT_CC_GCC_LIBMUDFLAP is not set
# CT_CC_GCC_LIBSSP is not set
# CT_CC_GCC_LIBQUADMATH is not set

#
# Misc. obscure options.
#
CT_CC_CXA_ATEXIT=y
# CT_CC_GCC_DISABLE_PCH is not set
CT_CC_GCC_LDBL_128=m
# CT_CC_GCC_BUILD_ID is not set
CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y
# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set
# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set
# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set
CT_CC_GCC_LNK_HASH_STYLE=""
CT_CC_GCC_DEC_FLOAT_AUTO=y
# CT_CC_GCC_DEC_FLOAT_BID is not set
# CT_CC_GCC_DEC_FLOAT_DPD is not set
# CT_CC_GCC_DEC_FLOATS_NO is not set
CT_CC_GCC_HAS_ARCH_OPTIONS=y

#
# archictecture-specific options
#
CT_CC_GCC_mips_llsc=m
CT_CC_GCC_mips_synci=m
# CT_CC_GCC_mips_plt is not set
CT_CC_SUPPORT_CXX=y
CT_CC_SUPPORT_FORTRAN=y
CT_CC_SUPPORT_JAVA=y
CT_CC_SUPPORT_ADA=y
CT_CC_SUPPORT_OBJC=y
CT_CC_SUPPORT_OBJCXX=y
CT_CC_SUPPORT_GOLANG=y

#
# Additional supported languages:
#
# CT_CC_LANG_CXX is not set
# CT_CC_LANG_FORTRAN is not set

#
# Debug facilities
#
# CT_DEBUG_gdb is not set
# CT_DEBUG_ltrace is not set
# CT_DEBUG_strace is not set

#
# Companion libraries
#
CT_COMPLIBS_NEEDED=y
CT_GMP_NEEDED=y
CT_MPFR_NEEDED=y
CT_ISL_NEEDED=y
CT_MPC_NEEDED=y
CT_COMPLIBS=y
# CT_LIBICONV is not set
# CT_GETTEXT is not set
CT_GMP=y
CT_MPFR=y
CT_ISL=y
CT_MPC=y
# CT_ZLIB is not set
CT_GMP_V_6_1_2=y
CT_GMP_5_0_2_or_later=y
CT_GMP_VERSION="6.1.2"
CT_MPFR_V_3_1_5=y
CT_MPFR_VERSION="3.1.5"
CT_ISL_V_0_16_1=y
# CT_ISL_V_0_15 is not set
CT_ISL_V_0_16_or_later=y
CT_ISL_V_0_15_or_later=y
CT_ISL_V_0_14_or_later=y
CT_ISL_V_0_12_or_later=y
CT_ISL_VERSION="0.16.1"
CT_MPC_V_1_0_3=y
CT_MPC_VERSION="1.0.3"

#
# Companion libraries common options
#
# CT_COMPLIBS_CHECK is not set

#
# Companion tools
#
# CT_COMP_TOOLS_FOR_HOST is not set
# CT_COMP_TOOLS_autoconf is not set
# CT_COMP_TOOLS_automake is not set
# CT_COMP_TOOLS_libtool is not set
# CT_COMP_TOOLS_m4 is not set
# CT_COMP_TOOLS_make is not set


================================================
FILE: external/svgscene/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.10)
project(svgscene)

set(QT_VERSION_MAJOR "auto" CACHE STRING "Qt major version to use. 5|6|auto")

if (NOT "${QT_VERSION_MAJOR}" MATCHES "5|6|auto")
    message(FATAL_ERROR "Invalid value for QT_VERSION_MAJOR: ${QT_VERSION_MAJOR} (expected 5, 6 or auto)")
endif ()

if ("${QT_VERSION_MAJOR}" STREQUAL "auto")
    find_package(QT NAMES Qt5 Qt6 COMPONENTS Core REQUIRED)
endif ()

# Normally, we would use variable Qt5 or Qt6 to reference the Qt library. Here we do that through
# this variable based on detected version major of Qt.
set(QtLib "Qt${QT_VERSION_MAJOR}")
find_package(${QtLib}
		REQUIRED COMPONENTS Core Widgets Gui)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

add_library(svgscene STATIC
		src/svgscene/components/groupitem.cpp
		src/svgscene/components/groupitem.h
		src/svgscene/components/hyperlinkitem.cpp
		src/svgscene/components/hyperlinkitem.h
		src/svgscene/components/simpletextitem.cpp
		src/svgscene/components/simpletextitem.h
		src/svgscene/graphicsview/svggraphicsview.cpp
		src/svgscene/graphicsview/svggraphicsview.h
		src/svgscene/svgdocument.cpp
		src/svgscene/svgdocument.h
		src/svgscene/svggraphicsscene.cpp
		src/svgscene/svggraphicsscene.h
		src/svgscene/svghandler.cpp
		src/svgscene/svghandler.h
		src/svgscene/svgmetadata.cpp
		src/svgscene/svgmetadata.h
		src/svgscene/svgspec.h
		src/svgscene/polyfills/qt5/qwheelevent.h
		src/svgscene/polyfills/qt5/qstringview.h
		src/svgscene/utils/logging.h
		src/svgscene/utils/memory_ownership.h
		)
target_link_libraries(svgscene
		PRIVATE ${QtLib}::Core ${QtLib}::Gui ${QtLib}::Widgets)
target_include_directories(svgscene PUBLIC src PRIVATE src/svgscene)

add_executable(svgscene-example EXCLUDE_FROM_ALL
		src/example/main.cpp
		src/example/mainwindow.cpp
		src/example/mainwindow.h
		src/example/mainwindow.ui
		)
target_link_libraries(svgscene-example
		PRIVATE ${QtLib}::Core ${QtLib}::Gui ${QtLib}::Widgets svgscene)

================================================
FILE: external/svgscene/LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanentl
Download .txt
gitextract_up_kab8w/

├── .github/
│   └── workflows/
│       ├── debug.yml
│       ├── docs.yml
│       └── release.yml
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── LICENSE
├── Makefile
├── README.md
├── cmake/
│   ├── AddFileHashes.cmake
│   ├── BuildType.cmake
│   ├── BundleMacOS.cmake
│   ├── CopyrightTools.cmake
│   ├── FindElfUtils.cmake
│   ├── FindLibElf.cmake
│   ├── FindPythonInterp.cmake
│   ├── GPL-3.0-or-later.cmake
│   ├── LibElfinSettings.cmake
│   ├── PackageTools.cmake
│   └── TestingTools.cmake
├── data/
│   ├── cz.cvut.edu.comparch.qtrvsim.metainfo.xml.in
│   ├── gui.desktop.in
│   ├── icons/
│   │   └── macos/
│   │       └── gui.icns
│   └── wasm/
│       ├── browserconfig.xml
│       ├── index.html
│       └── manifest.json
├── default.nix
├── docs/
│   ├── developer/
│   │   ├── build&deploy/
│   │   │   ├── building-wasm.md
│   │   │   └── release.md
│   │   ├── coreview-graphics/
│   │   │   └── using-drawio-diagram.md
│   │   ├── debuging/
│   │   │   ├── logging.md
│   │   │   └── sanitizers.md
│   │   └── need-to-know.md
│   └── user/
│       ├── SUMMARY.md
│       ├── basics/
│       │   ├── basics_of_user_interface.md
│       │   ├── first_launch.md
│       │   ├── getting_started.md
│       │   ├── menus_and_the_toolbar.md
│       │   └── writing_programs.md
│       ├── book.toml
│       ├── introduction.md
│       └── reference/
│           ├── advanced_configuration/
│           │   └── environment_variables.md
│           ├── advanced_configuration.md
│           └── external_toolchains.md
├── external/
│   ├── compiler/
│   │   ├── compile.sh
│   │   └── config
│   └── svgscene/
│       ├── CMakeLists.txt
│       ├── LICENSE
│       ├── README.md
│       └── src/
│           ├── example/
│           │   ├── main.cpp
│           │   ├── mainwindow.cpp
│           │   ├── mainwindow.h
│           │   └── mainwindow.ui
│           └── svgscene/
│               ├── components/
│               │   ├── groupitem.cpp
│               │   ├── groupitem.h
│               │   ├── hyperlinkitem.cpp
│               │   ├── hyperlinkitem.h
│               │   ├── simpletextitem.cpp
│               │   └── simpletextitem.h
│               ├── graphicsview/
│               │   ├── svggraphicsview.cpp
│               │   └── svggraphicsview.h
│               ├── polyfills/
│               │   └── qt5/
│               │       ├── qstringview.h
│               │       └── qwheelevent.h
│               ├── svgdocument.cpp
│               ├── svgdocument.h
│               ├── svggraphicsscene.cpp
│               ├── svggraphicsscene.h
│               ├── svghandler.cpp
│               ├── svghandler.h
│               ├── svgmetadata.cpp
│               ├── svgmetadata.h
│               ├── svgspec.h
│               └── utils/
│                   ├── logging.h
│                   └── memory_ownership.h
├── extras/
│   ├── building/
│   │   └── build-wasm.sh
│   ├── core_graphics/
│   │   └── diagram.drawio
│   ├── crosscompiling/
│   │   ├── shell-mips-elf.nix
│   │   ├── shell-riscv-elf-with-newlib.nix
│   │   └── shell-riscv-elf.nix
│   └── packaging/
│       ├── _tools/
│       │   ├── add-to-changelog.sh
│       │   └── git-archive-submodules.sh
│       ├── add-to-changelog.sh
│       ├── appimage/
│       │   └── appimage.yml.in
│       ├── arch/
│       │   └── PKGBUILD.in
│       ├── deb/
│       │   ├── debian/
│       │   │   ├── changelog
│       │   │   ├── compat
│       │   │   ├── control.in
│       │   │   ├── copyright
│       │   │   ├── docs
│       │   │   ├── rules
│       │   │   └── source/
│       │   │       └── format
│       │   └── dsc.in
│       ├── flatpak/
│       │   └── cz.cvut.edu.comparch.qtrvsim.json
│       ├── mingw/
│       │   └── cmake-i686-w64-mingw32.conf
│       ├── nix/
│       │   └── qtrvsim.nix
│       └── rpm/
│           └── spec.in
├── qtlogging.ini
├── src/
│   ├── assembler/
│   │   ├── CMakeLists.txt
│   │   ├── fixmatheval.cpp
│   │   ├── fixmatheval.h
│   │   ├── messagetype.h
│   │   ├── simpleasm.cpp
│   │   └── simpleasm.h
│   ├── cli/
│   │   ├── CMakeLists.txt
│   │   ├── chariohandler.cpp
│   │   ├── chariohandler.h
│   │   ├── main.cpp
│   │   ├── msgreport.cpp
│   │   ├── msgreport.h
│   │   ├── reporter.cpp
│   │   ├── reporter.h
│   │   ├── tracer.cpp
│   │   └── tracer.h
│   ├── common/
│   │   ├── CMakeLists.txt
│   │   ├── containers/
│   │   │   └── cvector.h
│   │   ├── endian.h
│   │   ├── logging.h
│   │   ├── logging_format_colors.h
│   │   ├── math/
│   │   │   └── bit_ops.h
│   │   ├── memory_ownership.h
│   │   ├── polyfills/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── byteswap.h
│   │   │   ├── clz32.h
│   │   │   ├── endian_detection.h
│   │   │   ├── mulh64.h
│   │   │   ├── mulh64.test.cpp
│   │   │   ├── mulh64.test.h
│   │   │   ├── qstring_hash.h
│   │   │   └── qt5/
│   │   │       ├── qfontmetrics.h
│   │   │       ├── qlinef.h
│   │   │       └── qtableview.h
│   │   ├── string_utils.h
│   │   └── type_utils/
│   │       └── lens.h
│   ├── gui/
│   │   ├── CMakeLists.txt
│   │   ├── dialogs/
│   │   │   ├── about/
│   │   │   │   ├── aboutdialog.cpp
│   │   │   │   └── aboutdialog.h
│   │   │   ├── gotosymbol/
│   │   │   │   ├── gotosymboldialog.cpp
│   │   │   │   ├── gotosymboldialog.h
│   │   │   │   └── gotosymboldialog.ui
│   │   │   ├── new/
│   │   │   │   ├── NewDialog.ui
│   │   │   │   ├── NewDialogCache.ui
│   │   │   │   ├── newdialog.cpp
│   │   │   │   └── newdialog.h
│   │   │   └── savechanged/
│   │   │       ├── savechangeddialog.cpp
│   │   │       └── savechangeddialog.h
│   │   ├── extprocess.cpp
│   │   ├── extprocess.h
│   │   ├── fontsize.cpp
│   │   ├── fontsize.h
│   │   ├── graphicsview.cpp
│   │   ├── graphicsview.h
│   │   ├── helper/
│   │   │   └── async_modal.h
│   │   ├── hinttabledelegate.cpp
│   │   ├── hinttabledelegate.h
│   │   ├── main.cpp
│   │   ├── mainwindow/
│   │   │   ├── MainWindow.ui
│   │   │   ├── mainwindow.cpp
│   │   │   └── mainwindow.h
│   │   ├── qhtml5file.h
│   │   ├── qhtml5file_html5.cpp
│   │   ├── resources/
│   │   │   ├── icons/
│   │   │   │   ├── gui.icns
│   │   │   │   └── icons.qrc
│   │   │   └── samples/
│   │   │       ├── samples.qrc
│   │   │       ├── simple-lw-sw-ia.S
│   │   │       ├── template-os.S
│   │   │       └── template.S
│   │   ├── statictable.cpp
│   │   ├── statictable.h
│   │   ├── textsignalaction.cpp
│   │   ├── textsignalaction.h
│   │   ├── ui/
│   │   │   ├── hexlineedit.cpp
│   │   │   ├── hexlineedit.h
│   │   │   ├── pow2spinbox.cpp
│   │   │   └── pow2spinbox.h
│   │   ├── widgets/
│   │   │   ├── hidingtabwidget.cpp
│   │   │   └── hidingtabwidget.h
│   │   └── windows/
│   │       ├── cache/
│   │       │   ├── cachedock.cpp
│   │       │   ├── cachedock.h
│   │       │   ├── cacheview.cpp
│   │       │   └── cacheview.h
│   │       ├── coreview/
│   │       │   ├── components/
│   │       │   │   ├── cache.cpp
│   │       │   │   ├── cache.h
│   │       │   │   ├── value_handlers.cpp
│   │       │   │   └── value_handlers.h
│   │       │   ├── data.h
│   │       │   ├── scene.cpp
│   │       │   ├── scene.h
│   │       │   └── schemas/
│   │       │       └── schemas.qrc
│   │       ├── csr/
│   │       │   ├── csrdock.cpp
│   │       │   └── csrdock.h
│   │       ├── editor/
│   │       │   ├── editordock.cpp
│   │       │   ├── editordock.h
│   │       │   ├── editortab.cpp
│   │       │   ├── editortab.h
│   │       │   ├── highlighterasm.cpp
│   │       │   ├── highlighterasm.h
│   │       │   ├── highlighterc.cpp
│   │       │   ├── highlighterc.h
│   │       │   ├── linenumberarea.cpp
│   │       │   ├── linenumberarea.h
│   │       │   ├── srceditor.cpp
│   │       │   └── srceditor.h
│   │       ├── lcd/
│   │       │   ├── lcddisplaydock.cpp
│   │       │   ├── lcddisplaydock.h
│   │       │   ├── lcddisplayview.cpp
│   │       │   └── lcddisplayview.h
│   │       ├── memory/
│   │       │   ├── memorydock.cpp
│   │       │   ├── memorydock.h
│   │       │   ├── memorymodel.cpp
│   │       │   ├── memorymodel.h
│   │       │   ├── memorytableview.cpp
│   │       │   └── memorytableview.h
│   │       ├── messages/
│   │       │   ├── messagesdock.cpp
│   │       │   ├── messagesdock.h
│   │       │   ├── messagesmodel.cpp
│   │       │   ├── messagesmodel.h
│   │       │   ├── messagesview.cpp
│   │       │   └── messagesview.h
│   │       ├── peripherals/
│   │       │   ├── peripheralsdock.cpp
│   │       │   ├── peripheralsdock.h
│   │       │   ├── peripheralsview.cpp
│   │       │   ├── peripheralsview.h
│   │       │   └── peripheralsview.ui
│   │       ├── predictor/
│   │       │   ├── predictor_bht_dock.cpp
│   │       │   ├── predictor_bht_dock.h
│   │       │   ├── predictor_btb_dock.cpp
│   │       │   ├── predictor_btb_dock.h
│   │       │   ├── predictor_info_dock.cpp
│   │       │   └── predictor_info_dock.h
│   │       ├── program/
│   │       │   ├── programdock.cpp
│   │       │   ├── programdock.h
│   │       │   ├── programmodel.cpp
│   │       │   ├── programmodel.h
│   │       │   ├── programtableview.cpp
│   │       │   └── programtableview.h
│   │       ├── registers/
│   │       │   ├── registersdock.cpp
│   │       │   └── registersdock.h
│   │       ├── terminal/
│   │       │   ├── terminaldock.cpp
│   │       │   └── terminaldock.h
│   │       └── tlb/
│   │           ├── tlbdock.cpp
│   │           ├── tlbdock.h
│   │           ├── tlbview.cpp
│   │           └── tlbview.h
│   ├── machine/
│   │   ├── CMakeLists.txt
│   │   ├── bitfield.h
│   │   ├── config_isa.h
│   │   ├── core/
│   │   │   └── core_state.h
│   │   ├── core.cpp
│   │   ├── core.h
│   │   ├── core.test.cpp
│   │   ├── core.test.h
│   │   ├── csr/
│   │   │   ├── address.h
│   │   │   ├── controlstate.cpp
│   │   │   └── controlstate.h
│   │   ├── execute/
│   │   │   ├── alu.cpp
│   │   │   ├── alu.h
│   │   │   ├── alu.test.cpp
│   │   │   ├── alu.test.h
│   │   │   ├── alu_op.h
│   │   │   └── mul_op.h
│   │   ├── instruction.cpp
│   │   ├── instruction.h
│   │   ├── instruction.test.cpp
│   │   ├── instruction.test.h
│   │   ├── machine.cpp
│   │   ├── machine.h
│   │   ├── machineconfig.cpp
│   │   ├── machineconfig.h
│   │   ├── machinedefs.h
│   │   ├── memory/
│   │   │   ├── address.h
│   │   │   ├── address_range.h
│   │   │   ├── address_with_mode.h
│   │   │   ├── backend/
│   │   │   │   ├── aclintmswi.cpp
│   │   │   │   ├── aclintmswi.h
│   │   │   │   ├── aclintmtimer.cpp
│   │   │   │   ├── aclintmtimer.h
│   │   │   │   ├── aclintsswi.cpp
│   │   │   │   ├── aclintsswi.h
│   │   │   │   ├── backend_memory.h
│   │   │   │   ├── lcddisplay.cpp
│   │   │   │   ├── lcddisplay.h
│   │   │   │   ├── memory.cpp
│   │   │   │   ├── memory.h
│   │   │   │   ├── memory.test.cpp
│   │   │   │   ├── memory.test.h
│   │   │   │   ├── peripheral.cpp
│   │   │   │   ├── peripheral.h
│   │   │   │   ├── peripspiled.cpp
│   │   │   │   ├── peripspiled.h
│   │   │   │   ├── serialport.cpp
│   │   │   │   └── serialport.h
│   │   │   ├── cache/
│   │   │   │   ├── cache.cpp
│   │   │   │   ├── cache.h
│   │   │   │   ├── cache.test.cpp
│   │   │   │   ├── cache.test.h
│   │   │   │   ├── cache_policy.cpp
│   │   │   │   ├── cache_policy.h
│   │   │   │   └── cache_types.h
│   │   │   ├── frontend_memory.cpp
│   │   │   ├── frontend_memory.h
│   │   │   ├── memory_bus.cpp
│   │   │   ├── memory_bus.h
│   │   │   ├── memory_utils.h
│   │   │   ├── tlb/
│   │   │   │   ├── tlb.cpp
│   │   │   │   ├── tlb.h
│   │   │   │   ├── tlb_policy.cpp
│   │   │   │   └── tlb_policy.h
│   │   │   └── virtual/
│   │   │       ├── page_table_walker.cpp
│   │   │       ├── page_table_walker.h
│   │   │       ├── sv32.h
│   │   │       └── virtual_address.h
│   │   ├── pipeline.h
│   │   ├── predictor.cpp
│   │   ├── predictor.h
│   │   ├── predictor_types.h
│   │   ├── programloader.cpp
│   │   ├── programloader.h
│   │   ├── programloader.test.cpp
│   │   ├── programloader.test.h
│   │   ├── register_value.h
│   │   ├── registers.cpp
│   │   ├── registers.h
│   │   ├── registers.test.cpp
│   │   ├── registers.test.h
│   │   ├── simulator_exception.cpp
│   │   ├── simulator_exception.h
│   │   ├── symboltable.cpp
│   │   ├── symboltable.h
│   │   ├── tests/
│   │   │   ├── data/
│   │   │   │   └── cache_test_performance_data.h
│   │   │   └── utils/
│   │   │       └── integer_decomposition.h
│   │   └── utils.h
│   ├── os_emulation/
│   │   ├── CMakeLists.txt
│   │   ├── ossyscall.cpp
│   │   ├── ossyscall.h
│   │   ├── posix_polyfill.h
│   │   ├── syscall_nr.h
│   │   ├── syscallent.h
│   │   └── target_errno.h
│   └── project_info.h.in
└── tests/
    ├── cli/
    │   ├── asm_error/
    │   │   └── program.S
    │   ├── modifiers/
    │   │   ├── program.S
    │   │   └── stdout.txt
    │   ├── modifiers-pcrel/
    │   │   ├── program.S
    │   │   └── stdout.txt
    │   ├── stalls/
    │   │   ├── program.S
    │   │   └── stdout.txt
    │   └── virtual_memory/
    │       ├── dtlb/
    │       │   ├── program.S
    │       │   └── stdout.txt
    │       ├── exec/
    │       │   ├── program.S
    │       │   └── stdout.txt
    │       ├── itlb/
    │       │   ├── program.S
    │       │   └── stdout.txt
    │       ├── memrw/
    │       │   ├── program.S
    │       │   └── stdout.txt
    │       └── template/
    │           ├── program.S
    │           └── stdout.txt
    ├── riscv-official/
    │   ├── .gitignore
    │   ├── README.md
    │   ├── code/
    │   │   ├── constants.py
    │   │   ├── helpers.py
    │   │   ├── myparse.py
    │   │   ├── selftesting.py
    │   │   └── testing.py
    │   ├── env/
    │   │   └── p/
    │   │       ├── BackUp/
    │   │       │   └── riscv_test.h
    │   │       ├── link.ld
    │   │       └── riscv_test.h
    │   ├── isa/
    │   │   ├── .gitignore
    │   │   ├── Makefile
    │   │   ├── selftests/
    │   │   │   ├── Makefile
    │   │   │   ├── options_test.sh
    │   │   │   └── tests/
    │   │   │       ├── addi-fail32.S
    │   │   │       ├── addi-fail64.S
    │   │   │       ├── simple-fail32.S
    │   │   │       ├── simple-fail64.S
    │   │   │       ├── simple-pass32.S
    │   │   │       └── simple-pass64.S
    │   │   └── toolchain_setup
    │   └── qtrvsim_tester.py
    └── stud-support/
        ├── build_tests.py
        └── run_tests.py
Download .txt
SYMBOL INDEX (704 symbols across 200 files)

FILE: external/svgscene/src/example/main.cpp
  function main (line 6) | int main(int argc, char *argv[]) {

FILE: external/svgscene/src/example/mainwindow.h
  function namespace (line 10) | namespace Ui {
  function class (line 14) | class MainWindow : public QMainWindow {

FILE: external/svgscene/src/svgscene/components/groupitem.cpp
  type svgscene (line 5) | namespace svgscene {

FILE: external/svgscene/src/svgscene/components/groupitem.h
  function namespace (line 5) | namespace svgscene {

FILE: external/svgscene/src/svgscene/components/hyperlinkitem.cpp
  type svgscene (line 8) | namespace svgscene {
    function QString (line 12) | QString svgscene::HyperlinkItem::getTargetName() const {

FILE: external/svgscene/src/svgscene/components/hyperlinkitem.h
  function namespace (line 4) | namespace svgscene {

FILE: external/svgscene/src/svgscene/components/simpletextitem.cpp
  type svgscene (line 5) | namespace svgscene {

FILE: external/svgscene/src/svgscene/components/simpletextitem.h
  function namespace (line 7) | namespace svgscene {

FILE: external/svgscene/src/svgscene/graphicsview/svggraphicsview.h
  function class (line 5) | class SvgGraphicsView : public QGraphicsView {

FILE: external/svgscene/src/svgscene/svgdocument.cpp
  type svgscene (line 3) | namespace svgscene {

FILE: external/svgscene/src/svgscene/svgdocument.h
  function namespace (line 7) | namespace svgscene {

FILE: external/svgscene/src/svgscene/svggraphicsscene.cpp
  type svgscene (line 8) | namespace svgscene {

FILE: external/svgscene/src/svgscene/svggraphicsscene.h
  function namespace (line 5) | namespace svgscene {

FILE: external/svgscene/src/svgscene/svghandler.cpp
  type svgscene (line 21) | namespace svgscene {
    function SvgDocument (line 23) | SvgDocument parseFromFileName(QGraphicsScene *scene, const QString &fi...
    function SvgDocument (line 29) | SvgDocument parseFromFile(QGraphicsScene *scene, QFile *file) {
    function isDigit (line 39) | static inline bool isDigit(ushort ch) {
    function qreal (line 44) | static qreal toDouble(const QChar *&str) {
    function qreal (line 115) | static qreal toDouble(const QString &str, bool *ok = nullptr) {
    function parseNumbersArray (line 133) | static inline void parseNumbersArray(const QChar *&str, QVarLengthArra...
    function parseNumbersList (line 148) | static QVector<qreal> parseNumbersList(const QChar *&str) {
    function parsePercentageList (line 167) | static QVector<qreal> parsePercentageList(const QChar *&str) {
    function qsvg_h2i (line 188) | static inline int qsvg_h2i(char hex) {
    function qsvg_hex2int (line 194) | static inline int qsvg_hex2int(const char *s) {
    function qsvg_hex2int (line 197) | static inline int qsvg_hex2int(char s) {
    function qsvg_get_hex_rgb (line 202) | bool qsvg_get_hex_rgb(const char *name, QRgb *rgb) {
    function qsvg_get_hex_rgb (line 234) | bool qsvg_get_hex_rgb(const QByteArray &str, int len, QRgb *rgb) {
    function QColor (line 243) | static QColor parseColor(const QString &color, const QString &opacity) {
    function QTransform (line 299) | static QTransform parseTransformationMatrix(const QStringView &value) {
    function pathArcSegment (line 429) | static void pathArcSegment(
    function pathArc (line 462) | static void pathArc(
    function parsePathDataFast (line 533) | static bool parsePathDataFast(const QStringView &dataStr, QPainterPath...
    function QGraphicsItem (line 1080) | QGraphicsItem *SvgHandler::createGroupItem(const SvgHandler::SvgElemen...
    function QGraphicsItem (line 1086) | QGraphicsItem *SvgHandler::createHyperlinkItem(const SvgHandler::SvgEl...
    function CssAttributes (line 1115) | CssAttributes
    function QString (line 1309) | QString SvgHandler::point2str(QPointF r) {
    function QString (line 1314) | QString SvgHandler::rect2str(QRectF r) {
    function SvgDocument (line 1331) | SvgDocument SvgHandler::getDocument() const {

FILE: external/svgscene/src/svgscene/svghandler.h
  function namespace (line 20) | namespace svgscene {

FILE: external/svgscene/src/svgscene/svgmetadata.cpp
  type svgscene (line 3) | namespace svgscene {
    function XmlAttributes (line 5) | XmlAttributes getXmlAttributes(const QGraphicsItem *element) {
    function QString (line 13) | QString getXmlAttribute(const QGraphicsItem *element, const QString &n...
    function QString (line 20) | QString getXmlAttributeOr(
    function CssAttributes (line 28) | CssAttributes getCssAttributes(const QGraphicsItem *element) {
    function QString (line 36) | QString getCssAttribute(const QGraphicsItem *element, const QString &n...
    function QString (line 43) | QString getCssAttributeOr(

FILE: external/svgscene/src/svgscene/svgmetadata.h
  function namespace (line 7) | namespace svgscene {

FILE: external/svgscene/src/svgscene/svgspec.h
  function QSet (line 12) | static const QSet<QString> presentation_attributes {

FILE: src/assembler/fixmatheval.cpp
  function QStringView (line 13) | QStringView tokenize_symbol(QStringView &expression) {
  function FmeNode (line 47) | FmeNode *FmeNode::child() {
  function FmeNode (line 51) | FmeNode *FmeNode::find_last_child() {
  function QString (line 79) | QString FmeNodeConstant::dump() {
  function QString (line 105) | QString FmeNodeSymbol::dump() {
  function FmeNode (line 135) | FmeNode *FmeNodeUnaryOp::child() {
  function QString (line 144) | QString FmeNodeUnaryOp::dump() {
  function FmeNode (line 181) | FmeNode *FmeNodeBinaryOp::child() {
  function QString (line 190) | QString FmeNodeBinaryOp::dump() {
  function FmeNode (line 370) | FmeNode *FmeExpression::child() {
  function QString (line 374) | QString FmeExpression::dump() {

FILE: src/assembler/fixmatheval.h
  function namespace (line 8) | namespace fixmatheval {

FILE: src/assembler/messagetype.h
  function namespace (line 4) | namespace messagetype {

FILE: src/assembler/simpleasm.h
  function class (line 17) | class SymbolTableDb : public fixmatheval::FmeSymbolDb {
  function class (line 32) | class SimpleAsm : public QObject {

FILE: src/cli/chariohandler.cpp
  function qint64 (line 66) | qint64 CharIOHandler::pos() const {
  function qint64 (line 70) | qint64 CharIOHandler::size() const {
  function qint64 (line 86) | qint64 CharIOHandler::bytesAvailable() const {
  function qint64 (line 90) | qint64 CharIOHandler::bytesToWrite() const {
  function qint64 (line 106) | qint64 CharIOHandler::readData(char *data, qint64 maxSize) {
  function qint64 (line 110) | qint64 CharIOHandler::readLineData(char *data, qint64 maxSize) {
  function qint64 (line 114) | qint64 CharIOHandler::writeData(const char *data, qint64 maxSize) {

FILE: src/cli/chariohandler.h
  function class (line 8) | class CharIOHandler : public QIODevice {

FILE: src/cli/main.cpp
  function create_parser (line 24) | void create_parser(QCommandLineParser &p) {
  function configure_cache (line 125) | void configure_cache(CacheConfig &cacheconf, const QStringList &cachearg...
  function configure_branch_predictor (line 182) | void configure_branch_predictor(MachineConfig &config, const QStringList...
  function parse_u32_option (line 252) | void parse_u32_option(
  function configure_machine (line 274) | void configure_machine(QCommandLineParser &parser, MachineConfig &config) {
  function configure_tracer (line 348) | void configure_tracer(QCommandLineParser &p, Tracer &tr) {
  function configure_reporter (line 392) | void configure_reporter(QCommandLineParser &p, Reporter &r, const Symbol...
  function configure_serial_port (line 462) | void configure_serial_port(QCommandLineParser &p, SerialPort *ser_port) {
  function configure_osemu (line 512) | void configure_osemu(QCommandLineParser &p, MachineConfig &config, Machi...
  function load_ranges (line 565) | void load_ranges(Machine &machine, const QStringList &ranges) {
  function assemble (line 611) | bool assemble(Machine &machine, MsgReport &msgrep, const QString &filena...
  function main (line 627) | int main(int argc, char *argv[]) {

FILE: src/cli/msgreport.h
  function class (line 11) | class MsgReport : public QObject {

FILE: src/cli/reporter.h
  type DumpFormat (line 16) | enum DumpFormat {
  function class (line 25) | class Reporter : public QObject {

FILE: src/cli/tracer.cpp
  function trace_instruction_in_stage (line 14) | void trace_instruction_in_stage(

FILE: src/common/containers/cvector.h
  function noexcept (line 51) | constexpr cvector() = default;
  function const_iterator (line 64) | constexpr const_iterator begin() const noexcept { return data; }
  function iterator (line 66) | constexpr iterator end() noexcept { return data + dsize; }
  function reference (line 74) | constexpr reference operator[](std::size_t index) { return data[index]; }
  function const_reference (line 75) | constexpr const_reference operator[](std::size_t index) const { return d...
  function reference (line 77) | constexpr reference back() { return data[dsize - 1]; }
  function push_back (line 81) | constexpr void push_back(const T &a) { data[dsize++] = a; }
  function push_back (line 82) | constexpr void push_back(T &&a) { data[dsize++] = std::move(a); }
  function pop_back (line 83) | constexpr void pop_back() { --dsize; }
  function clear (line 85) | constexpr void clear() { dsize = 0; }

FILE: src/common/endian.h
  type Endian (line 20) | enum Endian { LITTLE, BIG }
  function Endian (line 30) | inline constexpr Endian get_native_endian() {
  function T (line 47) | T byteswap(T val) {
  function byteswap (line 60) | inline uint8_t byteswap(uint8_t val) {
  function byteswap (line 65) | inline uint16_t byteswap(uint16_t val) {
  function byteswap (line 69) | inline uint32_t byteswap(uint32_t val) {
  function byteswap (line 73) | inline uint64_t byteswap(uint64_t val) {

FILE: src/common/logging_format_colors.h
  function set_default_log_pattern (line 6) | static void set_default_log_pattern() {

FILE: src/common/math/bit_ops.h
  function T (line 22) | inline T get_bit(T val, size_t bit_index) {
  function T (line 30) | inline T get_bitmask(size_t start, size_t end) {
  function T (line 39) | inline T mask_bits(T val, size_t start, size_t end) {
  function T (line 49) | inline T get_bits(T val, size_t start, size_t end) {
  function T (line 58) | inline T sign_extend(T val, size_t size) {

FILE: src/common/polyfills/byteswap.h
  function bswap16 (line 24) | static inline uint16_t bswap16(uint16_t x) {
  function bswap32 (line 27) | static inline uint32_t bswap32(uint32_t x) {
  function bswap64 (line 31) | static inline uint64_t bswap64(uint64_t x) {

FILE: src/common/polyfills/clz32.h
  function clz32 (line 6) | static inline uint32_t clz32(uint32_t n) {
  function clz32 (line 17) | static inline uint32_t clz32(uint32_t n) {

FILE: src/common/polyfills/mulh64.h
  function mulhu64_fallback (line 23) | static inline constexpr uint64_t mulhu64_fallback(uint64_t a, uint64_t b) {
  function mulh64_fallback (line 61) | static inline constexpr uint64_t mulh64_fallback(int64_t a, int64_t b) {
  function mulhsu64_fallback (line 84) | static inline constexpr uint64_t mulhsu64_fallback(int64_t a, uint64_t b) {
  function mulh64 (line 99) | static inline constexpr uint64_t mulh64(int64_t a, int64_t b) {
  function mulhu64 (line 104) | static inline constexpr uint64_t mulhu64(uint64_t a, uint64_t b) {
  function mulhsu64 (line 109) | static inline constexpr uint64_t mulhsu64(int64_t a, uint64_t b) {

FILE: src/common/polyfills/mulh64.test.h
  function class (line 7) | class TestMULH64 : public QObject {

FILE: src/common/polyfills/qstring_hash.h
  function namespace (line 9) | namespace std {

FILE: src/common/polyfills/qt5/qtableview.h
  function class (line 11) | class Poly_QTableView : public QTableView {

FILE: src/common/string_utils.h
  function namespace (line 6) | namespace str {

FILE: src/gui/dialogs/about/aboutdialog.h
  function class (line 12) | class AboutDialog : public QDialog {

FILE: src/gui/dialogs/gotosymbol/gotosymboldialog.h
  function class (line 12) | class GoToSymbolDialog : public QDialog {

FILE: src/gui/dialogs/new/newdialog.cpp
  type machine::ConfigPresets (line 255) | enum machine::ConfigPresets
  type machine::ConfigPresets (line 681) | enum machine::ConfigPresets
  type machine::ConfigPresets (line 705) | enum machine::ConfigPresets
  type machine::CacheConfig::ReplacementPolicy (line 787) | enum machine::CacheConfig::ReplacementPolicy
  type machine::CacheConfig::WritePolicy (line 792) | enum machine::CacheConfig::WritePolicy

FILE: src/gui/dialogs/new/newdialog.h
  function class (line 17) | class NewDialog : public QDialog {
  function NewDialogCacheHandler (line 88) | NewDialogCacheHandler *cache_handler_p {}
  function class (line 91) | class NewDialogCacheHandler : public QObject {

FILE: src/gui/dialogs/savechanged/savechangeddialog.h
  function class (line 9) | class SaveChangedDialog : public QDialog {

FILE: src/gui/extprocess.h
  function class (line 9) | class ExtProcess : public QProcess {

FILE: src/gui/fontsize.h
  type FontSize (line 4) | struct FontSize {

FILE: src/gui/graphicsview.h
  function class (line 10) | class GraphicsView : public QGraphicsView {

FILE: src/gui/helper/async_modal.h
  function showAsyncMessageBox (line 19) | inline void showAsyncMessageBox(
  function showAsyncCriticalBox (line 34) | inline void showAsyncCriticalBox(

FILE: src/gui/hinttabledelegate.cpp
  function QSize (line 5) | QSize HintTableDelegate::sizeHintForText(

FILE: src/gui/hinttabledelegate.h
  function class (line 7) | class HintTableDelegate : public QStyledItemDelegate {

FILE: src/gui/main.cpp
  function main (line 9) | int main(int argc, char *argv[]) {

FILE: src/gui/mainwindow/mainwindow.cpp
  type machine::Machine::Status (line 638) | enum machine::Machine::Status

FILE: src/gui/mainwindow/mainwindow.h
  function class (line 38) | class MainWindow : public QMainWindow {
  function CsrDock (line 161) | CsrDock *csrdock {}
  function MessagesDock (line 162) | MessagesDock *messages {}
  function QActionGroup (line 165) | QActionGroup *speed_group {}
  function QPrintDialog (line 181) | QPrintDialog print_dialog { &printer, this };
  function class (line 185) | class SimpleAsmWithEditorCheck : public SimpleAsm {

FILE: src/gui/qhtml5file.h
  function QT_BEGIN_NAMESPACE (line 47) | QT_BEGIN_NAMESPACE

FILE: src/gui/qhtml5file_html5.cpp
  function EMSCRIPTEN_KEEPALIVE (line 56) | EMSCRIPTEN_KEEPALIVE void
  function loadFile (line 65) | void loadFile(const char *accept, std::function<void(char *, size_t, con...
  function saveFile (line 142) | void saveFile(const char *contentPointer, size_t contentLength, const ch...

FILE: src/gui/statictable.cpp
  function QSize (line 52) | QSize StaticTableLayout::minimumSize() const {
  function QSize (line 77) | QSize StaticTableLayout::sizeHint() const {
  function QLayoutItem (line 85) | QLayoutItem *StaticTableLayout::itemAt(int index __attribute__((unused))...
  function QLayoutItem (line 90) | QLayoutItem *StaticTableLayout::takeAt(int index __attribute__((unused))) {

FILE: src/gui/statictable.h
  function class (line 16) | class StaticTableLayout : public QLayout {
  function class (line 80) | class StaticTable : public QWidget {

FILE: src/gui/textsignalaction.h
  function class (line 7) | class TextSignalAction : public QAction {

FILE: src/gui/ui/hexlineedit.h
  function class (line 7) | class HexLineEdit : public QLineEdit {

FILE: src/gui/ui/pow2spinbox.cpp
  function QString (line 26) | QString Pow2SpinBox::textFromValue(int value) const {

FILE: src/gui/ui/pow2spinbox.h
  function class (line 7) | class Pow2SpinBox : public QSpinBox {

FILE: src/gui/widgets/hidingtabwidget.h
  function class (line 8) | class HidingTabWidget : public QTabWidget {

FILE: src/gui/windows/cache/cachedock.h
  function class (line 12) | class CacheDock : public QDockWidget {

FILE: src/gui/windows/cache/cacheview.cpp
  function bitsToRepresent (line 22) | static inline unsigned int bitsToRepresent(quint32 range_max_val) {
  function QRectF (line 47) | QRectF CacheAddressBlock::boundingRect() const {
  function QRectF (line 233) | QRectF CacheViewBlock::boundingRect() const {

FILE: src/gui/windows/cache/cacheview.h
  function QRectF (line 45) | [[nodiscard]] QRectF boundingRect() const override;

FILE: src/gui/windows/coreview/components/cache.h
  function class (line 9) | class Cache : public QObject {

FILE: src/gui/windows/coreview/components/value_handlers.h
  function class (line 23) | class BoolValue {
  function class (line 34) | class PCValue : public QObject {
  function class (line 53) | class RegValue {
  function class (line 64) | class RegIdValue {
  function class (line 75) | class DebugValue {
  function class (line 86) | class MultiTextValue {
  function class (line 102) | class InstructionValue {
  function update (line 130) | void update() {

FILE: src/gui/windows/coreview/scene.h
  function class (line 18) | class CoreViewScene : public svgscene::SvgGraphicsScene {
  function class (line 108) | class CoreViewSceneSimple : public CoreViewScene {
  function class (line 113) | class CoreViewScenePipelined : public CoreViewScene {

FILE: src/gui/windows/csr/csrdock.h
  function class (line 15) | class CsrDock : public QDockWidget {

FILE: src/gui/windows/editor/editordock.cpp
  function compare_filenames (line 21) | int compare_filenames(const QString &filename1, const QString &filename2) {
  function EditorTab (line 62) | EditorTab *EditorDock::get_tab(int index) const {
  function EditorTab (line 66) | EditorTab *EditorDock::open_file(const QString &filename, bool save_as_r...
  function EditorTab (line 79) | EditorTab *EditorDock::open_file_if_not_open(const QString &filename, bo...
  function EditorTab (line 89) | EditorTab *EditorDock::create_empty_tab() {
  function EditorTab (line 120) | EditorTab *EditorDock::find_tab_by_filename(const QString &filename) con...
  function SrcEditor (line 129) | SrcEditor *EditorDock::get_current_editor() const {
  function QStringList (line 134) | QStringList EditorDock::get_open_file_list() const {

FILE: src/gui/windows/editor/editordock.h
  function class (line 11) | class EditorDock : public HidingTabWidget {

FILE: src/gui/windows/editor/editortab.cpp
  function QString (line 34) | QString EditorTab::title() {

FILE: src/gui/windows/editor/editortab.h
  function class (line 11) | class EditorTab : public QWidget {

FILE: src/gui/windows/editor/highlighterasm.h
  type HighlightingRule (line 24) | struct HighlightingRule {

FILE: src/gui/windows/editor/highlighterc.h
  type HighlightingRule (line 73) | struct HighlightingRule {

FILE: src/gui/windows/editor/linenumberarea.cpp
  function QSize (line 15) | QSize LineNumberArea::sizeHint() const {

FILE: src/gui/windows/editor/linenumberarea.h
  function class (line 10) | class LineNumberArea : public QWidget {

FILE: src/gui/windows/editor/srceditor.cpp
  function QString (line 51) | QString SrcEditor::filename() const {
  function QString (line 55) | QString SrcEditor::title() {

FILE: src/gui/windows/editor/srceditor.h
  function class (line 15) | class SrcEditor : public QPlainTextEdit {

FILE: src/gui/windows/lcd/lcddisplaydock.h
  function class (line 10) | class LcdDisplayDock : public QDockWidget {

FILE: src/gui/windows/lcd/lcddisplayview.cpp
  function uint (line 70) | uint LcdDisplayView::fb_width() {
  function uint (line 75) | uint LcdDisplayView::fb_height() {

FILE: src/gui/windows/lcd/lcddisplayview.h
  function class (line 10) | class LcdDisplayView : public QWidget {

FILE: src/gui/windows/memory/memorydock.h
  function class (line 10) | class MemoryDock : public QDockWidget {

FILE: src/gui/windows/memory/memorymodel.cpp
  function QVariant (line 42) | QVariant MemoryModel::headerData(int section, Qt::Orientation orientatio...
  function QVariant (line 57) | QVariant MemoryModel::data(const QModelIndex &index, int role) const {
  type MemoryCellSize (line 153) | enum MemoryCellSize

FILE: src/gui/windows/memory/memorymodel.h
  function class (line 9) | class MemoryModel : public QAbstractTableModel {
  function get_row_address (line 56) | inline bool get_row_address(machine::Address &address, int row) const {
  function get_row_for_address (line 60) | inline bool get_row_for_address(int &row, machine::Address address) const {
  type MemoryCellSize (line 87) | enum MemoryCellSize

FILE: src/gui/windows/memory/memorytableview.h
  function class (line 11) | class MemoryTableView : public Poly_QTableView {

FILE: src/gui/windows/messages/messagesdock.h
  function class (line 11) | class MessagesDock : public QDockWidget {

FILE: src/gui/windows/messages/messagesmodel.cpp
  class MessagesEntry (line 6) | class MessagesEntry {
    method MessagesEntry (line 8) | inline MessagesEntry(
  function QVariant (line 44) | QVariant MessagesModel::headerData(int section, Qt::Orientation orientat...
  function QVariant (line 60) | QVariant MessagesModel::data(const QModelIndex &index, int role) const {

FILE: src/gui/windows/messages/messagesmodel.h
  function class (line 12) | class MessagesModel : public QAbstractListModel {

FILE: src/gui/windows/messages/messagesview.h
  function class (line 9) | class MessagesView : public QListView {

FILE: src/gui/windows/peripherals/peripheralsdock.h
  function class (line 13) | class PeripheralsDock : public QDockWidget {

FILE: src/gui/windows/peripherals/peripheralsview.cpp
  function set_widget_background_color (line 95) | static void set_widget_background_color(QWidget *w, uint val) {

FILE: src/gui/windows/peripherals/peripheralsview.h
  function class (line 10) | class PeripheralsView : public QWidget {

FILE: src/gui/windows/predictor/predictor_bht_dock.cpp
  function QTableWidgetItem (line 57) | QTableWidgetItem *DockPredictorBHT::get_bht_cell_item(uint8_t row_index,...

FILE: src/gui/windows/predictor/predictor_bht_dock.h
  function number_of_bht_bits (line 75) | uint8_t number_of_bht_bits { 0 }
  function QT_OWNED (line 100) | QT_OWNED QTableWidget *bht { new QTableWidget() };

FILE: src/gui/windows/predictor/predictor_btb_dock.cpp
  function QTableWidgetItem (line 37) | QTableWidgetItem *DockPredictorBTB::get_btb_cell_item(uint8_t row_index,...

FILE: src/gui/windows/predictor/predictor_btb_dock.h
  function QT_OWNED (line 65) | QT_OWNED QTableWidget *btb { new QTableWidget() };

FILE: src/gui/windows/predictor/predictor_info_dock.h
  function number_of_bhr_bits (line 71) | uint8_t number_of_bhr_bits { 0 }
  function QT_OWNED (line 76) | QT_OWNED QSpacerItem *vertical_spacer {
  function QT_OWNED (line 131) | QT_OWNED QLineEdit *value_bhr { new QLineEdit() };

FILE: src/gui/windows/program/programdock.cpp
  type FollowSource (line 20) | enum FollowSource
  type FollowSource (line 98) | enum FollowSource

FILE: src/gui/windows/program/programdock.h
  function class (line 11) | class ProgramDock : public QDockWidget {

FILE: src/gui/windows/program/programmodel.cpp
  function QVariant (line 40) | QVariant ProgramModel::headerData(int section, Qt::Orientation orientati...
  function QVariant (line 55) | QVariant ProgramModel::data(const QModelIndex &index, int role) const {

FILE: src/gui/windows/program/programmodel.h
  function class (line 9) | class ProgramModel : public QAbstractTableModel {

FILE: src/gui/windows/program/programtableview.h
  function class (line 11) | class ProgramTableView : public Poly_QTableView {

FILE: src/gui/windows/registers/registersdock.cpp
  function QLabel (line 35) | QLabel *RegistersDock::addRegisterLabel(const QString &title) {

FILE: src/gui/windows/registers/registersdock.h
  function machine (line 40) | const machine::Registers *regs_handle {}
  function BORROWED (line 47) | BORROWED QLabel *pc {}

FILE: src/gui/windows/terminal/terminaldock.h
  function class (line 13) | class TerminalDock : public QDockWidget {

FILE: src/gui/windows/tlb/tlbdock.h
  function class (line 13) | class TLBDock : public QDockWidget {

FILE: src/gui/windows/tlb/tlbview.cpp
  function QRectF (line 23) | QRectF TLBAddressBlock::boundingRect() const {
  function QRectF (line 106) | QRectF TLBViewBlock::boundingRect() const {

FILE: src/gui/windows/tlb/tlbview.h
  function QRectF (line 41) | QRectF boundingRect() const override;

FILE: src/machine/bitfield.h
  type BitField (line 17) | struct BitField {
  function T (line 26) | T encode(T val) const {

FILE: src/machine/config_isa.h
  function namespace (line 7) | namespace machine {

FILE: src/machine/core.cpp
  function InstructionFlags (line 13) | static InstructionFlags unsupported_inst_flags_to_check(Xlen xlen, Confi...
  function Registers (line 71) | Registers *Core::get_regs() const {
  function FrontendMemory (line 79) | FrontendMemory *Core::get_mem_data() const {
  function FrontendMemory (line 83) | FrontendMemory *Core::get_mem_program() const {
  function BranchPredictor (line 87) | BranchPredictor *Core::get_predictor() const {
  function CoreState (line 91) | const CoreState &Core::get_state() const {
  type ExceptionCause (line 109) | enum ExceptionCause
  type ExceptionCause (line 113) | enum ExceptionCause
  type ExceptionCause (line 117) | enum ExceptionCause
  type ExceptionCause (line 121) | enum ExceptionCause
  function Xlen (line 124) | Xlen Core::get_xlen() const {
  function amo32_operations (line 200) | static int32_t amo32_operations(enum AccessControl memctl, int32_t a, in...
  function amo64_operations (line 216) | static int64_t amo64_operations(enum AccessControl memctl, int64_t a, in...
  type ExceptionCause (line 232) | enum ExceptionCause
  type AccessControl (line 233) | enum AccessControl
  function FetchState (line 301) | FetchState Core::fetch(PCInterstage pc, bool skip_break) {
  function DecodeState (line 327) | DecodeState Core::decode(const FetchInterstage &dt) {
  function ExecuteState (line 427) | ExecuteState Core::execute(const DecodeInterstage &dt) {
  function MemoryState (line 498) | MemoryState Core::memory(const ExecuteInterstage &dt) {
  function WritebackState (line 614) | WritebackState Core::writeback(const MemoryInterstage &dt) {
  function Address (line 627) | Address Core::compute_next_inst_addr(const ExecuteInterstage &exec, bool...
  function is_hazard_in_stage (line 775) | bool is_hazard_in_stage(const InterstageReg &interstage, const DecodeInt...

FILE: src/machine/core.h
  type hwBreak (line 25) | struct hwBreak
  function class (line 27) | class Core : public QObject {
  function class (line 154) | class CoreSingle : public Core {
  function class (line 173) | class CorePipelined : public Core {

FILE: src/machine/core.test.cpp
  function compile_simple_program (line 26) | size_t compile_simple_program(
  function test_program_with_single_result (line 42) | void test_program_with_single_result() {
  function core_regs_data (line 63) | static void core_regs_data() {
  function core_jmp_data (line 254) | static void core_jmp_data() {
  function core_mem_data (line 357) | static void core_mem_data() {
  function core_alu_forward_data (line 464) | static void core_alu_forward_data() {
  function run_code_fragment (line 667) | static void run_code_fragment(
  function core_memory_tests_data (line 755) | static void core_memory_tests_data() {
  function extension_m_data (line 1060) | void extension_m_data() {

FILE: src/machine/core.test.h
  function class (line 6) | class TestCore : public QObject {

FILE: src/machine/core/core_state.h
  function namespace (line 14) | namespace machine {

FILE: src/machine/csr/address.h
  function PrivilegeLevel (line 13) | enum class PrivilegeLevel {

FILE: src/machine/csr/controlstate.cpp
  type machine (line 12) | namespace machine { namespace CSR {
    type CSR (line 12) | namespace CSR {
      function RegisterValue (line 58) | RegisterValue ControlState::read(Address address, PrivilegeLevel cur...
      type ExceptionCause (line 152) | enum ExceptionCause
      function PrivilegeLevel (line 209) | PrivilegeLevel ControlState::exception_return(
      function RegisterValue (line 265) | RegisterValue ControlState::read_internal(size_t internal_id) const {

FILE: src/machine/csr/controlstate.h
  function namespace (line 17) | namespace machine { namespace CSR {

FILE: src/machine/execute/alu.cpp
  type machine (line 5) | namespace machine {
    function RegisterValue (line 7) | RegisterValue alu_combined_operate(
    function alu64_operate (line 33) | int64_t alu64_operate(AluOp op, bool modified, RegisterValue a, Regist...
    function alu32_operate (line 55) | int32_t alu32_operate(AluOp op, bool modified, RegisterValue a, Regist...
    function mul64_operate (line 76) | int64_t mul64_operate(MulOp op, RegisterValue a, RegisterValue b) {
    function mul32_operate (line 109) | int32_t mul32_operate(MulOp op, RegisterValue a, RegisterValue b) {

FILE: src/machine/execute/alu.h
  function AluComponent (line 15) | enum class AluComponent {

FILE: src/machine/execute/alu.test.cpp
  function mulh32 (line 181) | constexpr int32_t mulh32(uint64_t a, uint64_t b) {

FILE: src/machine/execute/alu.test.h
  function class (line 6) | class TestAlu : public QObject {

FILE: src/machine/execute/alu_op.h
  function AluOp (line 10) | enum class AluOp : uint8_t {

FILE: src/machine/execute/mul_op.h
  function MulOp (line 8) | enum class MulOp : uint8_t {

FILE: src/machine/instruction.cpp
  type machine (line 24) | namespace machine {
  type ArgumentDesc (line 27) | struct ArgumentDesc {
    method ArgumentDesc (line 41) | inline ArgumentDesc(char name, char kind, int64_t min, int64_t max, Bi...
    method is_value_in_field_range (line 49) | [[nodiscard]] constexpr bool is_value_in_field_range(RegisterValue val...
    method is_imm (line 58) | [[nodiscard]] constexpr bool is_imm() const { return kind != 'g'; }
  function fill_argdesbycode (line 92) | static bool fill_argdesbycode() {
  type InstructionMap (line 123) | struct InstructionMap {
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 158) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 163) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 168) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 173) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 178) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 183) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 188) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 193) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 198) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 204) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 209) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 214) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 221) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 228) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 233) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 238) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 244) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 254) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 259) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 276) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 311) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 346) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 360) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 371) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 376) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 387) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 398) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 403) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 408) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 423) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 434) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 439) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 451) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 458) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 496) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 509) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 522) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 527) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 538) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 543) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 548) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 563) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 574) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 581) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 619) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 626) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 632) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 633) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  function Address (line 713) | Address Instruction::address() const {
  type Instruction::Type (line 725) | enum Instruction::Type
  type InstructionMap (line 726) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionFlags (line 730) | enum InstructionFlags
  type InstructionMap (line 731) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionFlags (line 732) | enum InstructionFlags
  function AluCombinedOp (line 734) | AluCombinedOp Instruction::alu_op() const {
  type AccessControl (line 739) | enum AccessControl
  type InstructionMap (line 740) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionMap (line 748) | struct InstructionMap
    type InstructionMap (line 128) | struct InstructionMap
  type InstructionFlags (line 749) | enum InstructionFlags
  function Instruction (line 762) | Instruction &Instruction::operator=(const Instruction &c) {
  function QString (line 767) | QString Instruction::to_str(Address inst_addr) const {
  function instruction_from_string_build_base_aliases (line 840) | static void instruction_from_string_build_base_aliases(
  function instruction_from_string_build_base (line 874) | void instruction_from_string_build_base(
  function instruction_from_string_build_base (line 918) | void instruction_from_string_build_base() {
  function parse_reg_from_string (line 922) | static int parse_reg_from_string(const QString &str, uint *chars_taken =...
  function read_reloc_expression (line 961) | static std::pair<QString, uint32_t> read_reloc_expression(const QString ...
  function reloc_append (line 991) | static void reloc_append(
  function instruction_code_map_next_im (line 1180) | static void instruction_code_map_next_im(const InstructionMap *&im, bool...
  function Instruction (line 1190) | Instruction Instruction::base_from_tokens(
  function parse_immediate_value (line 1324) | bool parse_immediate_value(
  function parse_csr_address (line 1375) | uint16_t parse_csr_address(const QString &field_token, uint &chars_taken) {
  function TokenizedInstruction (line 1479) | TokenizedInstruction TokenizedInstruction::from_line(

FILE: src/machine/instruction.h
  type InstructionFlags (line 28) | enum InstructionFlags
  type TokenizedInstruction (line 75) | struct TokenizedInstruction {
  type RelocExpression (line 95) | struct RelocExpression
  type QVector (line 96) | typedef QVector<RelocExpression *> RelocExpressionList;
  function class (line 98) | class Instruction {

FILE: src/machine/instruction.test.h
  function class (line 6) | class TestInstruction : public QObject {

FILE: src/machine/machine.cpp
  type ExceptionCause (line 111) | enum ExceptionCause
  type ExceptionCause (line 112) | enum ExceptionCause
  function MachineConfig (line 200) | const MachineConfig &Machine::config() {
  function Registers (line 213) | const Registers *Machine::registers() {
  function Memory (line 221) | const Memory *Machine::memory() {
  function Memory (line 225) | Memory *Machine::memory_rw() {
  function Cache (line 229) | const Cache *Machine::cache_program() {
  function Cache (line 233) | const Cache *Machine::cache_data() {
  function Cache (line 237) | const Cache *Machine::cache_level2() {
  function BranchPredictor (line 241) | const BranchPredictor *Machine::branch_predictor() {
  function Cache (line 245) | Cache *Machine::cache_data_rw() {
  function TLB (line 260) | const TLB *Machine::get_tlb_program() const {
  function TLB (line 264) | const TLB *Machine::get_tlb_data() const {
  function TLB (line 268) | TLB *Machine::get_tlb_program_rw() {
  function TLB (line 272) | TLB *Machine::get_tlb_data_rw() {
  function MemoryDataBus (line 276) | const MemoryDataBus *Machine::memory_data_bus() {
  function MemoryDataBus (line 280) | MemoryDataBus *Machine::memory_data_bus_rw() {
  function SerialPort (line 284) | SerialPort *Machine::serial_port() {
  function PeripSpiLed (line 288) | PeripSpiLed *Machine::peripheral_spi_led() {
  function LcdDisplay (line 292) | LcdDisplay *Machine::peripheral_lcd_display() {
  function SymbolTable (line 296) | SymbolTable *Machine::symbol_table_rw(bool create) {
  function SymbolTable (line 301) | const SymbolTable *Machine::symbol_table(bool create) {
  function Core (line 315) | const Core *Machine::core() {
  function CoreSingle (line 319) | const CoreSingle *Machine::core_singe() {
  function CorePipelined (line 323) | const CorePipelined *Machine::core_pipelined() {
  type Machine::Status (line 331) | enum Machine::Status
  type Status (line 363) | enum Status
  type Status (line 445) | enum Status
  type ExceptionCause (line 477) | enum ExceptionCause
  type ExceptionCause (line 481) | enum ExceptionCause
  type ExceptionCause (line 486) | enum ExceptionCause
  type ExceptionCause (line 490) | enum ExceptionCause
  type ExceptionCause (line 495) | enum ExceptionCause

FILE: src/machine/machine.h
  function namespace (line 26) | namespace machine {

FILE: src/machine/machineconfig.cpp
  type ReplacementPolicy (line 70) | enum ReplacementPolicy
  type WritePolicy (line 71) | enum WritePolicy
  type ConfigPresets (line 85) | enum ConfigPresets
  type ReplacementPolicy (line 117) | enum ReplacementPolicy
  type WritePolicy (line 121) | enum WritePolicy
  type CacheConfig::ReplacementPolicy (line 141) | enum CacheConfig::ReplacementPolicy
  type CacheConfig::WritePolicy (line 145) | enum CacheConfig::WritePolicy
  type ReplacementPolicy (line 165) | enum ReplacementPolicy
  type ReplacementPolicy (line 173) | enum ReplacementPolicy
  type ReplacementPolicy (line 188) | enum ReplacementPolicy
  type ConfigPresets (line 200) | enum ConfigPresets
  type ReplacementPolicy (line 209) | enum ReplacementPolicy
  type HazardUnit (line 352) | enum HazardUnit
  type ConfigPresets (line 428) | enum ConfigPresets
  type MachineConfig::HazardUnit (line 490) | enum MachineConfig::HazardUnit
  type HazardUnit (line 495) | enum HazardUnit
  type MachineConfig::HazardUnit (line 603) | enum MachineConfig::HazardUnit
  function QString (line 652) | QString MachineConfig::osemu_fs_root() const {
  function QString (line 660) | QString MachineConfig::elf() const {
  function CacheConfig (line 664) | const CacheConfig &MachineConfig::cache_program() const {
  function CacheConfig (line 668) | const CacheConfig &MachineConfig::cache_data() const {
  function CacheConfig (line 672) | const CacheConfig &MachineConfig::cache_level2() const {
  function CacheConfig (line 676) | CacheConfig *MachineConfig::access_cache_program() {
  function CacheConfig (line 680) | CacheConfig *MachineConfig::access_cache_data() {
  function CacheConfig (line 684) | CacheConfig *MachineConfig::access_cache_level2() {
  function TLBConfig (line 688) | TLBConfig *MachineConfig::access_tlb_program() {
  function TLBConfig (line 692) | TLBConfig *MachineConfig::access_tlb_data() {
  function TLBConfig (line 696) | const TLBConfig &MachineConfig::tlbc_program() const {
  function TLBConfig (line 700) | const TLBConfig &MachineConfig::tlbc_data() const {
  function Endian (line 704) | Endian MachineConfig::get_simulated_endian() const {
  function Xlen (line 708) | Xlen MachineConfig::get_simulated_xlen() const {
  function ConfigIsaWord (line 712) | ConfigIsaWord MachineConfig::get_isa_word() const {
  function PredictorType (line 751) | PredictorType MachineConfig::get_bp_type() const {
  function PredictorState (line 755) | PredictorState MachineConfig::get_bp_init_state() const {

FILE: src/machine/machineconfig.h
  type class (line 21) | enum class
  type ConfigPresets (line 23) | enum ConfigPresets {
  type ConfigPresets (line 45) | enum ConfigPresets
  type ReplacementPolicy (line 47) | enum ReplacementPolicy {
  type WritePolicy (line 55) | enum WritePolicy {
  type ReplacementPolicy (line 67) | enum ReplacementPolicy
  type WritePolicy (line 68) | enum WritePolicy
  type ReplacementPolicy (line 83) | enum ReplacementPolicy
  type WritePolicy (line 84) | enum WritePolicy
  type ConfigPresets (line 95) | enum ConfigPresets
  type VmMode (line 97) | enum VmMode { VM_BARE, VM_SV32 }
  type ReplacementPolicy (line 99) | enum ReplacementPolicy {
  type ReplacementPolicy (line 126) | enum ReplacementPolicy
  type ConfigPresets (line 137) | enum ConfigPresets
  type HazardUnit (line 139) | enum HazardUnit { HU_NONE, HU_STALL, HU_STALL_FORWARD }
  type HazardUnit (line 149) | enum HazardUnit
  type HazardUnit (line 242) | enum HazardUnit

FILE: src/machine/machinedefs.h
  function namespace (line 9) | namespace machine {

FILE: src/machine/memory/address.h
  function namespace (line 11) | namespace machine {

FILE: src/machine/memory/address_range.h
  function namespace (line 10) | namespace machine {

FILE: src/machine/memory/address_with_mode.h
  function namespace (line 10) | namespace machine {
  function class (line 32) | class AddressWithMode : public Address {

FILE: src/machine/memory/backend/aclintmswi.cpp
  type machine::aclint (line 10) | namespace machine::aclint {
    function WriteResult (line 34) | WriteResult
    function ReadResult (line 49) | ReadResult
    function LocationStatus (line 91) | LocationStatus AclintMswi::location_status(Offset offset) const {

FILE: src/machine/memory/backend/aclintmswi.h
  function namespace (line 10) | namespace machine::aclint {

FILE: src/machine/memory/backend/aclintmtimer.cpp
  type machine::aclint (line 13) | namespace machine::aclint {
    function WriteResult (line 76) | WriteResult
    function ReadResult (line 91) | ReadResult
    function LocationStatus (line 144) | LocationStatus AclintMtimer::location_status(Offset offset) const {

FILE: src/machine/memory/backend/aclintmtimer.h
  function namespace (line 11) | namespace machine { namespace aclint {

FILE: src/machine/memory/backend/aclintsswi.cpp
  type machine (line 11) | namespace machine { namespace aclint {
    type aclint (line 11) | namespace aclint {
      function WriteResult (line 21) | WriteResult
      function ReadResult (line 36) | ReadResult
      function LocationStatus (line 74) | LocationStatus AclintSswi::location_status(Offset offset) const {

FILE: src/machine/memory/backend/aclintsswi.h
  function namespace (line 10) | namespace machine::aclint {

FILE: src/machine/memory/backend/backend_memory.h
  function namespace (line 13) | namespace machine {

FILE: src/machine/memory/backend/lcddisplay.cpp
  type machine (line 12) | namespace machine {
    function WriteResult (line 23) | WriteResult
    function ReadResult (line 37) | ReadResult
    function LocationStatus (line 138) | LocationStatus LcdDisplay::location_status(Offset offset) const {

FILE: src/machine/memory/backend/lcddisplay.h
  function namespace (line 13) | namespace machine {

FILE: src/machine/memory/backend/memory.cpp
  type machine (line 8) | namespace machine {
    function WriteResult (line 18) | WriteResult
    function ReadResult (line 40) | ReadResult
    function LocationStatus (line 59) | LocationStatus MemorySection::location_status(Offset offset) const {
    function byte (line 68) | const byte *MemorySection::data() const {
    function generate_mask (line 98) | constexpr uint64_t generate_mask(size_t section_size, size_t unit_size) {
    function tree_row_bit_offset (line 105) | constexpr size_t tree_row_bit_offset(size_t i) {
    function get_tree_row (line 112) | constexpr size_t get_tree_row(size_t offset, size_t i) {
    function MemorySection (line 146) | MemorySection *Memory::get_section(size_t offset, bool create) const {
    function get_section_offset_mask (line 171) | size_t get_section_offset_mask(size_t addr) {
    function WriteResult (line 175) | WriteResult
    function ReadResult (line 185) | ReadResult Memory::read(void *destination, Offset source, size_t size,...
    function LocationStatus (line 278) | LocationStatus Memory::location_status(Offset offset) const {

FILE: src/machine/memory/backend/memory.h
  function length (line 35) | size_t length() const;

FILE: src/machine/memory/backend/memory.test.cpp
  function prepare_data (line 71) | constexpr void prepare_data(
  function prepare_endian_test (line 218) | void prepare_endian_test() {

FILE: src/machine/memory/backend/memory.test.h
  function class (line 6) | class TestMemory : public QObject {

FILE: src/machine/memory/backend/peripheral.cpp
  function WriteResult (line 12) | WriteResult
  function ReadResult (line 24) | ReadResult
  function LocationStatus (line 34) | LocationStatus SimplePeripheral::location_status(Offset offset) const {

FILE: src/machine/memory/backend/peripheral.h
  function namespace (line 15) | namespace machine {

FILE: src/machine/memory/backend/peripspiled.cpp
  function WriteResult (line 20) | WriteResult
  function ReadResult (line 33) | ReadResult
  function LocationStatus (line 138) | LocationStatus PeripSpiLed::location_status(Offset offset) const {

FILE: src/machine/memory/backend/peripspiled.h
  function namespace (line 12) | namespace machine {

FILE: src/machine/memory/backend/serialport.cpp
  type machine (line 12) | namespace machine {
    function WriteResult (line 49) | WriteResult
    function ReadResult (line 63) | ReadResult
    function LocationStatus (line 162) | LocationStatus SerialPort::location_status(Offset offset) const {

FILE: src/machine/memory/backend/serialport.h
  function namespace (line 11) | namespace machine {

FILE: src/machine/memory/cache/cache.cpp
  type machine (line 10) | namespace machine {
    function WriteResult (line 43) | WriteResult
    function ReadResult (line 68) | ReadResult Cache::read(void *destination, AddressWithMode source, size...
    type CacheLine (line 196) | struct CacheLine
    type CacheLine (line 280) | struct CacheLine
    function Address (line 301) | Address Cache::calc_base_address(size_t tag, size_t row) const {
    function CacheLocation (line 306) | CacheLocation Cache::compute_location(Address address) const {
    type LocationStatus (line 325) | enum LocationStatus
    type LocationStatus (line 334) | enum LocationStatus
    function CacheConfig (line 344) | const CacheConfig &Cache::get_config() const {

FILE: src/machine/memory/cache/cache.h
  function namespace (line 12) | namespace machine {

FILE: src/machine/memory/cache/cache.test.cpp
  function get_testing_cache_configs (line 67) | array<CacheConfig, CONFIG_COUNT> get_testing_cache_configs() {

FILE: src/machine/memory/cache/cache.test.h
  function class (line 6) | class TestCache : public QObject {

FILE: src/machine/memory/cache/cache_policy.cpp
  type machine (line 9) | namespace machine {

FILE: src/machine/memory/cache/cache_policy.h
  function namespace (line 13) | namespace machine {

FILE: src/machine/memory/cache/cache_types.h
  function namespace (line 6) | namespace machine {

FILE: src/machine/memory/frontend_memory.cpp
  type machine (line 6) | namespace machine {
    type AccessControl (line 40) | enum AccessControl
    function RegisterValue (line 73) | RegisterValue FrontendMemory::read_ctl(enum AccessControl ctl, Address...
    function LocationStatus (line 94) | LocationStatus FrontendMemory::location_status(Address address) const {
    function T (line 100) | T FrontendMemory::read_generic(AddressWithMode address, AccessEffects ...

FILE: src/machine/memory/frontend_memory.h
  function namespace (line 20) | namespace machine {

FILE: src/machine/memory/memory_bus.cpp
  function WriteResult (line 21) | WriteResult
  function WriteResult (line 30) | WriteResult MemoryDataBus::write_single(
  function ReadResult (line 50) | ReadResult
  function ReadResult (line 59) | ReadResult MemoryDataBus::read_single(
  type LocationStatus (line 80) | enum LocationStatus
  function WriteResult (line 192) | WriteResult
  function ReadResult (line 198) | ReadResult

FILE: src/machine/memory/memory_bus.h
  function class (line 33) | class MemoryDataBus : public FrontendMemory {

FILE: src/machine/memory/memory_utils.h
  function namespace (line 12) | namespace machine {
  function ReadResult (line 126) | ReadResult read_by_u32(void *dst, size_t src, size_t size, FUNC data_get...
  function ReadResult (line 149) | ReadResult read_by_u16(void *dst, size_t src, size_t size, FUNC data_get...
  function ReadResult (line 172) | ReadResult read_by_u64(void *dst, size_t src, size_t size, FUNC data_get...
  function WriteResult (line 211) | WriteResult
  function WriteResult (line 239) | WriteResult
  function WriteResult (line 267) | WriteResult
  function RESULT_TYPE (line 313) | RESULT_TYPE repeat_access_until_completed(

FILE: src/machine/memory/tlb/tlb.cpp
  type machine (line 10) | namespace machine {
    function Address (line 109) | Address TLB::translate_virtual_to_physical(AddressWithMode vaddr) {
    function WriteResult (line 176) | WriteResult TLB::write(AddressWithMode dst, const void *src, size_t sz...
    function ReadResult (line 180) | ReadResult TLB::read(void *dst, AddressWithMode src, size_t sz, ReadOp...
    function WriteResult (line 184) | WriteResult TLB::translate_and_write(AddressWithMode dst, const void *...
    function ReadResult (line 189) | ReadResult TLB::translate_and_read(void *dst, AddressWithMode src, siz...
    function TLBConfig (line 225) | const TLBConfig &TLB::get_config() const {

FILE: src/machine/memory/tlb/tlb.h
  function namespace (line 13) | namespace machine {

FILE: src/machine/memory/tlb/tlb_policy.cpp
  type machine (line 8) | namespace machine {
    function make_tlb_policy (line 97) | std::unique_ptr<TLBPolicy>

FILE: src/machine/memory/tlb/tlb_policy.h
  function class (line 13) | class TLBPolicy {
  function TLBPolicyKind (line 65) | enum class TLBPolicyKind { RAND, LRU, LFU, PLRU };

FILE: src/machine/memory/virtual/page_table_walker.cpp
  type machine (line 11) | namespace machine {
    function Address (line 13) | Address PageTableWalker::walk(const VirtualAddress &va, uint32_t raw_s...

FILE: src/machine/memory/virtual/page_table_walker.h
  function namespace (line 10) | namespace machine {

FILE: src/machine/memory/virtual/sv32.h
  function namespace (line 10) | namespace machine {
  function r (line 87) | constexpr bool r() const noexcept { return (raw >> R_SHIFT) & 0x1u; }
  function u (line 90) | constexpr bool u() const noexcept { return (raw >> U_SHIFT) & 0x1u; }
  function d (line 93) | constexpr bool d() const noexcept { return (raw >> D_SHIFT) & 0x1u; }
  function Sv32Pte (line 102) | static constexpr Sv32Pte make(
  function Address (line 128) | inline Address make_phys(uint64_t va_raw, const Sv32Pte &pte, int level) {

FILE: src/machine/memory/virtual/virtual_address.h
  function namespace (line 11) | namespace machine {

FILE: src/machine/pipeline.h
  function namespace (line 26) | namespace machine {
  type DecodeInterstage (line 79) | struct DecodeInterstage {
  type DecodeInternalState (line 128) | struct DecodeInternalState {
  type DecodeState (line 140) | struct DecodeState {
  function DecodeInterstage (line 142) | DecodeInterstage result {}
  function DecodeInterstage (line 143) | DecodeInterstage final {}
  type ExecuteInterstage (line 157) | struct ExecuteInterstage {
  type ExecuteState (line 220) | struct ExecuteState {
  function ExecuteInterstage (line 222) | ExecuteInterstage result {}
  function ExecuteInterstage (line 223) | ExecuteInterstage final {}
  type MemoryInterstage (line 236) | struct MemoryInterstage {
  type MemoryState (line 272) | struct MemoryState {
  function MemoryInterstage (line 274) | MemoryInterstage result {}
  function MemoryInterstage (line 275) | MemoryInterstage final {}
  type WritebackInternalState (line 289) | struct WritebackInternalState {
  type WritebackState (line 298) | struct WritebackState {
  type Pipeline (line 307) | struct Pipeline {

FILE: src/machine/predictor.cpp
  function QStringView (line 7) | QStringView machine::branch_result_to_string(const BranchResult result, ...
  function QStringView (line 15) | QStringView machine::predictor_state_to_string(const PredictorState stat...
  function QStringView (line 27) | QStringView machine::predictor_type_to_string(const PredictorType type) {
  function QStringView (line 39) | QStringView machine::branch_type_to_string(const BranchType type) {
  function QString (line 47) | QString machine::addr_to_hex_str(const machine::Address address) {
  function BranchTargetBufferEntry (line 152) | BranchTargetBufferEntry BranchTargetBuffer::get_entry(const Address inst...
  function BranchResult (line 234) | BranchResult Predictor::convert_state_to_prediction(PredictorState state...
  function BranchResult (line 325) | BranchResult PredictorAlwaysNotTaken::predict(PredictionInput input) {
  function BranchResult (line 339) | BranchResult PredictorAlwaysTaken::predict(PredictionInput input) {
  function BranchResult (line 353) | BranchResult PredictorBTFNT::predict(PredictionInput input) {
  function BranchResult (line 381) | BranchResult PredictorSmith1Bit::predict(PredictionInput input) {
  function BranchResult (line 422) | BranchResult PredictorSmith2Bit::predict(PredictionInput input) {
  function BranchResult (line 486) | BranchResult PredictorSmith2BitHysteresis::predict(PredictionInput input) {
  function PredictorType (line 664) | PredictorType BranchPredictor::get_predictor_type() const {
  function QStringView (line 669) | QStringView BranchPredictor::get_predictor_name() const {
  function PredictorState (line 674) | PredictorState BranchPredictor::get_initial_state() const {
  function PredictionStatistics (line 699) | const PredictionStatistics *BranchPredictor::get_stats() const {
  function Address (line 722) | Address BranchPredictor::predict_next_pc_address(

FILE: src/machine/predictor.h
  function get_register_mask (line 42) | uint16_t get_register_mask() const;
  type PredictionInput (line 98) | struct PredictionInput {
  function bhr_value (line 100) | uint16_t bhr_value { 0 }
  function Address (line 102) | Address target_address { Address::null() };
  type PredictionFeedback (line 105) | struct PredictionFeedback {
  function bhr_value (line 107) | uint16_t bhr_value { 0 }
  function Address (line 109) | Address target_address { Address::null() };
  function virtual (line 145) | virtual PredictorType get_type() const = 0;

FILE: src/machine/predictor_types.h
  type class (line 13) | enum class
  type class (line 20) | enum class
  type class (line 23) | enum class
  type class (line 34) | enum class

FILE: src/machine/programloader.cpp
  class MemLoader (line 22) | class MemLoader : public elf::loader {
    method MemLoader (line 24) | MemLoader(const QString &fname) : file(fname), mapped(nullptr), size(0) {
    method close (line 41) | void close() {
  function Address (line 131) | Address ProgramLoader::end() {
  function Address (line 142) | Address ProgramLoader::get_executable_entry() const {
  function SymbolTable (line 146) | SymbolTable *ProgramLoader::get_symbol_table() {
  function Endian (line 159) | Endian ProgramLoader::get_endian() const {
  function ArchitectureType (line 174) | ArchitectureType ProgramLoader::get_architecture_type() const {

FILE: src/machine/programloader.h
  function namespace (line 14) | namespace machine {

FILE: src/machine/programloader.test.h
  function class (line 6) | class TestProgramLoader : public QObject {

FILE: src/machine/register_value.h
  function namespace (line 8) | namespace machine {
  function other (line 109) | constexpr inline bool operator==(const RegisterValue &other) const {
  function other (line 113) | constexpr inline bool operator!=(const RegisterValue &other) const { ret...

FILE: src/machine/registers.cpp
  function Address (line 24) | Address Registers::read_pc() const {
  function RegisterValue (line 38) | RegisterValue Registers::read_gp(RegisterId reg) const {
  function RegisterValue (line 48) | RegisterValue Registers::read_gp_internal(RegisterId reg) const {

FILE: src/machine/registers.h
  function namespace (line 12) | namespace machine {
  function class (line 52) | class Registers : public QObject {

FILE: src/machine/registers.test.h
  function class (line 6) | class TestRegisters : public QObject {

FILE: src/machine/simulator_exception.cpp
  function QString (line 32) | QString SimulatorException::msg(bool pos) const {

FILE: src/machine/simulator_exception.h
  function namespace (line 7) | namespace machine {

FILE: src/machine/symboltable.cpp
  function QStringList (line 84) | QStringList SymbolTable::names() const {

FILE: src/machine/symboltable.h
  function namespace (line 12) | namespace machine {

FILE: src/machine/tests/utils/integer_decomposition.h
  type IntegerDecomposition (line 28) | struct IntegerDecomposition {
  function rhs (line 47) | constexpr bool operator!=(const IntegerDecomposition &rhs) const { retur...

FILE: src/machine/utils.h
  type byte (line 24) | typedef unsigned char byte;
  function sign_extend (line 26) | inline constexpr uint32_t sign_extend(uint16_t v) {
  function is_aligned_generic (line 52) | bool is_aligned_generic(Address address) {
  function T1 (line 60) | constexpr T1 divide_and_ceil(T1 divident, T2 divisor) {
  function T1 (line 72) | constexpr T1 round_down_to_multiple(T1 n, T2 base) {
  function T1 (line 84) | constexpr T1 round_up_to_multiple(T1 n, T2 base) {

FILE: src/os_emulation/ossyscall.cpp
  function result_errno_if_error (line 497) | uint32_t result_errno_if_error(uint32_t result) {
  function status_from_result (line 504) | int status_from_result(uint32_t result) {
  type mips_syscall_desc_t (line 522) | struct mips_syscall_desc_t {
  type rv_syscall_desc_t (line 528) | struct rv_syscall_desc_t {
  function QString (line 765) | QString OsSyscallExceptionHandler::filepath_to_host(QString path) {

FILE: src/os_emulation/ossyscall.h
  function namespace (line 16) | namespace osemu {

FILE: tests/riscv-official/code/helpers.py
  function max_str_list (line 1) | def max_str_list(list):
  function print_formated_output (line 8) | def print_formated_output(reg_dump):
  function res_translate (line 15) | def res_translate(res):
  function res_print (line 24) | def res_print(test, test_res, test_reg_dump, params):
  function get_RVxx (line 52) | def get_RVxx(tests, isa):

FILE: tests/riscv-official/code/myparse.py
  function init_parser (line 4) | def init_parser():

FILE: tests/riscv-official/code/selftesting.py
  function self_test (line 4) | def self_test(sim_bin, params, src_path, tests):

FILE: tests/riscv-official/code/testing.py
  function test_sim_bin (line 10) | def test_sim_bin(sim_bin):
  function load_filenames (line 22) | def load_filenames(dir_path, rebuild):
  function check_reg_dump (line 45) | def check_reg_dump(reg_dump):
  function run_test (line 57) | def run_test(sim_bin, params, dir_path, filename):
  function run_tests (line 71) | def run_tests(sim_bin, params, dir_path, tests):
  function run_official_tests (line 85) | def run_official_tests(sim_bin, params, src_path, tests):
  function test_selector (line 96) | def test_selector(sim_bin, params, src_path, tests):
  function delete_elf (line 131) | def delete_elf(src_path):

FILE: tests/stud-support/build_tests.py
  function get_toolchain_config (line 33) | def get_toolchain_config(use_clang=False):
  function check_toolchain (line 62) | def check_toolchain(config):
  function build_test (line 69) | def build_test(source_dir, output_name, toolchain, stud_support_root, ou...
  function main (line 162) | def main():

FILE: tests/stud-support/run_tests.py
  function get_register_value (line 109) | def get_register_value(registers, reg_name):
  function verify_result (line 131) | def verify_result(test, result, verbose):
  function run_test (line 162) | def run_test(qtrvsim_cli, test, elf_dir, verbose=False, pipeline=False, ...
  function main (line 179) | def main():
Condensed preview — 380 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,916K chars).
[
  {
    "path": ".github/workflows/debug.yml",
    "chars": 16172,
    "preview": "name: Debug\n\non:\n  push:\n    paths-ignore:\n      - \"**/*.md\"\n      - \"docs/**\"\n  pull_request:\n    paths-ignore:\n      -"
  },
  {
    "path": ".github/workflows/docs.yml",
    "chars": 1542,
    "preview": "name: Docs\n\non:\n  push:\n    branches:\n      - master\n    paths:\n      - \"docs/user/**\"\n      - \".github/workflows/docs.y"
  },
  {
    "path": ".github/workflows/release.yml",
    "chars": 1330,
    "preview": "name: Release\n\non: workflow_dispatch\n\njobs:\n  build:\n    name: ${{ matrix.config.name }}\n    runs-on: ${{ matrix.config."
  },
  {
    "path": ".gitignore",
    "chars": 227,
    "preview": ".*\n!.gitignore\n!.gitmodules\n!.github\n\n# Qt stuff\n*.pro.user*\n*.qbs.user*\n\n# Common test directory\ntest_dir\n# Build direc"
  },
  {
    "path": ".gitmodules",
    "chars": 231,
    "preview": "[submodule \"riscv-tests\"]\n\tpath = tests/riscv-official/riscv-tests\n\turl = https://github.com/riscv-software-src/riscv-te"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 15008,
    "preview": "cmake_minimum_required(VERSION 3.10)\ncmake_policy(VERSION 3.10)\n\nproject(QtRVSim\n        LANGUAGES C CXX\n        VERSION"
  },
  {
    "path": "LICENSE",
    "chars": 35141,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "Makefile",
    "chars": 1221,
    "preview": "include .dev-config.mk\n\n.dev-config.mk:\n\t[ ! -f .dev-config.mk ] && cp .dev-config.mk.default .dev-config.mk\n\nrelease:\n\t"
  },
  {
    "path": "README.md",
    "chars": 25957,
    "preview": "# QtRvSim–RISC-V CPU simulator for education\n\n![QtRvSim screenshot](data/screenshots/intro.webp)\n\nDeveloped by the [Comp"
  },
  {
    "path": "cmake/AddFileHashes.cmake",
    "chars": 662,
    "preview": "# Add file hashes to placeholder location in a template file.\n# Used for packaging.\n#\n# Example:\n# cmake -DTEMPLATE=PKGB"
  },
  {
    "path": "cmake/BuildType.cmake",
    "chars": 771,
    "preview": "# Source (BSD-3) https://github.com/openchemistry/tomviz/blob/master/cmake/BuildType.cmake\n\n# Set a default build type i"
  },
  {
    "path": "cmake/BundleMacOS.cmake",
    "chars": 57,
    "preview": "find_program(MACDEPLOYQT\n             NAMES macdeployqt)\n"
  },
  {
    "path": "cmake/CopyrightTools.cmake",
    "chars": 618,
    "preview": "function(copyright_to_html OUTPUT INPUT)\n\tstring(REPLACE \";\" \"<br>\" TMP1 \"${INPUT}\")\n\tstring(REGEX REPLACE \"<([^<>]+@[^<"
  },
  {
    "path": "cmake/FindElfUtils.cmake",
    "chars": 2114,
    "preview": "# Source (GPLv2): https://github.com/SimonKagstrom/kcov/blob/master/cmake/FindElfutils.cmake\n\n# - Try to find libdwarf\n#"
  },
  {
    "path": "cmake/FindLibElf.cmake",
    "chars": 1854,
    "preview": "# Source (GPLv2): https://github.com/SimonKagstrom/kcov/blob/master/cmake/FindLibElf.cmake\n\n# - Try to find libelf\n# Onc"
  },
  {
    "path": "cmake/FindPythonInterp.cmake",
    "chars": 887,
    "preview": "# Compatibility wrapper for CMake > 3.12 where FindPythonInterp is deprecated/removed\n# This allows external projects us"
  },
  {
    "path": "cmake/GPL-3.0-or-later.cmake",
    "chars": 1446,
    "preview": "# Licence related data to be included in project files\n\nset(LICENCE_IDENTIFIER \"GPL-3.0-or-later\")\nset(LICENCE_SHORT \"\\\n"
  },
  {
    "path": "cmake/LibElfinSettings.cmake",
    "chars": 142,
    "preview": "if(POLICY CMP0148)\n    cmake_policy(SET CMP0148 OLD)\nendif()\n\n# Libelfin requires Threads for dwarf++ library\nfind_packa"
  },
  {
    "path": "cmake/PackageTools.cmake",
    "chars": 4320,
    "preview": "# Support code for package handling.\n# Mainly intended to generate inputs for Open Build Service.\n\n# Keep file propertie"
  },
  {
    "path": "cmake/TestingTools.cmake",
    "chars": 1351,
    "preview": "# Helper functions for integration testing\n\n# Creates a new CLI test. The test consists of two parts: the first runs the"
  },
  {
    "path": "data/cz.cvut.edu.comparch.qtrvsim.metainfo.xml.in",
    "chars": 2889,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- Copyright 2022 David Heidelberg -->\n<component type=\"desktop-application\">\n "
  },
  {
    "path": "data/gui.desktop.in",
    "chars": 252,
    "preview": "[Desktop Entry]\nName=@PROJECT_NAME@\nGenericName=@GENERIC_NAME@\nExec=@MAIN_PROJECT_NAME_LOWER@_gui\nIcon=@MAIN_PROJECT_NAM"
  },
  {
    "path": "data/wasm/browserconfig.xml",
    "chars": 246,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<browserconfig>\n    <msapplication>\n        <tile>\n            <square150x150logo"
  },
  {
    "path": "data/wasm/index.html",
    "chars": 3652,
    "preview": "<!doctype html>\n<!-- BASED ON: qt/5.15.2/wasm_32/plugins/platforms/wasm_shell.html -->\n<html lang=\"en-us\">\n<head>\n    <m"
  },
  {
    "path": "data/wasm/manifest.json",
    "chars": 506,
    "preview": "{\n    \"name\": \"QtRVSim: RISC-V simulator for education\",\n    \"short_name\": \"QtRVSim\",\n    \"icons\": [\n        {\n         "
  },
  {
    "path": "default.nix",
    "chars": 130,
    "preview": "let\n  pkgs = import <nixpkgs> { };\nin\n{\n    qtrvsim = pkgs.libsForQt5.callPackage (import extras/packaging/nix/qtrvsim.n"
  },
  {
    "path": "docs/developer/build&deploy/building-wasm.md",
    "chars": 2630,
    "preview": "# Building and deploying WebAssembly release of the simulator\n\n## Jump start\n\nWASM release is automatically build by the"
  },
  {
    "path": "docs/developer/build&deploy/release.md",
    "chars": 1971,
    "preview": "# Release process\n\n- Check version in root `CMakeLists.txt`\n- Update debian changelog\n- Make sure, CMake was configured "
  },
  {
    "path": "docs/developer/coreview-graphics/using-drawio-diagram.md",
    "chars": 3906,
    "preview": "# Using .drawio diagram\n\nFor easier manipulation the coreview diagrams are created i a diagramming tool [diagrams.net](h"
  },
  {
    "path": "docs/developer/debuging/logging.md",
    "chars": 1763,
    "preview": "# Logging\n\nThe project uses the Qt logging framework. For quick introduction\nsee [this KDAB presentation](https://www.kd"
  },
  {
    "path": "docs/developer/debuging/sanitizers.md",
    "chars": 783,
    "preview": "# Runtime sanitizers\n\n## Using sanitizers in this project\n\nAll debug builds are by default built with address and undefi"
  },
  {
    "path": "docs/developer/need-to-know.md",
    "chars": 1491,
    "preview": "# Need To Know\n\n**Critical information for every developer.**\n\n## Modal Windows, Dialogues, Message Boxes\n\nIn typical, n"
  },
  {
    "path": "docs/user/SUMMARY.md",
    "chars": 548,
    "preview": "# Summary\n\n[Introduction](introduction.md)\n\n# The basics\n\n- [Getting Started](basics/getting_started.md)\n- [First Launch"
  },
  {
    "path": "docs/user/basics/basics_of_user_interface.md",
    "chars": 3735,
    "preview": "# User Interface Overview\n\nAfter selecting a configuration preset (or loading an example) in the initial dialog, the mai"
  },
  {
    "path": "docs/user/basics/first_launch.md",
    "chars": 2461,
    "preview": "# First Launch\n\nWhen you start QtRvSim, or when you select **`File > New Simulation`**, the **Pre-sets and ELF File** di"
  },
  {
    "path": "docs/user/basics/getting_started.md",
    "chars": 3130,
    "preview": "# Getting started\n\n## System Requirements\n\nQtRvSim is built using the Qt framework and supports multiple platforms. Plea"
  },
  {
    "path": "docs/user/basics/menus_and_the_toolbar.md",
    "chars": 7219,
    "preview": "### Menu Bar\n\nThe menu bar provides access to all features of QtRvSim. It is divided into standard menus: **File**, **Ma"
  },
  {
    "path": "docs/user/basics/writing_programs.md",
    "chars": 3141,
    "preview": "# Writing Programs\n\nThis chapter covers how to write and run RISC-V assembly programs in QtRvSim.\n\n## Using the Built-in"
  },
  {
    "path": "docs/user/book.toml",
    "chars": 89,
    "preview": "[book]\ntitle = \"QtRVSim User Manual\"\nauthors = [\"Filip Kraus\"]\nlanguage = \"en\"\nsrc = \".\"\n"
  },
  {
    "path": "docs/user/introduction.md",
    "chars": 1586,
    "preview": "# Introduction\n\nWelcome to the **QtRvSim User Manual**.\n\nQtRvSim is a graphical simulator designed to support learning t"
  },
  {
    "path": "docs/user/reference/advanced_configuration/environment_variables.md",
    "chars": 1420,
    "preview": "# Environment Variables\n\nQtRvSim supports several environment variables to customize its behavior. These are primarily u"
  },
  {
    "path": "docs/user/reference/advanced_configuration.md",
    "chars": 333,
    "preview": "# Advanced Configuration\n\nThis section covers advanced configuration options for QtRvSim, including environment variable"
  },
  {
    "path": "docs/user/reference/external_toolchains.md",
    "chars": 4563,
    "preview": "# External Toolchains\n\nFor more complex programs or C code, you can use an external RISC-V cross-compiler toolchain inst"
  },
  {
    "path": "external/compiler/compile.sh",
    "chars": 723,
    "preview": "#!/usr/bin/env bash\n# This script compiles compilation tools for mips to be used with qtmips\nset -e\n\nINST_PREFIX=\"$(pwd)"
  },
  {
    "path": "external/compiler/config",
    "chars": 9660,
    "preview": "#\n# Automatically generated file; DO NOT EDIT.\n# Crosstool-NG Configuration\n#\nCT_CONFIGURE_has_static_link=y\nCT_CONFIGUR"
  },
  {
    "path": "external/svgscene/CMakeLists.txt",
    "chars": 1965,
    "preview": "cmake_minimum_required(VERSION 3.10)\nproject(svgscene)\n\nset(QT_VERSION_MAJOR \"auto\" CACHE STRING \"Qt major version to us"
  },
  {
    "path": "external/svgscene/LICENSE",
    "chars": 35141,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "external/svgscene/README.md",
    "chars": 539,
    "preview": "# Qt SVG DOM\n\nThis tool parses an SVG file into Qt graphics objects and provides tools to lookup elements based on xml a"
  },
  {
    "path": "external/svgscene/src/example/main.cpp",
    "chars": 274,
    "preview": "#include \"mainwindow.h\"\n#include \"svgscene/utils/logging.h\"\n\n#include <QApplication>\n\nint main(int argc, char *argv[]) {"
  },
  {
    "path": "external/svgscene/src/example/mainwindow.cpp",
    "chars": 1185,
    "preview": "#include \"mainwindow.h\"\n\n#include \"svgscene/components/simpletextitem.h\"\n#include \"svgscene/graphicsview/svggraphicsview"
  },
  {
    "path": "external/svgscene/src/example/mainwindow.h",
    "chars": 624,
    "preview": "#pragma once\n\n#include \"svgscene/components/simpletextitem.h\"\n\n#include <QMainWindow>\n#include <QTimer>\n\nclass QGraphics"
  },
  {
    "path": "external/svgscene/src/example/mainwindow.ui",
    "chars": 2120,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>MainWindow</class>\n <widget class=\"QMainWindow\" name=\""
  },
  {
    "path": "external/svgscene/src/svgscene/components/groupitem.cpp",
    "chars": 155,
    "preview": "#include \"groupitem.h\"\n\n#include <QPainter>\n\nnamespace svgscene {\n\nGroupItem::GroupItem(QGraphicsItem *parent) : Super(p"
  },
  {
    "path": "external/svgscene/src/svgscene/components/groupitem.h",
    "chars": 237,
    "preview": "#pragma once\n\n#include <QGraphicsItem>\n\nnamespace svgscene {\n\nclass GroupItem : public QGraphicsRectItem {\n    using Sup"
  },
  {
    "path": "external/svgscene/src/svgscene/components/hyperlinkitem.cpp",
    "chars": 574,
    "preview": "#include \"hyperlinkitem.h\"\n\n#include \"svgmetadata.h\"\n#include \"utils/logging.h\"\n\nLOG_CATEGORY(\"svgscene.hyperlink\");\n\nna"
  },
  {
    "path": "external/svgscene/src/svgscene/components/hyperlinkitem.h",
    "chars": 579,
    "preview": "#pragma once\n\n#include \"groupitem.h\"\nnamespace svgscene {\n\n/**\n * Represents SVG element <a>.\n *\n * Works exactly as the"
  },
  {
    "path": "external/svgscene/src/svgscene/components/simpletextitem.cpp",
    "chars": 1231,
    "preview": "#include \"simpletextitem.h\"\n\n#include <QPainter>\n\nnamespace svgscene {\n\nSimpleTextItem::SimpleTextItem(const CssAttribut"
  },
  {
    "path": "external/svgscene/src/svgscene/components/simpletextitem.h",
    "chars": 579,
    "preview": "#pragma once\n\n#include \"svgscene/svghandler.h\"\n\n#include <QGraphicsItem>\n\nnamespace svgscene {\n\nclass SimpleTextItem : p"
  },
  {
    "path": "external/svgscene/src/svgscene/graphicsview/svggraphicsview.cpp",
    "chars": 2648,
    "preview": "#include \"svggraphicsview.h\"\n\n#include \"polyfills/qt5/qwheelevent.h\"\n#include \"utils/logging.h\"\n\n#include <QWheelEvent>\n"
  },
  {
    "path": "external/svgscene/src/svgscene/graphicsview/svggraphicsview.h",
    "chars": 618,
    "preview": "#pragma once\n\n#include <QGraphicsView>\n\nclass SvgGraphicsView : public QGraphicsView {\n    Q_OBJECT\n\n    using Super = Q"
  },
  {
    "path": "external/svgscene/src/svgscene/polyfills/qt5/qstringview.h",
    "chars": 98,
    "preview": "#pragma once\n\n#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)\n    using QStringView = QString;\n#endif\n"
  },
  {
    "path": "external/svgscene/src/svgscene/polyfills/qt5/qwheelevent.h",
    "chars": 292,
    "preview": "#pragma once\n\n#include <QWheelEvent>\n\nclass QWheelEvent_poly final : public QWheelEvent {\npublic:\n    explicit QWheelEve"
  },
  {
    "path": "external/svgscene/src/svgscene/svgdocument.cpp",
    "chars": 212,
    "preview": "#include \"svgdocument.h\"\n\nnamespace svgscene {\n\nSvgDomTree<QGraphicsItem> SvgDocument::getRoot() const {\n    return root"
  },
  {
    "path": "external/svgscene/src/svgscene/svgdocument.h",
    "chars": 5129,
    "preview": "#pragma once\n\n#include \"svgmetadata.h\"\n\n#include <QGraphicsItem>\n\nnamespace svgscene {\n\ntemplate<typename TT>\nclass SvgD"
  },
  {
    "path": "external/svgscene/src/svgscene/svggraphicsscene.cpp",
    "chars": 710,
    "preview": "#include \"svggraphicsscene.h\"\n\n#include \"components/hyperlinkitem.h\"\n\n#include <QGraphicsItem>\n#include <QGraphicsSceneM"
  },
  {
    "path": "external/svgscene/src/svgscene/svggraphicsscene.h",
    "chars": 550,
    "preview": "#pragma once\n\n#include <QGraphicsScene>\n\nnamespace svgscene {\n\n/**\n * Graphics scene with extended support for SVG.\n *\n "
  },
  {
    "path": "external/svgscene/src/svgscene/svghandler.cpp",
    "chars": 49081,
    "preview": "#include \"svghandler.h\"\n\n#include \"components/groupitem.h\"\n#include \"components/hyperlinkitem.h\"\n#include \"components/s"
  },
  {
    "path": "external/svgscene/src/svgscene/svghandler.h",
    "chars": 2588,
    "preview": "#pragma once\n\n#include \"svgdocument.h\"\n#include \"svgmetadata.h\"\n\n#include <QFile>\n#include <QMap>\n#include <QPen>\n#incl"
  },
  {
    "path": "external/svgscene/src/svgscene/svgmetadata.cpp",
    "chars": 1974,
    "preview": "#include \"svgmetadata.h\"\n\nnamespace svgscene {\n\nXmlAttributes getXmlAttributes(const QGraphicsItem *element) {\n    QVari"
  },
  {
    "path": "external/svgscene/src/svgscene/svgmetadata.h",
    "chars": 1019,
    "preview": "#pragma once\n\n#include <QGraphicsItem>\n#include <QMap>\n#include <QString>\n\nnamespace svgscene {\n\n/*\n * Fields that can b"
  },
  {
    "path": "external/svgscene/src/svgscene/svgspec.h",
    "chars": 1538,
    "preview": "\n#ifndef SVGSCENE_SVG_SPEC_H\n#define SVGSCENE_SVG_SPEC_H\n\n#include <QSet>\n\nnamespace svgspec {\n\n/**\n * https://developer"
  },
  {
    "path": "external/svgscene/src/svgscene/utils/logging.h",
    "chars": 1223,
    "preview": "#pragma once\n\n/**\n * Wrapper for QT logging library.\n *\n * Each source file is expected to declare a log category name w"
  },
  {
    "path": "external/svgscene/src/svgscene/utils/memory_ownership.h",
    "chars": 411,
    "preview": "/**\n * Manual memory ownership toolkit.\n */\n#pragma once\n\n#include <QScopedPointer>\n\n/**\n * Tag for pointer owned by som"
  },
  {
    "path": "extras/building/build-wasm.sh",
    "chars": 507,
    "preview": "#!/usr/bin/env bash\n\nset -eu\n\nEMSCRIPTEN_VERSION=$1\nQT_WASM=$2\nEMSDK_PATH=$3\n\n# If you know how to do this better, pleas"
  },
  {
    "path": "extras/core_graphics/diagram.drawio",
    "chars": 172026,
    "preview": "<mxfile host=\"app.diagrams.net\" modified=\"2023-06-29T14:37:58.075Z\" agent=\"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gec"
  },
  {
    "path": "extras/crosscompiling/shell-mips-elf.nix",
    "chars": 192,
    "preview": "# Provides shell with a crosscompiler for code to simulate\nwith import <nixpkgs> {\n  crossSystem = {\n    config = \"mips-"
  },
  {
    "path": "extras/crosscompiling/shell-riscv-elf-with-newlib.nix",
    "chars": 246,
    "preview": "# Provides shell with a crosscompiler for code to simulate\nwith import <nixpkgs> {\n  crossSystem = {\n    config = \"riscv"
  },
  {
    "path": "extras/crosscompiling/shell-riscv-elf.nix",
    "chars": 123,
    "preview": "# Provides shell with a crosscompiler for code to simulate\nwith import <nixpkgs> {};\npkgsCross.riscv64-embedded.mkShell "
  },
  {
    "path": "extras/packaging/_tools/add-to-changelog.sh",
    "chars": 1244,
    "preview": "#!/usr/bin/env bash\n\nCHANGELOG_FILE=\"extras/packaging/deb/debian/changelog\"\n\nif [ $# -lt 1 ]; then\n  echo \"Version has t"
  },
  {
    "path": "extras/packaging/_tools/git-archive-submodules.sh",
    "chars": 1831,
    "preview": "#!/usr/bin/env bash\n\nset -eu\n\n# Tool to crate source archive including submodules\n# based on (MIT): https://github.com/n"
  },
  {
    "path": "extras/packaging/add-to-changelog.sh",
    "chars": 2138,
    "preview": "#!/usr/bin/env bash\n\nCHANGELOG_FILE=\"extras/packaging/deb/debian/changelog\"\nMAIN_PROJECT_NAME_LOWER=\"qtrvsim\"\n\nif false "
  },
  {
    "path": "extras/packaging/appimage/appimage.yml.in",
    "chars": 671,
    "preview": "app: @PACKAGE_NAME@\n\nbuild:\n  packages:\n    - linuxdeployqt\n    - pkgconfig(Qt5Core)\n    - pkgconfig(Qt5Widgets)\n    - p"
  },
  {
    "path": "extras/packaging/arch/PKGBUILD.in",
    "chars": 662,
    "preview": "# Maintainer: @PACKAGE_MAINTAINER@\npkgname=@PACKAGE_NAME@\npkgver=@PROJECT_VERSION@\npkgrel=1\npkgdesc=\"@PACKAGE_DESCRIPTIO"
  },
  {
    "path": "extras/packaging/deb/debian/changelog",
    "chars": 13970,
    "preview": "qtrvsim (0.9.8-1) unstable; urgency=medium\n\n  * Machine: aclintmtimer fix count type\n  * GUI: fix a crash on nonexistent"
  },
  {
    "path": "extras/packaging/deb/debian/compat",
    "chars": 2,
    "preview": "9\n"
  },
  {
    "path": "extras/packaging/deb/debian/control.in",
    "chars": 403,
    "preview": "Source: @PACKAGE_NAME@\nSection: devel\nPriority: optional\nMaintainer: @PACKAGE_MAINTAINER@\nBuild-Depends: debhelper (>= 9"
  },
  {
    "path": "extras/packaging/deb/debian/copyright",
    "chars": 1006,
    "preview": "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/\nUpstream-Name: qtrvsim\nSource: https://github."
  },
  {
    "path": "extras/packaging/deb/debian/docs",
    "chars": 14,
    "preview": "README.md\ndocs"
  },
  {
    "path": "extras/packaging/deb/debian/rules",
    "chars": 226,
    "preview": "#!/usr/bin/make -f\n# -*- makefile -*-\n\nexport DH_VERBOSE = 1\n\nexport DEB_BUILD_MAINT_OPTIONS=hardening=+all\nexport DEB_L"
  },
  {
    "path": "extras/packaging/deb/debian/source/format",
    "chars": 12,
    "preview": "3.0 (quilt)\n"
  },
  {
    "path": "extras/packaging/deb/dsc.in",
    "chars": 744,
    "preview": "Format: 3.0 (quilt)\nSource: @PACKAGE_NAME@\nBinary: @PACKAGE_NAME@\nArchitecture: any\nVersion: @PACKAGE_VERSION@-@PACKAGE_"
  },
  {
    "path": "extras/packaging/flatpak/cz.cvut.edu.comparch.qtrvsim.json",
    "chars": 856,
    "preview": "{\n    \"app-id\" : \"cz.cvut.edu.comparch.qtrvsim\",\n    \"runtime\" : \"org.kde.Platform\",\n    \"runtime-version\" : \"6.2\",\n    "
  },
  {
    "path": "extras/packaging/mingw/cmake-i686-w64-mingw32.conf",
    "chars": 660,
    "preview": "# cmake -DCMAKE_TOOLCHAIN_FILE=cmake-i686-w64-mingw32.conf -DCMAKE_BUILD_TYPE=Release ../qtrvsim\n\nset(CMAKE_SYSTEM_NAME "
  },
  {
    "path": "extras/packaging/nix/qtrvsim.nix",
    "chars": 671,
    "preview": "{ lib, stdenv, cmake, wrapQtAppsHook, qtbase, qtsvg }:\nstdenv.mkDerivation {\n    name = \"QtRVSim\";\n    src = builtins.fe"
  },
  {
    "path": "extras/packaging/rpm/spec.in",
    "chars": 2342,
    "preview": "#\n# spec file for package @PACKAGE_NAME@\n#\n@COPYRIGHT_HASH_COMMENT@\n#\n# This program is free software: you can redistrib"
  },
  {
    "path": "qtlogging.ini",
    "chars": 21,
    "preview": "[Rules]\n*.debug=false"
  },
  {
    "path": "src/assembler/CMakeLists.txt",
    "chars": 429,
    "preview": "project(assembler\n        DESCRIPTION \"Simple assembler library to use in the UI.\")\n\nset(CMAKE_AUTOMOC ON)\n\nset(assemble"
  },
  {
    "path": "src/assembler/fixmatheval.cpp",
    "chars": 11416,
    "preview": "#include \"fixmatheval.h\"\n\n#include \"common/math/bit_ops.h\"\n#include \"memory/address.h\"\n\n#include <climits>\n#include <uti"
  },
  {
    "path": "src/assembler/fixmatheval.h",
    "chars": 2863,
    "preview": "#ifndef FIXMATHEVAL_H\n#define FIXMATHEVAL_H\n\n#include \"memory/address.h\"\n\n#include <QString>\n\nnamespace fixmatheval {\n\nt"
  },
  {
    "path": "src/assembler/messagetype.h",
    "chars": 189,
    "preview": "#ifndef MESSAGETYPE_H\n#define MESSAGETYPE_H\n\nnamespace messagetype {\n\nenum Type {\n    MSG_START,\n    MSG_FINISH,\n    MSG"
  },
  {
    "path": "src/assembler/simpleasm.cpp",
    "chars": 24179,
    "preview": "#include \"simpleasm.h\"\n\n#include \"machine/memory/address.h\"\n#include \"machine/memory/memory_utils.h\"\n\n#include <QDir>\n#i"
  },
  {
    "path": "src/assembler/simpleasm.h",
    "chars": 2076,
    "preview": "#ifndef SIMPLEASM_H\n#define SIMPLEASM_H\n\n#include \"fixmatheval.h\"\n#include \"machine/machine.h\"\n#include \"machine/memory/"
  },
  {
    "path": "src/cli/CMakeLists.txt",
    "chars": 3359,
    "preview": "project(cli\n        LANGUAGES C CXX\n        VERSION ${MAIN_PROJECT_VERSION}\n        DESCRIPTION \"Simulator command-line "
  },
  {
    "path": "src/cli/chariohandler.cpp",
    "chars": 3035,
    "preview": "#include \"chariohandler.h\"\n\nCharIOHandler::CharIOHandler(QIODevice *iodev, QObject *parent) : QIODevice(parent), fd_list"
  },
  {
    "path": "src/cli/chariohandler.h",
    "chars": 1443,
    "preview": "#ifndef CHARIOHANDLER_H\n#define CHARIOHANDLER_H\n\n#include <QIODevice>\n#include <QObject>\n#include <QSet>\n\nclass CharIOHa"
  },
  {
    "path": "src/cli/main.cpp",
    "chars": 27166,
    "preview": "#include \"assembler/simpleasm.h\"\n#include \"chariohandler.h\"\n#include \"common/logging.h\"\n#include \"common/logging_format_"
  },
  {
    "path": "src/cli/msgreport.cpp",
    "chars": 763,
    "preview": "#include \"msgreport.h\"\n\n#include <iostream>\n\nusing namespace std;\n\nMsgReport::MsgReport(QCoreApplication *app) : Super(a"
  },
  {
    "path": "src/cli/msgreport.h",
    "chars": 526,
    "preview": "#ifndef MSGREPORT_H\n#define MSGREPORT_H\n\n#include \"assembler/messagetype.h\"\n\n#include <QCoreApplication>\n#include <QObje"
  },
  {
    "path": "src/cli/reporter.cpp",
    "chars": 10558,
    "preview": "#include \"reporter.h\"\n\n#include <cinttypes>\n\nusing namespace machine;\nusing namespace std;\n\nReporter::Reporter(QCoreAppl"
  },
  {
    "path": "src/cli/reporter.h",
    "chars": 2546,
    "preview": "#ifndef REPORTER_H\n#define REPORTER_H\n\n#include \"common/memory_ownership.h\"\n#include \"machine/machine.h\"\n\n#include <QCor"
  },
  {
    "path": "src/cli/tracer.cpp",
    "chars": 2160,
    "preview": "#include \"tracer.h\"\n\n#include <cinttypes>\n\nusing namespace machine;\n\nTracer::Tracer(Machine *machine) : core_state(machi"
  },
  {
    "path": "src/cli/tracer.h",
    "chars": 861,
    "preview": "#ifndef TRACER_H\n#define TRACER_H\n\n#include \"machine/instruction.h\"\n#include \"machine/machine.h\"\n#include \"machine/memor"
  },
  {
    "path": "src/common/CMakeLists.txt",
    "chars": 1001,
    "preview": "project(common\n\t\tDESCRIPTION \"Utils shared between multiple subprojects.\")\n\nadd_subdirectory(polyfills)\n\nset(common_HEAD"
  },
  {
    "path": "src/common/containers/cvector.h",
    "chars": 3036,
    "preview": "/*\n * Based on:\n * Frozen\n * Copyright 2016 QuarksLab\n *\n * Licensed to the Apache Software Foundation (ASF) under one\n "
  },
  {
    "path": "src/common/endian.h",
    "chars": 1962,
    "preview": "#ifndef ENDIAN_H\n#define ENDIAN_H\n\n#include \"polyfills/byteswap.h\"\n#include \"polyfills/endian_detection.h\"\n#include \"uti"
  },
  {
    "path": "src/common/logging.h",
    "chars": 1256,
    "preview": "/**\n * Wrapper for QT logging library.\n *\n * Each source file is expected to declare a log category name what is\n * impl"
  },
  {
    "path": "src/common/logging_format_colors.h",
    "chars": 504,
    "preview": "#ifndef LOGGING_FORMAT_COLORS_H\n#define LOGGING_FORMAT_COLORS_H\n\n#include <QtGlobal>\n\nstatic void set_default_log_patter"
  },
  {
    "path": "src/common/math/bit_ops.h",
    "chars": 1436,
    "preview": "/**\n * Bit manipulation library\n *\n * @file\n */\n\n#ifndef QTRVSIM_BIT_OPS_H\n#define QTRVSIM_BIT_OPS_H\n\n#include <cassert>"
  },
  {
    "path": "src/common/memory_ownership.h",
    "chars": 572,
    "preview": "/**\n * Manual memory ownership toolkit.\n */\n#ifndef QTRVSIM_MEMORY_OWNERSHIP_H\n#define QTRVSIM_MEMORY_OWNERSHIP_H\n\n#incl"
  },
  {
    "path": "src/common/polyfills/CMakeLists.txt",
    "chars": 1142,
    "preview": "project(polyfills\n\t\tDESCRIPTION \"Helper code to unify access to compiler intrinsics and\n                     provide fal"
  },
  {
    "path": "src/common/polyfills/byteswap.h",
    "chars": 1741,
    "preview": "#ifndef BYTESWAP_H\n#define BYTESWAP_H\n\n/* Define byte-swap functions, using fast processor-native built-ins where\n * pos"
  },
  {
    "path": "src/common/polyfills/clz32.h",
    "chars": 762,
    "preview": "#ifndef CLZ32_H\n#define CLZ32_H\n\n#if defined(__GNUC__) && __GNUC__ >= 4\n\nstatic inline uint32_t clz32(uint32_t n) {\n    "
  },
  {
    "path": "src/common/polyfills/endian_detection.h",
    "chars": 3627,
    "preview": "#ifndef ENDIAN_DETECTION_H\n#define ENDIAN_DETECTION_H\n/**\n * Including this file ensures that GCC macros `__LITTLE_ENDIA"
  },
  {
    "path": "src/common/polyfills/mulh64.h",
    "chars": 4464,
    "preview": "/**\n * Provides set of functions to calculate high bits of 64 bit multiplication.\n * Naming reflects RISC-V specs.\n *\n *"
  },
  {
    "path": "src/common/polyfills/mulh64.test.cpp",
    "chars": 1721,
    "preview": "#include \"mulh64.h\"\n\n#include \"mulh64.test.h\"\n\nvoid TestMULH64::test_mulh64() {\n    QCOMPARE(mulh64(15, 10), (uint64_t)0"
  },
  {
    "path": "src/common/polyfills/mulh64.test.h",
    "chars": 400,
    "preview": "#ifndef MULH64_TEST_H\n#define MULH64_TEST_H\n\n#include <QtTest/QTest>\n#include <cstdint>\n\nclass TestMULH64 : public QObje"
  },
  {
    "path": "src/common/polyfills/qstring_hash.h",
    "chars": 644,
    "preview": "#ifndef QTRVSIM_QSTRING_HASH_H\n#define QTRVSIM_QSTRING_HASH_H\n\n#include <QHash>\n#include <QtGlobal>\n\n#if QT_VERSION < QT"
  },
  {
    "path": "src/common/polyfills/qt5/qfontmetrics.h",
    "chars": 335,
    "preview": "#ifndef POLYFILLS_QFONTMETRICS_H\n#define POLYFILLS_QFONTMETRICS_H\n\nint QFontMetrics_horizontalAdvance(const QFontMetrics"
  },
  {
    "path": "src/common/polyfills/qt5/qlinef.h",
    "chars": 362,
    "preview": "#ifndef POLYFILLS_QLINEF_H\n#define POLYFILLS_QLINEF_H\n\n#include <QLine>\n\nQLineF::IntersectType\nQLineF_intersect(const QL"
  },
  {
    "path": "src/common/polyfills/qt5/qtableview.h",
    "chars": 536,
    "preview": "#ifndef POLYFILLS_QTABLEVIEW_H\n#define POLYFILLS_QTABLEVIEW_H\n\n#include <QTableView>\n\n/**\n * QTableView polyfill\n *\n * i"
  },
  {
    "path": "src/common/string_utils.h",
    "chars": 344,
    "preview": "#ifndef QTRVSIM_STRING_UTILS_H\n#define QTRVSIM_STRING_UTILS_H\n\n#include <QString>\n\nnamespace str {\ntemplate<typename T>\n"
  },
  {
    "path": "src/common/type_utils/lens.h",
    "chars": 1464,
    "preview": "/**\n * Tiny lenses library\n *\n * TL;DR: Getter function which works on nested structs.\n *\n * Example:\n * ```\n *  struct "
  },
  {
    "path": "src/gui/CMakeLists.txt",
    "chars": 6477,
    "preview": "project(gui\n        LANGUAGES C CXX\n        VERSION ${MAIN_PROJECT_VERSION}\n        DESCRIPTION \"Graphical UI for the si"
  },
  {
    "path": "src/gui/dialogs/about/aboutdialog.cpp",
    "chars": 2732,
    "preview": "#include \"aboutdialog.h\"\n\n#include \"project_info.h\"\n\n#include <QApplication>\n#include <QLabel>\n#include <QObject>\n#inclu"
  },
  {
    "path": "src/gui/dialogs/about/aboutdialog.h",
    "chars": 314,
    "preview": "#ifndef ABOUTDIALOG_H\n#define ABOUTDIALOG_H\n\n#include <QDialog>\n#include <QVBoxLayout>\n#include <array>\n#include <random"
  },
  {
    "path": "src/gui/dialogs/gotosymbol/gotosymboldialog.cpp",
    "chars": 949,
    "preview": "#include \"gotosymboldialog.h\"\n\n#include \"ui_gotosymboldialog.h\"\n\nGoToSymbolDialog::GoToSymbolDialog(QWidget *parent, con"
  },
  {
    "path": "src/gui/dialogs/gotosymbol/gotosymboldialog.h",
    "chars": 673,
    "preview": "#ifndef GOTOSYMBOLDIALOG_H\n#define GOTOSYMBOLDIALOG_H\n\n#include \"common/memory_ownership.h\"\n#include \"machine/memory/add"
  },
  {
    "path": "src/gui/dialogs/gotosymbol/gotosymboldialog.ui",
    "chars": 2295,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>GoToSymbolDialog</class>\n <widget class=\"QDialog\" name"
  },
  {
    "path": "src/gui/dialogs/new/NewDialog.ui",
    "chars": 43088,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>NewDialog</class>\n <widget class=\"QDialog\" name=\"NewDi"
  },
  {
    "path": "src/gui/dialogs/new/NewDialogCache.ui",
    "chars": 4100,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>NewDialogCache</class>\n <widget class=\"QWidget\" name=\""
  },
  {
    "path": "src/gui/dialogs/new/newdialog.cpp",
    "chars": 31179,
    "preview": "#include \"newdialog.h\"\n\n#include \"helper/async_modal.h\"\n#include \"machine/simulator_exception.h\"\n#include \"mainwindow/ma"
  },
  {
    "path": "src/gui/dialogs/new/newdialog.h",
    "chars": 3117,
    "preview": "#ifndef NEWDIALOG_H\n#define NEWDIALOG_H\n\n#include \"common/memory_ownership.h\"\n#include \"machine/machineconfig.h\"\n#includ"
  },
  {
    "path": "src/gui/dialogs/savechanged/savechangeddialog.cpp",
    "chars": 2681,
    "preview": "#include \"savechangeddialog.h\"\n\n#include <QLabel>\n#include <QListView>\n#include <QPlainTextEdit>\n#include <QPushButton>\n"
  },
  {
    "path": "src/gui/dialogs/savechanged/savechangeddialog.h",
    "chars": 518,
    "preview": "#ifndef SAVECHANGED_H\n#define SAVECHANGED_H\n\n#include <QDialog>\n#include <QList>\n#include <QStandardItemModel>\n#include "
  },
  {
    "path": "src/gui/extprocess.cpp",
    "chars": 2563,
    "preview": "#include \"extprocess.h\"\n\n#include <QDir>\n#include <QFileInfo>\n\nusing namespace std;\n\nExtProcess::ExtProcess(QObject *par"
  },
  {
    "path": "src/gui/extprocess.h",
    "chars": 637,
    "preview": "#ifndef MSGREPORT_H\n#define MSGREPORT_H\n\n#include \"assembler/messagetype.h\"\n\n#include <QProcess>\n#include <QString>\n\ncla"
  },
  {
    "path": "src/gui/fontsize.cpp",
    "chars": 516,
    "preview": "#include \"fontsize.h\"\n\n#include \"common/logging.h\"\n\n#include <QApplication>\n#include <QFont>\n#include <QFontMetrics>\n\nLO"
  },
  {
    "path": "src/gui/fontsize.h",
    "chars": 198,
    "preview": "#ifndef FONTSIZES_H\n#define FONTSIZES_H\n\nstruct FontSize {\n    static int SIZE5;\n    static int SIZE6;\n    static int SI"
  },
  {
    "path": "src/gui/graphicsview.cpp",
    "chars": 2008,
    "preview": "#include \"graphicsview.h\"\n\nGraphicsView::GraphicsView(QWidget *parent) : Super(parent) {\n    prev_height = 0;\n    prev_w"
  },
  {
    "path": "src/gui/graphicsview.h",
    "chars": 622,
    "preview": "#ifndef GRAPHICSVIEW_H\n#define GRAPHICSVIEW_H\n\n#include <QGraphicsScene>\n#include <QGraphicsView>\n#include <QKeyEvent>\n#"
  },
  {
    "path": "src/gui/helper/async_modal.h",
    "chars": 1411,
    "preview": "/**\n * This file provides API for modal windows (dialogs, message boxes) which runs asynchronously\n * and therefore is s"
  },
  {
    "path": "src/gui/hinttabledelegate.cpp",
    "chars": 549,
    "preview": "#include \"hinttabledelegate.h\"\n\n#include <QApplication>\n\nQSize HintTableDelegate::sizeHintForText(\n    const QStyleOptio"
  },
  {
    "path": "src/gui/hinttabledelegate.h",
    "chars": 491,
    "preview": "#ifndef HINTTABLEDELEGATE_H\n#define HINTTABLEDELEGATE_H\n\n#include <QObject>\n#include <QStyledItemDelegate>\n\nclass HintTa"
  },
  {
    "path": "src/gui/main.cpp",
    "chars": 1363,
    "preview": "#include \"common/logging.h\"\n#include \"common/logging_format_colors.h\"\n#include \"mainwindow/mainwindow.h\"\n\n#include <QApp"
  },
  {
    "path": "src/gui/mainwindow/MainWindow.ui",
    "chars": 19293,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>MainWindow</class>\n <widget class=\"QMainWindow\" name=\""
  },
  {
    "path": "src/gui/mainwindow/mainwindow.cpp",
    "chars": 36283,
    "preview": "#include \"mainwindow.h\"\n\n#include \"assembler/fixmatheval.h\"\n#include \"assembler/simpleasm.h\"\n#include \"dialogs/about/abo"
  },
  {
    "path": "src/gui/mainwindow/mainwindow.h",
    "chars": 5895,
    "preview": "#ifndef MAINWINDOW_H\n#define MAINWINDOW_H\n\n#ifdef WITH_PRINTING\n    #include <QPrintDialog>\n    #include <QPrinter>\n#en"
  },
  {
    "path": "src/gui/qhtml5file.h",
    "chars": 2322,
    "preview": "/****************************************************************************\n**\n** Copyright (C) 2018 The Qt Company Lt"
  },
  {
    "path": "src/gui/qhtml5file_html5.cpp",
    "chars": 9117,
    "preview": "/****************************************************************************\n**\n** Copyright (C) 2018 The Qt Company Lt"
  },
  {
    "path": "src/gui/resources/icons/icons.qrc",
    "chars": 622,
    "preview": "<RCC>\n    <qresource prefix=\"/icons/\">\n        <file>gui.png</file>\n        <file>application-exit.png</file>\n        <f"
  },
  {
    "path": "src/gui/resources/samples/samples.qrc",
    "chars": 171,
    "preview": "<RCC>\n    <qresource prefix=\"/samples/\">\n        <file>simple-lw-sw-ia.S</file>\n        <file>template.S</file>\n        "
  },
  {
    "path": "src/gui/resources/samples/simple-lw-sw-ia.S",
    "chars": 925,
    "preview": "//  Template file with simple memory example\n//  QtRVSim simulator https://github.com/cvut/qtrvsim/\n//\n//  template-os.S"
  },
  {
    "path": "src/gui/resources/samples/template-os.S",
    "chars": 2591,
    "preview": "//  Template file with defines of system calls\n//  QtRVSim simulator https://github.com/cvut/qtrvsim/\n//\n//  template-os"
  },
  {
    "path": "src/gui/resources/samples/template.S",
    "chars": 4908,
    "preview": "//  Template file with defines of peripheral registers\n//  QtRVSim simulator https://github.com/cvut/qtrvsim/\n//\n//  tem"
  },
  {
    "path": "src/gui/statictable.cpp",
    "chars": 10069,
    "preview": "#include \"statictable.h\"\n\n#include \"machine/simulator_exception.h\"\n\n#include <QPainter>\n\nStaticTableLayout::StaticTableL"
  },
  {
    "path": "src/gui/statictable.h",
    "chars": 3268,
    "preview": "#ifndef STATICTABLE_H\n#define STATICTABLE_H\n\n#include <QLayout>\n#include <QList>\n#include <QVector>\n#include <QWidget>\n\n"
  },
  {
    "path": "src/gui/textsignalaction.cpp",
    "chars": 1381,
    "preview": "#include \"textsignalaction.h\"\n\n#include <QApplication>\n#include <utility>\n\nTextSignalAction::TextSignalAction(QObject *p"
  },
  {
    "path": "src/gui/textsignalaction.h",
    "chars": 826,
    "preview": "#ifndef TEXTSIGNALACTION_H\n#define TEXTSIGNALACTION_H\n\n#include <QAction>\n#include <QObject>\n\nclass TextSignalAction : p"
  },
  {
    "path": "src/gui/ui/hexlineedit.cpp",
    "chars": 1305,
    "preview": "#include \"hexlineedit.h\"\n\nHexLineEdit::HexLineEdit(QWidget *parent, int digits, int base, const QString &prefix)\n    : S"
  },
  {
    "path": "src/gui/ui/hexlineedit.h",
    "chars": 586,
    "preview": "#ifndef HEXLINEEDIT_H\n#define HEXLINEEDIT_H\n\n#include <QLineEdit>\n#include <QObject>\n\nclass HexLineEdit : public QLineEd"
  },
  {
    "path": "src/gui/ui/pow2spinbox.cpp",
    "chars": 1872,
    "preview": "#include \"pow2spinbox.h\"\n\nPow2SpinBox::Pow2SpinBox(QWidget *parent) : QSpinBox(parent) {\n    setRange(1, 1024);\n    setV"
  },
  {
    "path": "src/gui/ui/pow2spinbox.h",
    "chars": 462,
    "preview": "#ifndef POW2SPINBOX_H\n#define POW2SPINBOX_H\n\n#include <QSpinBox>\n#include <QValidator>\n\nclass Pow2SpinBox : public QSpin"
  },
  {
    "path": "src/gui/widgets/hidingtabwidget.cpp",
    "chars": 606,
    "preview": "#include \"hidingtabwidget.h\"\n\nvoid HidingTabWidget::tabInserted(int index) {\n    QTabWidget::tabInserted(index);\n    if "
  },
  {
    "path": "src/gui/widgets/hidingtabwidget.h",
    "chars": 631,
    "preview": "#ifndef HIDINGTABWIDGET_H\n#define HIDINGTABWIDGET_H\n\n#include <QObject>\n#include <QTabWidget>\n\n/** A widget that hides i"
  },
  {
    "path": "src/gui/windows/cache/cachedock.cpp",
    "chars": 3972,
    "preview": "#include \"cachedock.h\"\n\nCacheDock::CacheDock(QWidget *parent, const QString &type) : QDockWidget(parent) {\n    top_widge"
  },
  {
    "path": "src/gui/windows/cache/cachedock.h",
    "chars": 1217,
    "preview": "#ifndef CACHEDOCK_H\n#define CACHEDOCK_H\n\n#include \"cacheview.h\"\n#include \"graphicsview.h\"\n#include \"machine/machine.h\"\n\n"
  },
  {
    "path": "src/gui/windows/cache/cacheview.cpp",
    "chars": 14063,
    "preview": "#include \"cacheview.h\"\n\n#include \"fontsize.h\"\n\n#include <QtAlgorithms>\n#include <cmath>\n\n//////////////////////\n#define "
  },
  {
    "path": "src/gui/windows/cache/cacheview.h",
    "chars": 1980,
    "preview": "#ifndef CACHEVIEW_H\n#define CACHEVIEW_H\n\n#include \"common/endian.h\"\n#include \"graphicsview.h\"\n#include \"machine/machine."
  },
  {
    "path": "src/gui/windows/coreview/components/cache.cpp",
    "chars": 554,
    "preview": "#include \"cache.h\"\n\nCache::Cache(\n    const machine::Cache *cache,\n    svgscene::SimpleTextItem *hit_text,\n    svgscene:"
  },
  {
    "path": "src/gui/windows/coreview/components/cache.h",
    "chars": 603,
    "preview": "#ifndef QTRVSIM_CACHE_H\n#define QTRVSIM_CACHE_H\n\n#include <QObject>\n#include <memory/cache/cache.h>\n#include <svgscene/c"
  },
  {
    "path": "src/gui/windows/coreview/components/value_handlers.cpp",
    "chars": 2656,
    "preview": "#include \"value_handlers.h\"\n\n#include <QGraphicsPathItem>\n\nusing svgscene::SimpleTextItem;\n\nconst QString BoolValue::COM"
  },
  {
    "path": "src/gui/windows/coreview/components/value_handlers.h",
    "chars": 3874,
    "preview": "/**\n * Components defined in here update the GUI placeholders with up to date\n * values that is read from provided sourc"
  },
  {
    "path": "src/gui/windows/coreview/data.h",
    "chars": 11647,
    "preview": "/**\n * This file contains maps with data for core visualization.\n * - Tables of strings.\n * - Maps of string hook used i"
  },
  {
    "path": "src/gui/windows/coreview/scene.cpp",
    "chars": 10765,
    "preview": "#include \"scene.h\"\n\n#include \"common/logging.h\"\n#include \"data.h\"\n#include \"machine/core.h\"\n\n#include <svgscene/componen"
  },
  {
    "path": "src/gui/windows/coreview/scene.h",
    "chars": 3872,
    "preview": "#ifndef QTRVSIM_SCENE_H\n#define QTRVSIM_SCENE_H\n\n#include \"./components/cache.h\"\n#include \"./components/value_handlers.h"
  },
  {
    "path": "src/gui/windows/coreview/schemas/schemas.qrc",
    "chars": 163,
    "preview": "<RCC>\n    <qresource prefix=\"/core\">\n        <file>simple.svg</file>\n        <file>pipeline.svg</file>\n        <file>for"
  },
  {
    "path": "src/gui/windows/csr/csrdock.cpp",
    "chars": 4566,
    "preview": "#include \"csrdock.h\"\n\n#include \"csr/controlstate.h\"\n\nCsrDock::CsrDock(QWidget *parent)\n    : QDockWidget(parent)\n    , x"
  },
  {
    "path": "src/gui/windows/csr/csrdock.h",
    "chars": 1277,
    "preview": "#ifndef CSRDOCK_H\n#define CSRDOCK_H\n\n#include \"machine/csr/controlstate.h\"\n#include \"machine/machine.h\"\n#include \"static"
  },
  {
    "path": "src/gui/windows/editor/editordock.cpp",
    "chars": 10696,
    "preview": "#include \"editordock.h\"\n\n#include \"common/logging.h\"\n#include \"dialogs/savechanged/savechangeddialog.h\"\n#include \"editor"
  },
  {
    "path": "src/gui/windows/editor/editordock.h",
    "chars": 2116,
    "preview": "#ifndef EDITORDOCK_H\n#define EDITORDOCK_H\n\n#include \"common/memory_ownership.h\"\n#include \"editortab.h\"\n#include \"widgets"
  },
  {
    "path": "src/gui/windows/editor/editortab.cpp",
    "chars": 2015,
    "preview": "#include \"editortab.h\"\n\n#include \"srceditor.h\"\n\n#include <QtGui/qwindowdefs.h>\n#include <QtWidgets/qboxlayout.h>\n\nEditor"
  },
  {
    "path": "src/gui/windows/editor/editortab.h",
    "chars": 819,
    "preview": "#ifndef EDITORTAB_H\n#define EDITORTAB_H\n\n#include \"common/memory_ownership.h\"\n#include \"srceditor.h\"\n\n#include <QtWidget"
  },
  {
    "path": "src/gui/windows/editor/highlighterasm.cpp",
    "chars": 4289,
    "preview": "/* Based on Qt example released under BSD license */\n\n#include \"highlighterasm.h\"\n\n#include \"QStringList\"\n#include \"mach"
  },
  {
    "path": "src/gui/windows/editor/highlighterasm.h",
    "chars": 648,
    "preview": "/* Based on Qt example released under BSD license */\n\n#ifndef HIGHLIGHTERASM_H\n#define HIGHLIGHTERASM_H\n\n#include <QRegu"
  },
  {
    "path": "src/gui/windows/editor/highlighterc.cpp",
    "chars": 6700,
    "preview": "/****************************************************************************\n**\n** Copyright (C) 2016 The Qt Company Lt"
  },
  {
    "path": "src/gui/windows/editor/highlighterc.h",
    "chars": 3379,
    "preview": "/****************************************************************************\n**\n** Copyright (C) 2016 The Qt Company Lt"
  },
  {
    "path": "src/gui/windows/editor/linenumberarea.cpp",
    "chars": 1912,
    "preview": "#include \"linenumberarea.h\"\n\n#include \"srceditor.h\"\n\n#include <cmath>\n#include <qpainter.h>\n#include <qsize.h>\n\nconstexp"
  },
  {
    "path": "src/gui/windows/editor/linenumberarea.h",
    "chars": 486,
    "preview": "#ifndef LINENUMBERAREA_H\n#define LINENUMBERAREA_H\n\n#include \"common/memory_ownership.h\"\n\n#include <QWidget>\n\nclass SrcEd"
  },
  {
    "path": "src/gui/windows/editor/srceditor.cpp",
    "chars": 8620,
    "preview": "#include \"srceditor.h\"\n\n#include \"common/logging.h\"\n#include \"editordock.h\"\n#include \"editortab.h\"\n#include \"linenumbera"
  },
  {
    "path": "src/gui/windows/editor/srceditor.h",
    "chars": 2334,
    "preview": "#ifndef SRCEDITOR_H\n#define SRCEDITOR_H\n\n#include \"common/memory_ownership.h\"\n#include \"linenumberarea.h\"\n#include \"mach"
  }
]

// ... and 180 more files (download for full content)

About this extraction

This page contains the full source code of the cvut/qtrvsim GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 380 files (1.7 MB), approximately 511.7k tokens, and a symbol index with 704 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!