Skip to content

Commit

Permalink
Fixing inconsistent Run.hs, use default instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas committed May 23, 2023
1 parent 29c9c6c commit 403f750
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 83 deletions.
6 changes: 6 additions & 0 deletions linux-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Install riscv gcc from ubuntu repo.
git clone --branch v5.9 --depth 1 https://github.com/torvalds/linux riscv-linux
cp riscv-semantics-linux-config riscv-linux/.config
./build-busybox.sh
cd riscv-linux
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- -j4
22 changes: 10 additions & 12 deletions loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"./Platform/BufferMMIO.hs": "Simulator",
"./Platform/ClashAccelerator.hs": "Clash",
"./Platform/Clash.hs": "Clash",
"./Platform/CleanTest.hs": "???",
"./Platform/CleanTest.hs": "Clash",
"./Platform/Clint.hs": "Simulator",
"./Platform/ExecuteClash.hs": "Clash",
"./Platform/GcdExpr.hs": "Gcd",
"./Platform/MainCompliance.hs": "riscv-tests",
"./Platform/GcdExpr.hs": "Clash",
"./Platform/MainCompliance.hs": "Simulator",
"./Platform/MainMM.hs": "WMM",
"./Platform/MainRun.hs": "???",
"./Platform/MainTest.hs": "???",
"./Platform/MainRun.hs": "Simulator",
"./Platform/MainTest.hs": "Testing",
"./Platform/MemoryModelTracking.hs": "WMM",
"./Platform/Minimal32.hs": "???",
"./Platform/Minimal64.hs": "???",
"./Platform/Minimal32.hs": "Simulator",
"./Platform/Minimal64.hs": "Simulator",
"./Platform/MMIO.hs": "???",
"./Platform/Plic.hs": "Simulator",
"./Platform/Pty.hs": "Simulator",
Expand All @@ -24,11 +24,9 @@
"./Platform/Run.hs": "???",
"./Platform/RunMM.hs": "WMM",
"./Platform/Test.hs": "???",
"./Platform/TestTLB.hs": "???",
"./Platform/TLBExperiment.hs": "???",
"./Spec/CSRField.hs": "CSR fields",
"./Spec/CSRFile.hs": "CSR fields",
"./Spec/CSRFileIO.hs": "CSR fields",
"./Spec/CSRField.hs": "Spec",
"./Spec/CSRFile.hs": "Spec",
"./Spec/CSRFileIO.hs": "Spec",
"./Spec/CSRGetSet.hs": "CSR fields",
"./Spec/CSR.hs": "CSR fields",
"./Spec/CSRSpec.hs": "CSR fields",
Expand Down
2 changes: 1 addition & 1 deletion riscv-memory-model/riscv.thm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<type name="Address"/>
</node>

<edge visible="no">
<edge visible="yes">
<relation name="$fr"> <type name="Event"/> <type name="Event"/> </relation>
<relation name="$po_loc"> <type name="Event"/> <type name="Event"/> </relation>
<relation name="$ppo"> <type name="Event"/> <type name="Event"/> </relation>
Expand Down
3 changes: 2 additions & 1 deletion src/Platform/MainRun.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import qualified Platform.RunFast as Run
-- import qualified Platform.RunFast as Run
import qualified Platform.Run as Run

main = Run.main
2 changes: 1 addition & 1 deletion src/Platform/MemoryModelTracking.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Spec.CSRFile
import qualified Spec.CSRField as Field
import qualified Spec.Memory as M
import Utility.MapMemory
import Data.Bits
import Data.Bits hiding (Xor, And, Or)
import Data.Int
import qualified Data.List as L
import Data.Word
Expand Down
9 changes: 6 additions & 3 deletions src/Platform/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ checkExternalInterrupt = do
else return DoNothing

runProgram :: Maybe Int64 -> Minimal64 -> IO (Int64, Minimal64)
runProgram maybeToHostAddress c =
runProgram maybeToHostAddress c = do
putStrLn "Start"
runStateT (stepHelper RV64IMAF maybeToHostAddress (do
liftIO checkExternalInterrupt) (return (mtimecmp_addr,0)) (\inst -> return False) endCycle ) c
liftIO checkExternalInterrupt) (return (mtimecmp_addr,0)) (\inst -> return (inst /= 0x6f)) (return ()) ) c



Expand Down Expand Up @@ -106,6 +107,8 @@ main = do
[] -> do
putStr "ERROR: this program expects one or more elf files as command-line arguments\n"
return 1
[file] -> runFile file
[file] -> do
putStrLn "Run file"
runFile file
files -> runFiles files
exitWith (if retval == 0 then ExitSuccess else ExitFailure $ (fromIntegral:: Int64 -> Int) retval)
2 changes: 1 addition & 1 deletion src/Platform/RunCompliance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ runProgram maybeToHostAddress = runStateT (stepHelper RV32IM maybeToHostAddress
instret <- getCSRField Field.MInstRet
if (instret > 5000)
then liftIO . exitWith . ExitFailure $ 1
else liftIO checkInterrupt) (return (mtimecmp_addr,0)) (\inst -> return False) endCycle :: IOState Minimal32 Int32)
else liftIO checkInterrupt) (return (mtimecmp_addr,0)) (\inst -> return True) (return ()):: IOState Minimal32 Int32)
-- Small MMIO hack to step each cycle


