Commit 2476a8d6 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

wbgen_common.lua: more checks

parent 369a3a29
...@@ -116,9 +116,10 @@ end ...@@ -116,9 +116,10 @@ end
-- function checks and calculates size of field "field" in register "reg" -- function checks and calculates size of field "field" in register "reg"
function calc_size(field, reg) function calc_size(field, reg)
-- monostable or bit-field? default size to 1 if not specified -- monostable or bit-field? default size to 1 if not specified
if(field.type == MONOSTABLE or field.type == BIT) then if(field.type == MONOSTABLE or field.type == BIT) then
field.size = 1; field.size = 1;
elseif (field.type == SLV) then elseif (field.type == SLV or field.type == PASS_THROUGH) then
-- SLV fields must have defined size -- SLV fields must have defined size
if(field.size == nil) then if(field.size == nil) then
die("no size declared for SLV-type field '".. field.name.."'"); die("no size declared for SLV-type field '".. field.name.."'");
...@@ -277,6 +278,17 @@ function csel(cond, tr, fl) ...@@ -277,6 +278,17 @@ function csel(cond, tr, fl)
end end
end end
function check_field_types(field)
if(field.type == nil) then
die("no type declared for field: "..field.name);
end
end
function check_obj_names_prefixes(obj)
if(obj.name == nil) then
die("no name declared for object: "..obj.size);
end
end
function fix_prefix(obj) function fix_prefix(obj)
if(obj.c_prefix == nil or obj.hdl_prefix==nil) then if(obj.c_prefix == nil or obj.hdl_prefix==nil) then
...@@ -336,7 +348,7 @@ end ...@@ -336,7 +348,7 @@ end
function check_max_size(reg) function check_max_size(reg)
if(reg.total_size > DATA_BUS_WIDTH and reg.__type == TYPE_REG) then if(reg.total_size > DATA_BUS_WIDTH and reg.__type == TYPE_REG) then
die ("register ", reg.name, " size exceeds data bus witdh (", DATA_BUS_WIDTH, " bits)"); die ("register ".. reg.name.. " size exceeds data bus witdh (".. DATA_BUS_WIDTH.. " bits)");
end end
end end
......
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