playground/misc/bluespec/Top.bs

26 lines
785 B
Plaintext

{-
https://raw.githubusercontent.com/BSVLang/Main/master/Tutorials/Bluespec_Classic_Training/Examples/Eg02_HelloWorld.pdf
-}
package Top where
-- module name is mkTop
-- Empty is the interface part.
-- mkTop module has no interface. ie, no methods.
-- So it cannot interact with its environment.
mkTop :: Module Empty
-- mkTop's definition
mkTop =
module
rules
-- a rule named `"rl_print_answer"`
-- Here, always executed because of the True, I guess.
"rl_print_answer": when True ==> do
-- `$display` prints messages (with a newline appended)
$display "Hello, World!"
$display "answer is: %0d (or, in hex: 0x%0h)\n" 42 42
-- halts whole simulation to terminate. So, this rule can fire only once
$finish