Commit 4f884cdc authored by Dimitris Lampridis's avatar Dimitris Lampridis

sv: add constant definition for version in SV as well. Fix C header to use c_prefix

parent 1fb6c1d0
......@@ -122,7 +122,7 @@ function cgen_c_fileheader()
emit("");
if (periph.version ~= nil) then
emit("/* version definition */");
emit("#define WBGEN2_"..string.upper(periph.prefix).."_VERSION "..string.format('0x%08X', periph.version));
emit("#define WBGEN2_"..string.upper(periph.c_prefix).."_VERSION "..string.format('0x%08X', periph.version));
emit("");
end
end
......
......@@ -403,6 +403,10 @@ function cgen_gen_vlog_constants(filename)
if(file == nil) then
die("can't open "..filename.." for writing.");
end
if (periph.version ~= nil) then
file.write(file, string.format("`define WBGEN2_%s_VERSION 32'h%08x\n", string.upper(periph.c_prefix), periph.version));
end
foreach_reg({TYPE_REG}, function(reg)
file.write(file, string.format("`define %-30s %d'h%x\n", "ADDR_"..string.upper(periph.c_prefix.."_"..reg.c_prefix), address_bus_width+2, (DATA_BUS_WIDTH/8) * reg.base));
......
......@@ -804,6 +804,9 @@ local e=io.open(t,"w");
if(e==nil)then
die("can't open "..t.." for writing.");
end
if(periph.version~=nil)then
e.write(e,string.format("`define WBGEN2_%s_VERSION 32'h%08x\n",string.upper(periph.c_prefix),periph.version));
end
foreach_reg({TYPE_REG},function(a)
e.write(e,string.format("`define %-30s %d'h%x\n","ADDR_"..string.upper(periph.c_prefix.."_"..a.c_prefix),address_bus_width+2,(DATA_BUS_WIDTH/8)*a.base));
foreach_subfield(a,function(t)
......@@ -1894,7 +1897,7 @@ emit("#endif");
emit("");
if(periph.version~=nil)then
emit("/* version definition */");
emit("#define WBGEN2_"..string.upper(periph.prefix).."_VERSION "..string.format('0x%08X',periph.version));
emit("#define WBGEN2_"..string.upper(periph.c_prefix).."_VERSION "..string.format('0x%08X',periph.version));
emit("");
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