| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 |
|
| 20 | (define-module (gnu packages computer-architecture)
|
| 21 | #:use-module ((guix licenses) #:prefix license:)
|
| 22 | #:use-module (guix build-system qt)
|
| 23 | #:use-module (guix build-system scons)
|
| 24 | #:use-module (guix gexp)
|
| 25 | #:use-module (guix git-download)
|
| 26 | #:use-module (guix packages)
|
| 27 | #:use-module (guix utils)
|
| 28 | #:use-module (gnu packages)
|
| 29 | #:use-module (gnu packages boost)
|
| 30 | #:use-module (gnu packages compression)
|
| 31 | #:use-module (gnu packages cpp)
|
| 32 | #:use-module (gnu packages electronics)
|
| 33 | #:use-module (gnu packages engineering)
|
| 34 | #:use-module (gnu packages graphviz)
|
| 35 | #:use-module (gnu packages image)
|
| 36 | #:use-module (gnu packages m4)
|
| 37 | #:use-module (gnu packages maths)
|
| 38 | #:use-module (gnu packages perl)
|
| 39 | #:use-module (gnu packages pkg-config)
|
| 40 | #:use-module (gnu packages protobuf)
|
| 41 | #:use-module (gnu packages python)
|
| 42 | #:use-module (gnu packages python-xyz)
|
| 43 | #:use-module (gnu packages qt)
|
| 44 | #:use-module (gnu packages shells))
|
| 45 |
|
| 46 | |
| 47 | |
| 48 | (define-public gem5
|
| 49 | (package
|
| 50 | (name "gem5")
|
| 51 | (version "25.1")
|
| 52 | (source
|
| 53 | (origin
|
| 54 | (method git-fetch)
|
| 55 | (uri (git-reference
|
| 56 | (url "https://github.com/gem5/gem5")
|
| 57 | (commit (string-append "v" version))))
|
| 58 | (file-name (git-file-name name version))
|
| 59 | (sha256
|
| 60 | (base32 "0p40cb3g29zwy3fskah6rxyn8a8xjh9cc6riyigg5l4i854hj2nj"))
|
| 61 | (snippet
|
| 62 | #~(begin
|
| 63 | (use-modules (guix build utils))
|
| 64 | |
| 65 | (substitute* "src/base/date.cc"
|
| 66 | (("__DATE__") "\"1970-01-01\"")
|
| 67 | (("__TIME__") "\"00:00:00\""))
|
| 68 | |
| 69 | (delete-file-recursively "ext/ply") |
| 70 | |
| 71 | (delete-file-recursively "ext/pybind11")
|
| 72 | (substitute* "ext/sst/Makefile.linux"
|
| 73 | (("-I../../ext/pybind11/include/")
|
| 74 | "${shell pybind11-config --includes}"))
|
| 75 | (substitute* "SConstruct"
|
| 76 | ((".*pybind11.*") ""))))))
|
| 77 | (build-system scons-build-system)
|
| 78 | (arguments
|
| 79 | (list
|
| 80 | #:scons-flags #~(list "--verbose")
|
| 81 | #:build-targets #~(list "build/ALL/gem5.opt")
|
| 82 | #:phases
|
| 83 | #~(modify-phases %standard-phases
|
| 84 | (add-after 'unpack 'patch-source
|
| 85 | (lambda* (#:key inputs #:allow-other-keys)
|
| 86 | (substitute* "SConstruct"
|
| 87 | |
| 88 | (("main\\.Append\\(CPPPATH=\\[Dir\\('" all)
|
| 89 | (string-append
|
| 90 | all (assoc-ref inputs "capstone") "/include')])\n"
|
| 91 | all (assoc-ref inputs "hdf5") "/include')])\n"
|
| 92 | all (assoc-ref inputs "kernel-headers") "/include')])\n"
|
| 93 | all (assoc-ref inputs "libpng") "/include')])\n"
|
| 94 | all (assoc-ref inputs "protobuf") "/include')])\n"
|
| 95 | all (assoc-ref inputs "pybind11") "/include')])\n"
|
| 96 | all (assoc-ref inputs "zlib") "/include')])\n"
|
| 97 | all)))
|
| 98 | (substitute* "ext/libelf/SConscript"
|
| 99 | (("m4env\\.Tool" all)
|
| 100 | (string-append
|
| 101 | "m4env.Append(CPPPATH=[Dir('"
|
| 102 | (assoc-ref inputs "kernel-headers")
|
| 103 | "/include')])\n"
|
| 104 | all)))
|
| 105 | (substitute* "ext/libelf/native-elf-format"
|
| 106 | (("cc") #$(cc-for-target)))))
|
| 107 | |
| 108 | |
| 109 | (replace 'check
|
| 110 | (lambda* (#:key tests? #:allow-other-keys #:rest args)
|
| 111 | (when tests?
|
| 112 | (apply (assoc-ref %standard-phases 'build)
|
| 113 | #:build-targets '("build/ALL/unittests.opt")
|
| 114 | args))))
|
| 115 | (replace 'install
|
| 116 | (lambda _
|
| 117 | (let* ((bin (string-append #$output "/bin/")))
|
| 118 | (mkdir-p bin)
|
| 119 | (install-file "build/ALL/gem5.opt" bin)
|
| 120 | (install-file "build/ALL/gem5py" bin)
|
| 121 | (install-file "build/ALL/gem5py_m5" bin)
|
| 122 | (copy-recursively
|
| 123 | "configs"
|
| 124 | (string-append #$output"/share/gem5/configs")))))
|
| 125 | (add-after 'install 'wrap-binaries
|
| 126 | (lambda _
|
| 127 | (for-each
|
| 128 | (lambda (file)
|
| 129 | (wrap-program file
|
| 130 | `("GUIX_PYTHONPATH" ":" prefix
|
| 131 | (,(getenv "GUIX_PYTHONPATH")))))
|
| 132 | (find-files (string-append #$output "/bin"))))))))
|
| 133 | (inputs
|
| 134 | (list capstone
|
| 135 | gperftools
|
| 136 | hdf5
|
| 137 | libpng
|
| 138 | protobuf
|
| 139 | pybind11-2
|
| 140 | python
|
| 141 | python-ply
|
| 142 | python-pydot
|
| 143 | zlib))
|
| 144 | (native-inputs
|
| 145 | (list boost
|
| 146 | m4
|
| 147 | tcsh
|
| 148 | perl
|
| 149 | python-minimal-wrapper
|
| 150 | pkg-config))
|
| 151 | (home-page "http://gem5.org/")
|
| 152 | (synopsis "Modular platform for computer-system architecture research")
|
| 153 | (description "The gem5 simulator is a modular platform for computer-system
|
| 154 | architecture research, encompassing system-level architecture as well as
|
| 155 | processor microarchitecture.")
|
| 156 | (license license:bsd-3)))
|
| 157 |
|
| 158 | (define-public ripes
|
| 159 | |
| 160 | (let ((commit "720066f8d1c9f8d62fad058f44471763a0312084")
|
| 161 | (revision "0"))
|
| 162 | (package
|
| 163 | (name "ripes")
|
| 164 | (version (git-version "2.2.6" revision commit))
|
| 165 | (source
|
| 166 | (origin
|
| 167 | (method git-fetch)
|
| 168 | (uri (git-reference
|
| 169 | (url "https://github.com/mortbopet/Ripes/")
|
| 170 | (commit commit)
|
| 171 | |
| 172 | |
| 173 | (recursive? #t)))
|
| 174 | (file-name (git-file-name name version))
|
| 175 | (sha256
|
| 176 | (base32 "1kkdc3y18h985zvgmhbdbms3zynygrg5f64w1lm948hffj58x7gy"))))
|
| 177 | (build-system qt-build-system)
|
| 178 | (arguments
|
| 179 | (list
|
| 180 | #:qtbase qtbase |
| 181 | #:phases
|
| 182 | #~(modify-phases %standard-phases
|
| 183 | (add-after 'unpack 'disable-tests
|
| 184 | (lambda _
|
| 185 | (substitute* "test/CMakeLists.txt"
|
| 186 | |
| 187 | (("create_qtest\\(tst_riscv\\)") "")
|
| 188 | |
| 189 | (("create_qtest\\(tst_reverse\\)") ""))))
|
| 190 | (add-after 'unpack 'patch-bugs
|
| 191 | (lambda* (#:key inputs #:allow-other-keys)
|
| 192 | |
| 193 | |
| 194 | (substitute*
|
| 195 | (string-append "external/VSRTL/external/cereal/include"
|
| 196 | "/cereal/external/rapidjson/document.h")
|
| 197 | (("GenericStringRef& operator=.*")
|
| 198 | (string-append
|
| 199 | "GenericStringRef& operator=(const GenericStringRef& rhs)"
|
| 200 | " { s = rhs.s; return *this; }")))
|
| 201 | |
| 202 | (substitute* '("external/VSRTL/interface/vsrtl_vcdfile.cpp")
|
| 203 | (("#include <sstream>")
|
| 204 | "#include <sstream>\n#include <cstdint>"))
|
| 205 | |
| 206 | (substitute* '("external/VSRTL/interface/vsrtl_vcdfile.h")
|
| 207 | (("#include <map>")
|
| 208 | "#include <map>\n#include <cstdint>"))))
|
| 209 | (add-before 'configure 'set-envs
|
| 210 | (lambda* (#:key inputs #:allow-other-keys)
|
| 211 | (setenv "VERILATOR_ROOT"
|
| 212 | (dirname
|
| 213 | (dirname
|
| 214 | (search-input-file inputs "/bin/verilator"))))))
|
| 215 | (replace 'check |
| 216 | (lambda* (#:key tests? #:allow-other-keys)
|
| 217 | (when tests?
|
| 218 | (for-each
|
| 219 | (lambda (f) (invoke f))
|
| 220 | (filter executable-file? (find-files "test" "tst_")))))))
|
| 221 | #:configure-flags
|
| 222 | #~(list "-DRIPES_BUILD_VERILATOR_PROCESSORS=ON"
|
| 223 | "-DRIPES_BUILD_TESTS=ON")))
|
| 224 | (native-inputs
|
| 225 | (list python-minimal-wrapper verilator))
|
| 226 | (inputs
|
| 227 | (list qtsvg qtcharts))
|
| 228 | (home-page "https://github.com/mortbopet/Ripes/")
|
| 229 | (synopsis "Visual computer architecture editor for RISCV")
|
| 230 | (description
|
| 231 | "Ripes is a visual computer architecture simulator and assembly code
|
| 232 | editor built for the RISCV instruction set architecture.")
|
| 233 | (license license:expat))))
|