Commit cea56bbe authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

fixed zero-alignment bug 1st field in the register

parent 4aea82ba
This diff is collapsed.
......@@ -192,8 +192,17 @@ function align(field, offset)
-- no alignment defined? just assume it's 1
if(field.align == nil) then a=1; else a=field.align; end
local newofs;
if (offset == 0 and field.align ~= nil) then
newofs = field.align;
else
newofs = a * math.floor((offset + a - 1) / a);
end
-- calculate the aligned offset
local newofs = a * math.floor((offset + a - 1) / a);
print("Align ", field.name, field.align, offset, newofs);
return newofs;
end
......@@ -205,6 +214,7 @@ function calc_field_offset(field, reg)
-- align the field offset next to the current offset in the reg
local ofs = reg.current_offset;
-- FIFOs can span multiple I/O registers.
if (reg.__type == TYPE_FIFO) then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment