11package AppendTuple where
22
3+ import CShow
4+
35-- Test the AppendTuple type class
46
57{-# verilog sysAppendTuple #-}
@@ -27,7 +29,7 @@ sysAppendTuple =
2729 t1 = (True , 42 )
2830 let t2 :: (Bool , Int 8 )
2931 t2 = appendTuple () t1
30- $ display " appendTuple((), (True, 42)) = (%b, %0d) " (tpl_1 t2) (tpl_2 t2)
32+ $ display " appendTuple((), (True, 42)) = " (cshow t2)
3133 counter : = counter + 1
3234
3335 " test2" : when counter == 2 == > action
@@ -36,7 +38,7 @@ sysAppendTuple =
3638 t1 = (False , negate 10 )
3739 let t2 :: (Bool , Int 8 )
3840 t2 = appendTuple t1 ()
39- $ display " appendTuple((False, -10), ()) = (%b, %0d) " (tpl_1 t2) (tpl_2 t2)
41+ $ display " appendTuple((False, -10), ()) = " (cshow t2)
4042 counter : = counter + 1
4143
4244 " test3" : when counter == 3 == > action
@@ -47,7 +49,7 @@ sysAppendTuple =
4749 t2 = (12 , 0b101 )
4850 let t4 :: (Bool , Int 8 , UInt 4 , Bit 3 )
4951 t4 = appendTuple t1 t2
50- $ display " appendTuple((True, 5), (12, 0b101)) = (%b, %0d, %0d, %b) " (tpl_1 t4) (tpl_2 t4) (tpl_3 t4) (tpl_4 t4)
52+ $ display " appendTuple((True, 5), (12, 0b101)) = " (cshow t4)
5153 counter : = counter + 1
5254
5355 " test4" : when counter == 4 == > action
@@ -58,7 +60,7 @@ sysAppendTuple =
5860 t2 = (negate 3 , 7 )
5961 let t3 :: (Bool , Int 8 , UInt 4 )
6062 t3 = appendTuple b t2
61- $ display " appendTuple(False, (-3, 7)) = (%b, %0d, %0d) " (tpl_1 t3) (tpl_2 t3) (tpl_3 t3)
63+ $ display " appendTuple(False, (-3, 7)) = " (cshow t3)
6264 counter : = counter + 1
6365
6466 " test5" : when counter == 5 == > action
@@ -69,7 +71,7 @@ sysAppendTuple =
6971 b = 0b11010
7072 let t4 :: (Bool , Int 8 , UInt 4 , Bit 5 )
7173 t4 = appendTuple t3 b
72- $ display " appendTuple((True, 20, 8), 0b11010) = (%b, %0d, %0d, %b) " (tpl_1 t4) (tpl_2 t4) (tpl_3 t4) (tpl_4 t4)
74+ $ display " appendTuple((True, 20, 8), 0b11010) = " (cshow t4)
7375 counter : = counter + 1
7476
7577 " test6" : when counter == 6 == > action
@@ -80,7 +82,7 @@ sysAppendTuple =
8082 t3 = (6 , 0b111 , negate 100 )
8183 let t5 :: (Bool , Int 8 , UInt 4 , Bit 3 , Int 16 )
8284 t5 = appendTuple t2 t3
83- $ display " appendTuple((False, 15), (6, 0b111, -100)) = (%b, %0d, %0d, %b, %0d) " (tpl_1 t5) (tpl_2 t5) (tpl_3 t5) (tpl_4 t5) (tpl_5 t5)
85+ $ display " appendTuple((False, 15), (6, 0b111, -100)) = " (cshow t5)
8486 $ display " "
8587 $ display " === Testing splitTuple ==="
8688 counter : = counter + 1
@@ -91,8 +93,7 @@ sysAppendTuple =
9193 t4 = (True , negate 15 , 9 , 0b110 )
9294 let split :: ((Bool , Int 8 ), (UInt 4 , Bit 3 ))
9395 split = splitTuple t4
94- (t1, t2) = split
95- $ display " splitTuple((True, -15, 9, 0b110)) = ((%b, %0d), (%0d, %b))" (tpl_1 t1) (tpl_2 t1) (tpl_1 t2) (tpl_2 t2)
96+ $ display " splitTuple((True, -15, 9, 0b110)) = " (cshow split)
9697 counter : = counter + 1
9798
9899 " test8" : when counter == 8 == > action
@@ -101,8 +102,7 @@ sysAppendTuple =
101102 t3 = (False , 33 , 15 )
102103 let split :: (Bool , (Int 8 , UInt 4 ))
103104 split = splitTuple t3
104- (b, t2) = split
105- $ display " splitTuple((False, 33, 15)) = (%b, (%0d, %0d))" b (tpl_1 t2) (tpl_2 t2)
105+ $ display " splitTuple((False, 33, 15)) = " (cshow split)
106106 counter : = counter + 1
107107
108108 " test9" : when counter == 9 == > action
@@ -111,8 +111,7 @@ sysAppendTuple =
111111 t5 = (True , 50 , 11 , 0b001 , negate 200 )
112112 let split :: ((Bool , Int 8 ), (UInt 4 , Bit 3 , Int 16 ))
113113 split = splitTuple t5
114- (t2, t3) = split
115- $ display " splitTuple((True, 50, 11, 0b001, -200)) = ((%b, %0d), (%0d, %b, %0d))" (tpl_1 t2) (tpl_2 t2) (tpl_1 t3) (tpl_2 t3) (tpl_3 t3)
114+ $ display " splitTuple((True, 50, 11, 0b001, -200)) = " (cshow split)
116115 $ display " "
117116 $ display " === Round-trip test ==="
118117 counter : = counter + 1
@@ -127,8 +126,5 @@ sysAppendTuple =
127126 t4 = appendTuple t1 t2
128127 let split :: ((Bool , Int 8 ), (UInt 4 , Bit 5 ))
129128 split = splitTuple t4
130- (r1, r2) = split
131- $ display " appendTuple/splitTuple round-trip: ((%b, %0d), (%0d, %b))" (tpl_1 r1) (tpl_2 r1) (tpl_1 r2) (tpl_2 r2)
132- $ display " "
133- $ display " All AppendTuple tests passed"
129+ $ display " appendTuple/splitTuple round-trip: " (cshow split)
134130 $ finish 0
0 commit comments