Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove static keyword from C++ header files #70

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions bust/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,50 +84,44 @@ def return_cpp_header(self):
for reg in self.module.registers:
s += "/* Register: " + reg.name + " */\n"
s += (
"static const uint32_t "
"const uint32_t "
+ reg.name.upper()
+ "_OFFSET = "
+ str(hex(reg.address))
+ ";\n"
)
s += (
"static const uint32_t "
+ reg.name.upper()
+ "_RESET = "
+ reg.reset
+ ";\n"
)
s += "const uint32_t " + reg.name.upper() + "_RESET = " + reg.reset + ";\n"
s += "\n"

if reg.sig_type == "fields":
for field in reg.fields:
s += "/* Field: " + field.name + " */\n"
s += (
"static const uint32_t "
"const uint32_t "
+ reg.name.upper()
+ "_"
+ field.name.upper()
+ "_OFFSET = "
)
s += str(field.pos_low) + ";\n"
s += (
"static const uint32_t "
"const uint32_t "
+ reg.name.upper()
+ "_"
+ field.name.upper()
+ "_WIDTH = "
)
s += str(field.length) + ";\n"
s += (
"static const uint32_t "
"const uint32_t "
+ reg.name.upper()
+ "_"
+ field.name.upper()
+ "_RESET = "
)
s += field.reset + ";\n"
s += (
"static const uint32_t "
"const uint32_t "
+ reg.name.upper()
+ "_"
+ field.name.upper()
Expand Down
128 changes: 64 additions & 64 deletions example/example_axi/header/example_axi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,112 +6,112 @@
namespace EXAMPLE_AXI
{
/* Register: reg0 */
static const uint32_t REG0_OFFSET = 0x0;
static const uint32_t REG0_RESET = 0x0;
const uint32_t REG0_OFFSET = 0x0;
const uint32_t REG0_RESET = 0x0;

/* Register: reg1 */
static const uint32_t REG1_OFFSET = 0x4;
static const uint32_t REG1_RESET = 0x1;
const uint32_t REG1_OFFSET = 0x4;
const uint32_t REG1_RESET = 0x1;

/* Register: reg2 */
static const uint32_t REG2_OFFSET = 0x8;
static const uint32_t REG2_RESET = 0x0;
const uint32_t REG2_OFFSET = 0x8;
const uint32_t REG2_RESET = 0x0;

/* Register: reg3 */
static const uint32_t REG3_OFFSET = 0xc;
static const uint32_t REG3_RESET = 0x3;
const uint32_t REG3_OFFSET = 0xc;
const uint32_t REG3_RESET = 0x3;

/* Register: reg4 */
static const uint32_t REG4_OFFSET = 0x10;
static const uint32_t REG4_RESET = 0x0;
const uint32_t REG4_OFFSET = 0x10;
const uint32_t REG4_RESET = 0x0;

/* Register: reg5 */
static const uint32_t REG5_OFFSET = 0x14;
static const uint32_t REG5_RESET = 0xffffffff;
const uint32_t REG5_OFFSET = 0x14;
const uint32_t REG5_RESET = 0xffffffff;

/* Register: reg6 */
static const uint32_t REG6_OFFSET = 0x18;
static const uint32_t REG6_RESET = 0x0;
const uint32_t REG6_OFFSET = 0x18;
const uint32_t REG6_RESET = 0x0;

/* Register: reg7 */
static const uint32_t REG7_OFFSET = 0x1c;
static const uint32_t REG7_RESET = 0xad7;
const uint32_t REG7_OFFSET = 0x1c;
const uint32_t REG7_RESET = 0xad7;

/* Field: field0 */
static const uint32_t REG7_FIELD0_OFFSET = 0;
static const uint32_t REG7_FIELD0_WIDTH = 1;
static const uint32_t REG7_FIELD0_RESET = 0x1;
static const uint32_t REG7_FIELD0_MASK = 0x1;
const uint32_t REG7_FIELD0_OFFSET = 0;
const uint32_t REG7_FIELD0_WIDTH = 1;
const uint32_t REG7_FIELD0_RESET = 0x1;
const uint32_t REG7_FIELD0_MASK = 0x1;

/* Field: field1 */
static const uint32_t REG7_FIELD1_OFFSET = 1;
static const uint32_t REG7_FIELD1_WIDTH = 4;
static const uint32_t REG7_FIELD1_RESET = 0xb;
static const uint32_t REG7_FIELD1_MASK = 0x1e;
const uint32_t REG7_FIELD1_OFFSET = 1;
const uint32_t REG7_FIELD1_WIDTH = 4;
const uint32_t REG7_FIELD1_RESET = 0xb;
const uint32_t REG7_FIELD1_MASK = 0x1e;

/* Field: field2 */
static const uint32_t REG7_FIELD2_OFFSET = 5;
static const uint32_t REG7_FIELD2_WIDTH = 1;
static const uint32_t REG7_FIELD2_RESET = 0x0;
static const uint32_t REG7_FIELD2_MASK = 0x20;
const uint32_t REG7_FIELD2_OFFSET = 5;
const uint32_t REG7_FIELD2_WIDTH = 1;
const uint32_t REG7_FIELD2_RESET = 0x0;
const uint32_t REG7_FIELD2_MASK = 0x20;

/* Field: field3 */
static const uint32_t REG7_FIELD3_OFFSET = 6;
static const uint32_t REG7_FIELD3_WIDTH = 15;
static const uint32_t REG7_FIELD3_RESET = 0x2b;
static const uint32_t REG7_FIELD3_MASK = 0x1fffc0;
const uint32_t REG7_FIELD3_OFFSET = 6;
const uint32_t REG7_FIELD3_WIDTH = 15;
const uint32_t REG7_FIELD3_RESET = 0x2b;
const uint32_t REG7_FIELD3_MASK = 0x1fffc0;

/* Register: reg8 */
static const uint32_t REG8_OFFSET = 0x20;
static const uint32_t REG8_RESET = 0x0;
const uint32_t REG8_OFFSET = 0x20;
const uint32_t REG8_RESET = 0x0;

/* Field: field0 */
static const uint32_t REG8_FIELD0_OFFSET = 0;
static const uint32_t REG8_FIELD0_WIDTH = 1;
static const uint32_t REG8_FIELD0_RESET = 0x0;
static const uint32_t REG8_FIELD0_MASK = 0x1;
const uint32_t REG8_FIELD0_OFFSET = 0;
const uint32_t REG8_FIELD0_WIDTH = 1;
const uint32_t REG8_FIELD0_RESET = 0x0;
const uint32_t REG8_FIELD0_MASK = 0x1;

/* Field: field1 */
static const uint32_t REG8_FIELD1_OFFSET = 1;
static const uint32_t REG8_FIELD1_WIDTH = 19;
static const uint32_t REG8_FIELD1_RESET = 0x0;
static const uint32_t REG8_FIELD1_MASK = 0xffffe;
const uint32_t REG8_FIELD1_OFFSET = 1;
const uint32_t REG8_FIELD1_WIDTH = 19;
const uint32_t REG8_FIELD1_RESET = 0x0;
const uint32_t REG8_FIELD1_MASK = 0xffffe;

/* Field: field2 */
static const uint32_t REG8_FIELD2_OFFSET = 20;
static const uint32_t REG8_FIELD2_WIDTH = 1;
static const uint32_t REG8_FIELD2_RESET = 0x0;
static const uint32_t REG8_FIELD2_MASK = 0x100000;
const uint32_t REG8_FIELD2_OFFSET = 20;
const uint32_t REG8_FIELD2_WIDTH = 1;
const uint32_t REG8_FIELD2_RESET = 0x0;
const uint32_t REG8_FIELD2_MASK = 0x100000;

/* Field: field3 */
static const uint32_t REG8_FIELD3_OFFSET = 21;
static const uint32_t REG8_FIELD3_WIDTH = 3;
static const uint32_t REG8_FIELD3_RESET = 0x0;
static const uint32_t REG8_FIELD3_MASK = 0xe00000;
const uint32_t REG8_FIELD3_OFFSET = 21;
const uint32_t REG8_FIELD3_WIDTH = 3;
const uint32_t REG8_FIELD3_RESET = 0x0;
const uint32_t REG8_FIELD3_MASK = 0xe00000;

/* Register: reg9 */
static const uint32_t REG9_OFFSET = 0x24;
static const uint32_t REG9_RESET = 0x1;
const uint32_t REG9_OFFSET = 0x24;
const uint32_t REG9_RESET = 0x1;

/* Register: reg10 */
static const uint32_t REG10_OFFSET = 0x28;
static const uint32_t REG10_RESET = 0xa;
const uint32_t REG10_OFFSET = 0x28;
const uint32_t REG10_RESET = 0xa;

/* Register: reg11 */
static const uint32_t REG11_OFFSET = 0x2c;
static const uint32_t REG11_RESET = 0x3;
const uint32_t REG11_OFFSET = 0x2c;
const uint32_t REG11_RESET = 0x3;

/* Field: field0 */
static const uint32_t REG11_FIELD0_OFFSET = 0;
static const uint32_t REG11_FIELD0_WIDTH = 15;
static const uint32_t REG11_FIELD0_RESET = 0x3;
static const uint32_t REG11_FIELD0_MASK = 0x7fff;
const uint32_t REG11_FIELD0_OFFSET = 0;
const uint32_t REG11_FIELD0_WIDTH = 15;
const uint32_t REG11_FIELD0_RESET = 0x3;
const uint32_t REG11_FIELD0_MASK = 0x7fff;

/* Field: field1 */
static const uint32_t REG11_FIELD1_OFFSET = 15;
static const uint32_t REG11_FIELD1_WIDTH = 1;
static const uint32_t REG11_FIELD1_RESET = 0x0;
static const uint32_t REG11_FIELD1_MASK = 0x8000;
const uint32_t REG11_FIELD1_OFFSET = 15;
const uint32_t REG11_FIELD1_WIDTH = 1;
const uint32_t REG11_FIELD1_RESET = 0x0;
const uint32_t REG11_FIELD1_MASK = 0x8000;

};

Expand Down
Loading
Loading