This repository has been archived on 2025-06-25. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
riscv-bluespec-classic/bs/Util.bs

24 lines
529 B
Haskell

package Util(
(|>),
BasicResult(..),
simulate_for) where
infixr 0 |>
data BasicResult = Success
| Failure
deriving (Bits, Eq, FShow)
(|>) :: (a -> b) -> a -> b
f |> x = f x;
simulate_for :: (Bits a n, Arith a, Eq a) => Reg a -> Reg a -> Rules
simulate_for curr_cycle end_cycle =
rules
"count_cycle_rule": when True ==> action
curr_cycle := curr_cycle + 1
if curr_cycle == end_cycle
then
$finish
else
$display "cycle = " curr_cycle