Skip to content

Commit c5edcd0

Browse files
committedAug 31, 2017
cpu_interface: determine Rust types on CSR size, not number of bus words
1 parent 30e5e79 commit c5edcd0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

Diff for: ‎misoc/integration/cpu_interface.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ def _get_rstype(size):
171171
return "bool"
172172

173173

174-
def _get_rw_functions_rs(reg_name, reg_base, nwords, busword, read_only):
174+
def _get_rw_functions_rs(reg_name, reg_base, size, nwords, busword, read_only):
175175
r = ""
176176

177177
r += " pub const "+reg_name.upper()+"_ADDR: *mut u32 = "+hex(reg_base)+" as *mut u32;\n"
178178
r += " pub const "+reg_name.upper()+"_SIZE: usize = "+str(nwords)+";\n\n"
179179

180-
rstype = _get_rstype(nwords*busword)
180+
rstype = _get_rstype(size)
181181
if rstype is None:
182182
return r
183183
rsname = reg_name.upper()+"_ADDR"
@@ -230,7 +230,7 @@ def get_csr_rust(regions, groups, constants):
230230
r += " use core::ptr::{read_volatile, write_volatile};\n\n"
231231
for csr in obj:
232232
nwords = (csr.size + busword - 1)//busword
233-
r += _get_rw_functions_rs(csr.name, origin, nwords, busword,
233+
r += _get_rw_functions_rs(csr.name, origin, csr.size, nwords, busword,
234234
is_readonly(csr))
235235
origin += 4*nwords
236236
r += " }\n\n"

0 commit comments

Comments
 (0)