-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtree_redux.tlv
111 lines (96 loc) · 2.64 KB
/
tree_redux.tlv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
\m4_TLV_version 1d: tl-x.org
\SV
// Experimenting with new m4 stuff.
m4_include_lib(['https://raw.githubusercontent.com/stevehoover/tlv_lib/db48b4c22c4846c900b3fa307e87d9744424d916/fundamentals_lib.tlv'])
//m4_define(['M4_FMT_NO_SOURCE'], ['1'])
m4_def(['ok'], ['OK'])
m4_func(fool, ['
m4_push(['ok'], ['UGH'])
m4_output(m4_ok ['hi'])
m4_pop(['ok'])
m4_output(m4_ok ['hi'])
'])
/* m4_fool() */
// =========================================
// Welcome! Try the tutorials via the menu.
// =========================================
/*
m4_do(['m4_define(['m4_hi'], ['Hello!'])'])
m4_hi()
m4_func(['test'], ['hi
I'm a test
m4_output(['My output'])
m4_output(['m4_nothing()'])
okay
'])
m4_test()
*/
// Default Makerchip TL-Verilog Code Template
// Macro providing required top-level module definition, random
// stimulus support, and Verilator config.
m4_makerchip_module // (Expanded in Nav-TLV pane.)
\TLV tree_test()
/* tree_test#$# */
m4_define_hier(['M4_FLAT'], 9)
|pipe
/M4_FLAT_HIER
@1
$sig[2:0] = #flat;
m4+tree_redux(
|pipe, /flat, 8, 0,
['@m4_ifelse(m4_level, 2, 1, m4_level, 1, 3, m4_level, 0, 5, Uh-Oh)'],
['$sig[m4_ifelse(m4_level, 2, 2, m4_level, 1, 4, m4_level, 0, 5, Uh-Oh):0]'],
3, ['m4_op1 + m4_op2'], '0)
\TLV test($_a, $_b, _block)
// test macro
m4+_block
\TLV test2($_a, $_b, _block)
// test macro
m4+_block()
\TLV
m4+tree_test
m4_def(test_var, ['TEST_VAR_EVALUATED'])
$reset = *reset;
m4+ifelse(
1, 2,
\TLV
$one = $two;
, 3, 4,
\TLV
$three = $four;
, 5, 6,
\TLV
$five = $six;
,
\TLV
$seven = $eight;
)
/hier
m4+test(
$one,
$two,
\TLV // Removed comment
|foo
/* m4_test_var */
m4+test(
m4foo,
1,
\TLV
/stage4
@4
$hmm = 1'b0;
m4+forloop(i, 5, 6,
\TLV
/stage['']m4_i
@['']m4_i
$hmm = |foo/stage['']m4_eval(m4_i - 1)<<1$hmm;
)
@1
$foo = $bar;
)
)
// Assert these to end simulation (before Makerchip cycle limit).
*passed = *cyc_cnt > 40;
*failed = 1'b0;
\SV
endmodule