1- #% macro fetch_variables()
2- read _rom prev_proc "_rom"
3- read __etext prev_proc "__etext"
4- read _address prev_proc "_address"
5- read address prev_proc "address"
6- read breakpoint_address prev_proc "breakpoint_address"
7- read csr_mideleg prev_proc "csr_mideleg"
8- read csr_mie prev_proc "csr_mie"
9- read csr_minstret prev_proc "csr_minstret"
10- read csr_mip prev_proc "csr_mip"
11- read csr_mstatus prev_proc "csr_mstatus"
12- read csr_mtime prev_proc "csr_mtime"
13- read csr_mtimecmp prev_proc "csr_mtimecmp"
14- read csr_mtimecmph prev_proc "csr_mtimecmph"
15- read csr_mtimeh prev_proc "csr_mtimeh"
16- read csr_satp prev_proc "csr_satp"
17- read csr_stimecmp prev_proc "csr_stimecmp"
18- read csr_stimecmph prev_proc "csr_stimecmph"
19- read effective_privilege_mode prev_proc "effective_privilege_mode"
20- read icache_ram prev_proc "icache_ram"
21- read icache_var prev_proc "icache_var"
22- read imm prev_proc "imm"
23- read length prev_proc "length"
24- read mcause prev_proc "mcause"
25- read mtval prev_proc "mtval"
26- read next_pc prev_proc "next_pc"
27- read op_id prev_proc "op_id"
28- read pc prev_proc "pc"
29- read privilege_mode prev_proc "privilege_mode"
30- read ram prev_proc "ram"
31- read rd prev_proc "rd"
32- read rd_id prev_proc "rd_id"
33- read result prev_proc "result"
34- read rs1 prev_proc "rs1"
35- read rs1_id prev_proc "rs1_id"
36- read rs2 prev_proc "rs2"
37- read rs2_id prev_proc "rs2_id"
38- read state prev_proc "state"
39- read value prev_proc "value"
40- read variable prev_proc "variable"
41-
42- read ret prev_proc "ret"
43- read ret2 prev_proc "ret2"
44- read ret3 prev_proc "ret3"
45- read ret4 prev_proc "ret4"
46-
47- read nonlocal1 prev_proc "nonlocal1"
48- read nonlocal2 prev_proc "nonlocal2"
49-
50- #% do reset_locals()
51- read {{local_variable()}} prev_proc "{{ local_variable(1) }}"
52- read {{local_variable()}} prev_proc "{{ local_variable(2) }}"
53- read {{local_variable()}} prev_proc "{{ local_variable(3) }}"
54- read {{local_variable()}} prev_proc "{{ local_variable(4) }}"
55- read {{local_variable()}} prev_proc "{{ local_variable(5) }}"
56- read {{local_variable()}} prev_proc "{{ local_variable(6) }}"
57- read {{local_variable()}} prev_proc "{{ local_variable(7) }}"
58- read {{local_variable()}} prev_proc "{{ local_variable(8) }}"
59- read {{local_variable()}} prev_proc "{{ local_variable(9) }}"
60- #% endmacro
61-
62- # {% macro start_assert_length (n ) %} {{ n }}{{ '\n#directive start_assert_length ' }}{{ n }}{% endmacro %}
63-
64- #%# hack: use extends so we don't need to individually import all of the constants
65- #% extends 'constants.jinja'
66- #% block contents
67-
681#%# linked buildings
692
703#% set UART_START_LINK = 16
10033#% set labels.end_instruction = _labels_vals|last + 2
10134#% set labels.end_instruction_trap = _labels_vals|last + 6
10235
36+ #%# macros
37+
38+ #% macro start_assert_length(n)
39+ #{- n
40+ #directive start_assert_length {{ n }}
41+ #%- endmacro
42+
10343reset:
10444 setrate 1000
10545
106- # define this variable FIRST so that we can read other variables over it
107- # set _rom null
108-
10946 # load config
11047 read MEMORY_X {{CONFIG}} "MEMORY_X"
11148 read MEMORY_Y {{CONFIG}} "MEMORY_Y"
@@ -131,6 +68,67 @@ reset:
13168
13269#directive start_fetch
13370
71+ #% macro fetch_variables()
72+ read _rom prev_proc "_rom"
73+ read __etext prev_proc "__etext"
74+ read _address prev_proc "_address"
75+ read address prev_proc "address"
76+ read breakpoint_address prev_proc "breakpoint_address"
77+ read csr_mideleg prev_proc "csr_mideleg"
78+ read csr_mie prev_proc "csr_mie"
79+ read csr_minstret prev_proc "csr_minstret"
80+ read csr_mip prev_proc "csr_mip"
81+ read csr_mstatus prev_proc "csr_mstatus"
82+ read csr_mtime prev_proc "csr_mtime"
83+ read csr_mtimecmp prev_proc "csr_mtimecmp"
84+ read csr_mtimecmph prev_proc "csr_mtimecmph"
85+ read csr_mtimeh prev_proc "csr_mtimeh"
86+ read csr_satp prev_proc "csr_satp"
87+ read csr_stimecmp prev_proc "csr_stimecmp"
88+ read csr_stimecmph prev_proc "csr_stimecmph"
89+ read effective_privilege_mode prev_proc "effective_privilege_mode"
90+ read icache_ram prev_proc "icache_ram"
91+ read icache_var prev_proc "icache_var"
92+ read imm prev_proc "imm"
93+ read length prev_proc "length"
94+ read mcause prev_proc "mcause"
95+ read mtval prev_proc "mtval"
96+ read next_pc prev_proc "next_pc"
97+ read op_id prev_proc "op_id"
98+ read pc prev_proc "pc"
99+ read privilege_mode prev_proc "privilege_mode"
100+ read ram prev_proc "ram"
101+ read rd prev_proc "rd"
102+ read rd_id prev_proc "rd_id"
103+ read result prev_proc "result"
104+ read rs1 prev_proc "rs1"
105+ read rs1_id prev_proc "rs1_id"
106+ read rs2 prev_proc "rs2"
107+ read rs2_id prev_proc "rs2_id"
108+ read state prev_proc "state"
109+ read value prev_proc "value"
110+ read variable prev_proc "variable"
111+
112+ read ret prev_proc "ret"
113+ read ret2 prev_proc "ret2"
114+ read ret3 prev_proc "ret3"
115+ read ret4 prev_proc "ret4"
116+
117+ read nonlocal1 prev_proc "nonlocal1"
118+ read nonlocal2 prev_proc "nonlocal2"
119+
120+ #% do reset_locals()
121+ read {{local_variable()}} prev_proc "{{ local_variable(1) }}"
122+ read {{local_variable()}} prev_proc "{{ local_variable(2) }}"
123+ read {{local_variable()}} prev_proc "{{ local_variable(3) }}"
124+ read {{local_variable()}} prev_proc "{{ local_variable(4) }}"
125+ read {{local_variable()}} prev_proc "{{ local_variable(5) }}"
126+ read {{local_variable()}} prev_proc "{{ local_variable(6) }}"
127+ read {{local_variable()}} prev_proc "{{ local_variable(7) }}"
128+ read {{local_variable()}} prev_proc "{{ local_variable(8) }}"
129+ read {{local_variable()}} prev_proc "{{ local_variable(9) }}"
130+ #% endmacro
131+
134132#{ fetch_variables()
135133
136134#directive end_fetch
@@ -2703,11 +2701,9 @@ MLOGSYS__decode_loop:
27032701
27042702 jump end_instruction always
27052703
2706- #% endblock contents
2707-
2704+ #% if false
27082705# disable mlogls warnings
2709- # put this at the end of the file so it's not included in the output
2710- # and so that if we go over the 1000 instruction limit, we can ignore the errors below this line
2706+ # put this at the end of the file so if we go over the 1000 instruction limit, we can ignore the errors below this line
27112707# {% raw %}
27122708# common preprocessor constants
27132709set {{ null
@@ -2853,3 +2849,4 @@ jump csr_write_sstatus always
28532849jump csr_write_stimecmp always
28542850jump csr_write_stimecmph always
28552851# {% endraw %}
2852+ #% endif
0 commit comments