25 lines
529 B
Haskell
25 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
|