Expand Down
2 changes: 1 addition & 1 deletion src/Spec/Decode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Spec.Decode where

-- Haskell lib imports

import Data.Bits -- For bit-wise 'and' (.&.) etc.
import Data.Bits hiding (Xor, And, Or) -- For bit-wise 'and' (.&.) etc.
import Data.Word -- For Word32 type (unsigned 32-bit ints)
import Prelude
-- Local imports
Expand Down
2 changes: 1 addition & 1 deletion src/Spec/ExecuteI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Spec.Decode
import Spec.Machine
import Utility.Utility
import Spec.VirtualMemory
import Data.Bits
import Data.Bits hiding (Xor, And, Or)
import Data.Int
import Data.Word
import Control.Monad
Expand Down
91 changes: 29 additions & 62 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# http://docs.haskellstack.org/en/stable/yaml_configuration/
# https://docs.haskellstack.org/en/stable/yaml_configuration/

# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
Expand All @@ -11,91 +11,58 @@
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ghcjs-0.1.0_ghc-7.10.2
# resolver:
# name: custom-snapshot
# location: "./custom-snapshot.yaml"
# resolver: nightly-2017-10-26
resolver: lts-14.27
#
# The location of a snapshot can be provided as a file or url. Stack assumes
# a snapshot provided as a file might change, whereas a url resource does not.
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/22.yaml

# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
# git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# extra-dep: true
# subdirs:
# - auto-update
# - wai
#
# A package marked 'extra-dep: true' will only be built if demanded by a
# non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages.
# subdirs:
# - auto-update
# - wai
packages:
- '.'
- .
- softfloat-hs
# - clash/clash-ghc
# - clash/clash-lib
# - clash/clash-prelude
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps:
#- call-alloy-0.2.1.0
#- sbv-8.8
- ansi-wl-pprint-0.6.8.2
#- parsers-0.12.8
- prettyprinter-1.2.0.1
- ghc-tcplugins-extra-0.2.1
- ghc-typelits-extra-0.2.3
- ghc-typelits-knownnat-0.3
- ghc-typelits-natnormalise-0.5.3
- uu-interleaved-0.2.0.0
- uu-parsinglib-2.9.1.1
- elf-0.30
- ilist-0.3.1.0
- nondeterminism-1.4
- array-0.5.4.0
- async-2.2.2
- unix-2.7.2.2
- binary-0.8.8.0@sha256:e9387a7ef2b34c6a23b09664c306e37cc01ae2cb4e4511a1c96ffb14008c24b0,6262
- bytestring-0.10.10.0@sha256:06b2e84f1bc9ab71a162c0ca9e88358dd6bbe5cb7fdda2d6d34b6863c367ec95,8944
#- containers-0.5.11.0@sha256:28ad7337057442f75bc689315ab4ec7bdf5e6b2c39668f306672cecd82c02798,16685
- stm-2.5.0.0@sha256:c238075f9f0711cd6a78eab6001b3e218cdaa745d6377bf83cc21e58ceec2ea1,2100
- containers-0.6.4.1@sha256:e9ca297369c207ff40ed561877c15928292b957a01c8551a7cbd50d665a03429,2520
#- containers-0.6.2.1@sha256:bbc3d2d5eef59a5d26383fb4b727c968390f2b6e9bd413d29aa875175bb16f8b,2460
- deepseq-1.4.4.0@sha256:76902b99ee97fc059311ddb0df9488c54969adf0a212efa39705981761f06b55,2918
- directory-1.3.6.1@sha256:3dc9c69c8e09ec95a7a45c6d06abe0f0d2f604439c37e5f88e5a6c335b088d71,2810
- time-1.9.3@sha256:8f1b5448722a12a952248b356c9eb366e351226543d9086a2da71270522d5f45,5679
- pretty-1.1.3.6@sha256:e16ffc733e816cfc09e99cc7f2398805f1f4c872d238a6b81668b5527284b382,2482
- process-1.6.10.0@sha256:c0d2d8adaca7cea7ceaa60e67b61c775dc03727b83bdb1c97aa8cbeac9f5dd84,2469
- text-1.2.4.0@sha256:8c24450feb8e3bbb7ea3e17af24ef57e85db077c4bf53e5bcc345b283d1b1d5b,10081
# Dependency packages to be pulled from upstream that are not in the resolver.
# These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example:
#
# extra-deps:
# - acme-missiles-0.3
# - git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#
# extra-deps: []

# Override default flag values for local packages and extra-deps
flags: {}
ghc-options:
"$everything": -haddock
# flags: {}

# Extra package databases containing global packages
extra-package-dbs: []
# extra-package-dbs: []

# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=1.1"
# require-stack-version: ">=2.9"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
extra-include-dirs: [softfloat-hs/include]
extra-lib-dirs: [softfloat-hs/lib]
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor

0 comments on commit 403f750

Please sign in to comment.