Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/workflows/build-and-test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ jobs:
BREW_UPDATE: ${{ inputs.brew_update }}
run: |
.github/workflows/install_dependencies_macos.sh
# If the runner doesn't have 'ghcup', install it
if ! [ -x "$(command -v ghcup)" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
echo "$HOME/.ghcup/bin" >> $GITHUB_PATH
export PATH=$HOME/.ghcup/bin:$PATH
fi
# Don't rely on the VM to pick the GHC version
ghcup install ghc ${{ inputs.ghc_version }}
ghcup set ghc ${{ inputs.ghc_version }}
# Don't rely on the VM to pick the GHC version
# (and don't assume that GHCup is already installed on the runner)
- name: Install GHC
uses: haskell/ghcup-setup@v1
with:
ghc: ${{ inputs.ghc_version }}
cabal: recommended
# Until BSC uses cabal to build, pre-install these packages
- name: Install Haskell dependencies
shell: bash
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/build-and-test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ jobs:
shell: bash
run: |
sudo .github/workflows/install_dependencies_ubuntu.sh
# Don't rely on the VM to pick the GHC version
ghcup install ghc ${{ inputs.ghc_version }}
ghcup set ghc ${{ inputs.ghc_version }}
# Don't rely on the VM to pick the GHC version
# (and don't assume that GHCup is already installed on the runner)
- name: Install GHC
uses: haskell/ghcup-setup@v1
with:
ghc: ${{ inputs.ghc_version }}
cabal: recommended
# Until BSC uses cabal to build, pre-install these packages
- name: Install Haskell dependencies
shell: bash
Expand Down Expand Up @@ -65,6 +69,11 @@ jobs:
# Generate package info
export BSC_BUILD_PKGINFO=1

# An STP test hangs on the ARM runners
if [[ "${{ inputs.os }}" == *-arm ]]; then
export STP_STUB=1
fi

make -j ${CORES} GHCJOBS=2 GHCRTSFLAGS='+RTS -M5G -A128m -RTS' install-src
tar czf inst.tar.gz inst
- name: CCache stats
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
build-and-test-ubuntu:
strategy:
matrix:
os: [ ubuntu-22.04, ubuntu-24.04 ]
os: [ ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, ubuntu-26.04, ubuntu-26.04-arm ]
timeout_override: [ false ]
fail-fast: false
name: "Build/Test: ${{ matrix.os }}"
Expand All @@ -58,7 +58,7 @@ jobs:
build-and-test-macos:
strategy:
matrix:
os: [ macos-14, macos-15, macos-15-intel, macos-26 ]
os: [ macos-14, macos-15, macos-15-intel, macos-26, macos-26-intel ]
timeout_override: [ false ]
brew_update: [ true ]
fail-fast: false
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
build-doc-ubuntu:
strategy:
matrix:
os: [ ubuntu-22.04, ubuntu-24.04 ]
os: [ ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, ubuntu-26.04, ubuntu-26.04-arm ]
fail-fast: false
name: "Build doc: ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
build-doc-macOS:
strategy:
matrix:
os: [ macos-14, macos-15, macos-15-intel, macos-26 ]
os: [ macos-14, macos-15, macos-15-intel, macos-26, macos-26-intel ]
brew_update: [ true ]
fail-fast: false
name: "Build doc: ${{ matrix.os }}"
Expand Down
6 changes: 3 additions & 3 deletions src/comp/ISyntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ fTVars (ITStr _) = S.empty


splitITAp :: IType -> (IType, [IType])
splitITAp (ITAp f a) = let (l, as) = splitITAp f
in (l, as ++ [a])
splitITAp t = (t, [])
splitITAp t0 = go t0 []
where go (ITAp f a) acc = go f (a : acc)
go t acc = (t, acc)


-- ==============================
Expand Down
5 changes: 1 addition & 4 deletions src/comp/Pred.hs
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,10 @@ expandSyn t0 = exp [] f as
-- Type functions (TIatf) are NOT expanded here; they are handled by
-- normT via expTFun, which generates the appropriate class constraint.
exp _ f@(TCon (TyCon i _ _)) as
| isTFun i = apTFun f i $ map expandSyn as
| isPrimTFunName i = apTFun f i $ map expandSyn as
-- f does not contain a TAp or a synonym TCon, so it cannot have synonyms to expand
exp _ f as = foldl TAp f $ map expandSyn as

isTFun :: Id -> Bool
isTFun i = i `elem` numOpNames ++ strOpNames

apTFun :: Type -> Id -> [Type] -> Type
apTFun _ i [TCon (TyNum x px), TCon (TyNum y py)] | Just n <- opNumT i [x, y] = TCon (TyNum n p')
where p' = bestPosition px py
Expand Down
12 changes: 6 additions & 6 deletions src/comp/PredTrie.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import qualified Data.Set as S

import Error(internalError)
import CType(Type(..), TyCon(..), TyVar, leftTyCon)
import TypeOps(numOpNames, strOpNames)
import TypeOps(isPrimTFunName)
import Pred(Pred(..), Class(inputPositions), expandSyn)

-- ---------------------------------------------------------------------------
Expand Down Expand Up @@ -166,7 +166,7 @@ predTrieKey positions (IsIn _ ts) =
-- query that finds all instances that might overlap with it. Variable positions
-- in the instance key (Nothing) become Free so that cross-branch overlaps are
-- found; concrete positions (Just tc) become Con tc.
-- Unlike predQuery this does not apply isTFunTyCon: for overlap detection we
-- Unlike predQuery this does not apply isPrimTFunTyCon: for overlap detection we
-- want to find all candidates including those with numeric-literal heads.
overlapProbeQuery :: Pred -> [QueryElem]
overlapProbeQuery p@(IsIn c _) =
Expand All @@ -193,9 +193,9 @@ predQuery btvs (IsIn c ts) =
-- concrete constructor at query time, so queries at those positions must
-- probe ALL trie branches (Free) to avoid missing instances that have a
-- concrete-number head (e.g. VectorTreeReduce 1, VectorTreeReduce 2).
isTFunTyCon :: TyCon -> Bool
isTFunTyCon (TyCon { tcon_name = i }) = i `elem` numOpNames ++ strOpNames
isTFunTyCon _ = False
isPrimTFunTyCon :: TyCon -> Bool
isPrimTFunTyCon (TyCon { tcon_name = i }) = isPrimTFunName i
isPrimTFunTyCon _ = False

-- | Classify one type argument of the predicate being resolved.
-- A type-function head (TAdd, TLog, etc.) is treated as Free so that
Expand All @@ -204,7 +204,7 @@ isTFunTyCon _ = False
mkQueryElem :: S.Set TyVar -> Type -> QueryElem
mkQueryElem btvs t =
case leftTyCon t of
Just tc | not (isTFunTyCon tc) -> Con tc
Just tc | not (isPrimTFunTyCon tc) -> Con tc
Just _ -> Free -- unevaluated type function
Nothing -> case headVar t of
Just tv | tv `S.member` btvs -> Bound
Expand Down
9 changes: 8 additions & 1 deletion src/comp/TypeOps.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
module TypeOps(opNumT, numOpNames, opStrT, strOpNames) where
module TypeOps(isPrimTFunName, opNumT, opStrT) where
-- common routines for handling numeric and string types

import qualified Data.Set as S
import Id
import PreIds(idTAdd, idTSub, idTMul, idTDiv, idTLog, idTExp, idTMax, idTMin, idTStrCat, idTNumToStr)
import Util(divC, log2)
import FStringCompat(FString, concatFString)

isPrimTFunName :: Id -> Bool
isPrimTFunName i = i `S.member` primTFunNames

primTFunNames :: S.Set Id
primTFunNames = S.fromList (numOpNames ++ strOpNames)

-- do a numeric type operation on a list of arguments
-- note that we have to validate that the result is going to
-- to be >= 0 - otherwise it isn't a valid numeric type
Expand Down
23 changes: 11 additions & 12 deletions src/vendor/stp/src_stub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ LIB_DIR=../lib
INC_DIR=../include

ifeq ($(OSTYPE), Darwin)
LDFLAGS = -dynamiclib -Wl,-install_name,libstp_stub.so
SNAME = libstp.dylib
LDFLAGS = -dynamiclib -Wl,-install_name,$(SNAME)
LINKCMD = :
else
LDFLAGS = -shared -Wl,-soname,libstp_stub.so
SNAME = libstp.so.1
LDFLAGS = -shared -Wl,-soname,$(SNAME)
LINKCMD = ln -fsn $(SNAME) $(LIB_DIR)/libstp.so
endif

.PHONY: all
Expand All @@ -21,25 +25,20 @@ all: install
stp_stub.o: stp_stub.c stp_c_interface.h
$(CC) $(CFLAGS) -c -o $@ $<

libstp_stub.so: stp_stub.o
$(SNAME): stp_stub.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

libstp.so: libstp_stub.so
$(RM) $@
ln -s $< $@

install: libstp_stub.so
install: $(SNAME)
mkdir -p $(LIB_DIR)
$(CP) libstp_stub.so $(LIB_DIR)/
ln -fsn libstp.so.1 $(LIB_DIR)/libstp.so
ln -fsn libstp_stub.so $(LIB_DIR)/libstp.so.1
$(CP) $(SNAME) $(LIB_DIR)/
$(LINKCMD)
mkdir -p $(INC_DIR)
$(CP) stp_c_interface.h $(INC_DIR)/

.PHONY: clean full_clean

clean:
$(RM) *.o *.so
$(RM) *.o *.so *.dylib

full_clean: clean
$(RM) -R $(LIB_DIR)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/bsc.misc/divmod/divmod.exp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set fpe [list SIGFPE 8 136]
# Test that divide-by-zero produces some failure in Bluesim
compile_object_pass DivideByZero.bsv sysDivideByZero
link_objects_pass sysDivideByZero sysDivideByZero
if [string equal [which_mach] "arm64"] {
if { [lsearch -exact -nocase {aarch64 arm64} [which_mach]] != -1 } {
# This is an expected bug (GitHub #688)
sim_output_status sysDivideByZero 0
} else {
Expand Down
Loading