unable to display fshow for tagVec

This commit is contained in:
Yehowshua Immanuel 2025-03-20 00:10:00 -04:00
parent 6359ab833d
commit ac48f5a4ad
3 changed files with 33 additions and 14 deletions

View file

@ -1,4 +1,4 @@
package TagEngine() where
package TagEngine(TagEngine(..), mkTagEngine) where
import Vector
import Util
@ -10,6 +10,10 @@ data Tag numTags
| Tail
deriving (Bits, Eq, FShow)
interface (TagEngine :: # -> *) numTags =
requestTag :: ActionValue UIntLog2N(numTags)
retireTag :: UIntLog2N(numTags) -> Action
initTagNext :: Integer -> Module(Reg (Tag numTags))
initTagNext i = do
t :: Reg (Tag numTags)
@ -22,11 +26,6 @@ initTagTail = do
t <- mkReg Tail
return t
interface (TagEngine :: # -> *) numTags =
requestTag :: ActionValue UIntLog2N(numTags)
retireTag :: UIntLog2N(numTags) -> Action
initTagVec :: Module(Vector numTags (Reg (Tag numTags)))
initTagVec =
do
@ -44,6 +43,20 @@ mkTagEngine =
tagVec :: Vector numTags (Reg (Tag numTags))
tagVec <- initTagVec
fileHandle :: Handle <- openFile "compile.log" WriteMode
cycle <- mkReg 0
end_cycle <- mkReg 4
addRules (simulate_for cycle end_cycle)
addRules $
rules
"display": when True ==>
do
$display (fshow (tagVec !! 0))
$finish
counter <- mkReg(0 :: UIntLog2N(numTags))
return $
interface TagEngine
@ -56,9 +69,3 @@ mkTagEngine =
retireTag tag = do
-- placeholder
counter := 0
where
a = "Hello"
idx_last :: Integer = (fromInteger |> valueOf numTags) - 1
a :: Integer
a = 3

View file

@ -101,6 +101,7 @@ mkSim :: Module Empty
mkSim = do
let cfg :: BRAM_Configure = defaultValue
tagEngine :: TagEngine 5 <- mkTagEngine
count :: Reg (UInt 3) <- mkReg 0;
initCFunctions :: Reg Bool <- mkReg False;
core :: Core FCLK <- mkCore;

View file

@ -1,4 +1,15 @@
package Util((|>)) where
package Util((|>), simulate_for) where
(|>) :: (a -> b) -> a -> b
f |> x = f x;
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