summaryrefslogtreecommitdiff
path: root/pkgs/simple-scalar
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2025-08-24 18:55:06 -0600
committerAlejandro Soto <alejandro@34project.org>2025-08-24 18:55:06 -0600
commitd7ac88762db111a7962c4e14b5f4e37ab85ccac7 (patch)
tree0c2c8c4383bef74215e3b7c48a2f6b0117f084bc /pkgs/simple-scalar
parent504589d1035f27b766bd33040b415b2725ece4ca (diff)
tree-wide: reformat using alejandra after enabling trivionomicon
Diffstat (limited to '')
-rw-r--r--pkgs/simple-scalar/default.nix8
-rw-r--r--pkgs/simple-scalar/gcc-sslittle-na-sstrix.nix139
-rw-r--r--pkgs/simple-scalar/simplesim.nix49
3 files changed, 108 insertions, 88 deletions
diff --git a/pkgs/simple-scalar/default.nix b/pkgs/simple-scalar/default.nix
index c0774d1..01e8ee4 100644
--- a/pkgs/simple-scalar/default.nix
+++ b/pkgs/simple-scalar/default.nix
@@ -1,5 +1,5 @@
-{ callPackage }: {
- gcc-sslittle-na-sstrix = callPackage ./gcc-sslittle-na-sstrix.nix { };
- simplesim = callPackage ./simplesim.nix { };
- wattchg7 = callPackage ./simplesim.nix { isWattch = true; };
+{callPackage}: {
+ gcc-sslittle-na-sstrix = callPackage ./gcc-sslittle-na-sstrix.nix {};
+ simplesim = callPackage ./simplesim.nix {};
+ wattchg7 = callPackage ./simplesim.nix {isWattch = true;};
}
diff --git a/pkgs/simple-scalar/gcc-sslittle-na-sstrix.nix b/pkgs/simple-scalar/gcc-sslittle-na-sstrix.nix
index 7ad3cbe..9cb6d30 100644
--- a/pkgs/simple-scalar/gcc-sslittle-na-sstrix.nix
+++ b/pkgs/simple-scalar/gcc-sslittle-na-sstrix.nix
@@ -1,35 +1,39 @@
# https://www.cse.iitd.ac.in/~cs5070217/csl718/assignment1/ss_install_instructions.html
-{ bison, fetchurl, flex, multiStdenv, stdenv_32bit }:
-let
+{
+ bison,
+ fetchurl,
+ flex,
+ multiStdenv,
+ stdenv_32bit,
+}: let
host = "i686-pc-linux";
target = "sslittle-na-sstrix";
gcc-version = "2.7.2.3";
makeflags = "LANGUAGES=c CC=\"$CC -m32 $CFLAGS\" prefix=$out";
in
-multiStdenv.mkDerivation {
- pname = "gcc-sslittle-na-sstrix";
- version = "1998-08-11"; # !!!
+ multiStdenv.mkDerivation {
+ pname = "gcc-sslittle-na-sstrix";
+ version = "1998-08-11"; # !!!
- nativeBuildInputs = [ flex bison ];
+ nativeBuildInputs = [flex bison];
- sourceRoot = ".";
+ sourceRoot = ".";
- srcs = [
- (fetchTarball {
- name = "simpleutils-990811";
+ srcs = [
+ (fetchTarball {
+ name = "simpleutils-990811";
- url = "https://www.cse.iitd.ac.in/~cs5070217/csl718/simpleutils-990811.tar.gz";
- sha256 = "sha256:0w952z382s7ghrxwrad7fd058b1kj5ad1abh8idxwwk47va72cdf";
- })
- ];
+ url = "https://www.cse.iitd.ac.in/~cs5070217/csl718/simpleutils-990811.tar.gz";
+ sha256 = "sha256:0w952z382s7ghrxwrad7fd058b1kj5ad1abh8idxwwk47va72cdf";
+ })
+ ];
- # El código es muy viejo y Nix usa opciones muy estrictas por defecto
- CFLAGS = "-O3 -Wno-error=format-security";
+ # El código es muy viejo y Nix usa opciones muy estrictas por defecto
+ CFLAGS = "-O3 -Wno-error=format-security";
- # Algunas tarballs vienen sin directorio de primer nivel y además requieren arreglos
- postUnpack =
- let
+ # Algunas tarballs vienen sin directorio de primer nivel y además requieren arreglos
+ postUnpack = let
simpletools = fetchurl {
url = "https://www.cse.iitd.ac.in/~cs5070217/csl718/simpletools-2v0.tgz";
sha256 = "sha256-FTDTqyQWZCnuNPmTcu3Hcjgp4pHNoUcC0GOGhSJV9Iw=";
@@ -44,8 +48,7 @@ multiStdenv.mkDerivation {
url = "https://www.cse.iitd.ac.in/~cs5070217/csl718/ar_and_ranlib.tar.gz";
sha256 = "sha256-MRTO6cAg3WeXlk3jDy2lVuiSXDRz1+LLa2XDkBDygMU=";
};
- in
- ''
+ in ''
tar xf ${simpletools}
rm -r gcc-2.6.3
@@ -57,50 +60,50 @@ multiStdenv.mkDerivation {
chmod -R +w gcc-${gcc-version} ar-and-ranlib
'';
- patches = [
- ./0001-fix-case-of-YY_CURRENT_BUFFER.patch
- ./0002-define-sys_nerr.patch
- ./0003-fix-obstack.h-post-increment.patch
- ./0004-stdarg.h-instead-of-varargs.h.patch
- ];
-
- postPatch = ''
- patchelf \
- --set-interpreter "$(<${stdenv_32bit.cc}/nix-support/dynamic-linker-m32)" \
- ar-and-ranlib/{ar,ranlib}
- '';
-
- configurePhase = ''
- BUILD=$PWD
-
- cd $BUILD/simpleutils-990811
- ./configure --host=${host} --target=${target} --with-gnu-as --with-gnu-ld --prefix=$out
-
- cd $BUILD/gcc-${gcc-version}
- ./configure --host=${host} --target=${target} --with-gnu-as --with-gnu-ld --prefix=$out
- '';
-
- buildPhase = ''
- make -C $BUILD/simpleutils-990811
-
- # GCC necesita binutils para compilar
- make -C $BUILD/simpleutils-990811 install
- cp $BUILD/ar-and-ranlib/{ar,ranlib} $out/${target}/bin/
-
- cd $BUILD/gcc-${gcc-version}
-
- mkdir -p $out/lib
- cp patched/sys/cdefs.h $BUILD/${target}/include/sys/cdefs.h
- cp -r $BUILD/${target} $out/
- cp $BUILD/${target}/lib/{libc.a,crt0.o} $out/lib/
- sed -i '130s@-I/usr/include@-I./include@' Makefile
-
- ! make ${makeflags}
- sed -i 's/\(return "FIXME\\n\)/\1\\/g' insn-output.c
- PATH="$out/${target}/bin:$PATH" make ${makeflags}
- '';
-
- installPhase = ''
- PATH="$out/${target}/bin:$PATH" make -C $BUILD/gcc-${gcc-version} ${makeflags} install
- '';
-}
+ patches = [
+ ./0001-fix-case-of-YY_CURRENT_BUFFER.patch
+ ./0002-define-sys_nerr.patch
+ ./0003-fix-obstack.h-post-increment.patch
+ ./0004-stdarg.h-instead-of-varargs.h.patch
+ ];
+
+ postPatch = ''
+ patchelf \
+ --set-interpreter "$(<${stdenv_32bit.cc}/nix-support/dynamic-linker-m32)" \
+ ar-and-ranlib/{ar,ranlib}
+ '';
+
+ configurePhase = ''
+ BUILD=$PWD
+
+ cd $BUILD/simpleutils-990811
+ ./configure --host=${host} --target=${target} --with-gnu-as --with-gnu-ld --prefix=$out
+
+ cd $BUILD/gcc-${gcc-version}
+ ./configure --host=${host} --target=${target} --with-gnu-as --with-gnu-ld --prefix=$out
+ '';
+
+ buildPhase = ''
+ make -C $BUILD/simpleutils-990811
+
+ # GCC necesita binutils para compilar
+ make -C $BUILD/simpleutils-990811 install
+ cp $BUILD/ar-and-ranlib/{ar,ranlib} $out/${target}/bin/
+
+ cd $BUILD/gcc-${gcc-version}
+
+ mkdir -p $out/lib
+ cp patched/sys/cdefs.h $BUILD/${target}/include/sys/cdefs.h
+ cp -r $BUILD/${target} $out/
+ cp $BUILD/${target}/lib/{libc.a,crt0.o} $out/lib/
+ sed -i '130s@-I/usr/include@-I./include@' Makefile
+
+ ! make ${makeflags}
+ sed -i 's/\(return "FIXME\\n\)/\1\\/g' insn-output.c
+ PATH="$out/${target}/bin:$PATH" make ${makeflags}
+ '';
+
+ installPhase = ''
+ PATH="$out/${target}/bin:$PATH" make -C $BUILD/gcc-${gcc-version} ${makeflags} install
+ '';
+ }
diff --git a/pkgs/simple-scalar/simplesim.nix b/pkgs/simple-scalar/simplesim.nix
index 3b73267..43bc656 100644
--- a/pkgs/simple-scalar/simplesim.nix
+++ b/pkgs/simple-scalar/simplesim.nix
@@ -1,19 +1,30 @@
-{ fetchFromGitHub, stdenv, isWattch ? false }:
+{
+ fetchFromGitHub,
+ stdenv,
+ isWattch ? false,
+}:
stdenv.mkDerivation {
- pname = if isWattch then "wattchg7" else "SimpleSim";
- version = if isWattch then "master-2014-03-20" else "2003-10-08"; # !!!
+ pname =
+ if isWattch
+ then "wattchg7"
+ else "SimpleSim";
+ version =
+ if isWattch
+ then "master-2014-03-20"
+ else "2003-10-08"; # !!!
src =
if isWattch
then
fetchFromGitHub
- {
- repo = "wattchg7";
- owner = "n-sreek";
+ {
+ repo = "wattchg7";
+ owner = "n-sreek";
- rev = "b1c2c1447584b7e850c6dc0743a2209c9d021a39";
- sha256 = "sha256-JMM2+6dgReSP3MKSC0ZOYt0Pcmef8DRzIkC26e4dk+Y=";
- } else
+ rev = "b1c2c1447584b7e850c6dc0743a2209c9d021a39";
+ sha256 = "sha256-JMM2+6dgReSP3MKSC0ZOYt0Pcmef8DRzIkC26e4dk+Y=";
+ }
+ else
fetchTarball {
name = "simplesim-3.0";
@@ -25,11 +36,17 @@ stdenv.mkDerivation {
make config-pisa
'';
- installPhase = ''
- mkdir -p $out/bin
- '' + (if isWattch then ''
- cp sim-outorder $out/bin/wattch-outorder
- '' else ''
- cp {sim-{outorder,cache,profile,bpred,eio,safe,fast},sysprobe} $out/bin/
- '');
+ installPhase =
+ ''
+ mkdir -p $out/bin
+ ''
+ + (
+ if isWattch
+ then ''
+ cp sim-outorder $out/bin/wattch-outorder
+ ''
+ else ''
+ cp {sim-{outorder,cache,profile,bpred,eio,safe,fast},sysprobe} $out/bin/
+ ''
+ );
}