-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from stefanlippuner/same-label-c
Omit duplicate defines in C Headers
- Loading branch information
Showing
15 changed files
with
220 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#define SAME_LABEL_REG_SIZE 16 | ||
#define ADDR_SAME_LABEL_REG_NO_FIELDS 0x0UL | ||
#define SAME_LABEL_REG_NO_FIELDS_PRESET 0x20UL | ||
#define ADDR_SAME_LABEL_REG_SAME_NAME 0x4UL | ||
#define SAME_LABEL_REG_SAME_NAME_OFFSET 0 | ||
#define SAME_LABEL_REG_SAME_NAME 0x1UL | ||
#define ADDR_SAME_LABEL_REG_SAME_NAME_MULTI 0x8UL | ||
#define SAME_LABEL_REG_SAME_NAME_MULTI_OFFSET 0 | ||
#define SAME_LABEL_REG_SAME_NAME_MULTI 0xfffUL | ||
#define ADDR_SAME_LABEL_REG_NOT_SAME_REG 0xcUL | ||
#define ADDR_SAME_LABEL_REG_NOT_SAME 0xcUL | ||
#define SAME_LABEL_REG_NOT_SAME_OFFSET 0 | ||
#define SAME_LABEL_REG_NOT_SAME 0x1UL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package same_label_reg_Consts; | ||
localparam SAME_LABEL_REG_SIZE = 16; | ||
localparam ADDR_SAME_LABEL_REG_NO_FIELDS = 'h0; | ||
localparam SAME_LABEL_REG_NO_FIELDS_PRESET = 8'h20; | ||
localparam ADDR_SAME_LABEL_REG_SAME_NAME = 'h4; | ||
localparam SAME_LABEL_REG_SAME_NAME_OFFSET = 0; | ||
localparam SAME_LABEL_REG_SAME_NAME = 32'h1; | ||
localparam ADDR_SAME_LABEL_REG_SAME_NAME_MULTI = 'h8; | ||
localparam SAME_LABEL_REG_SAME_NAME_MULTI_OFFSET = 0; | ||
localparam SAME_LABEL_REG_SAME_NAME_MULTI = 32'hfff; | ||
localparam ADDR_SAME_LABEL_REG_NOT_SAME_REG = 'hc; | ||
localparam ADDR_SAME_LABEL_REG_NOT_SAME = 'hc; | ||
localparam SAME_LABEL_REG_NOT_SAME_OFFSET = 0; | ||
localparam SAME_LABEL_REG_NOT_SAME = 32'h1; | ||
endpackage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
`define SAME_LABEL_REG_SIZE 16 | ||
`define ADDR_SAME_LABEL_REG_NO_FIELDS 'h0 | ||
`define SAME_LABEL_REG_NO_FIELDS_PRESET 'h20 | ||
`define ADDR_SAME_LABEL_REG_SAME_NAME 'h4 | ||
`define SAME_LABEL_REG_SAME_NAME_OFFSET 0 | ||
`define SAME_LABEL_REG_SAME_NAME 'h1 | ||
`define ADDR_SAME_LABEL_REG_SAME_NAME_MULTI 'h8 | ||
`define SAME_LABEL_REG_SAME_NAME_MULTI_OFFSET 0 | ||
`define SAME_LABEL_REG_SAME_NAME_MULTI 'hfff | ||
`define ADDR_SAME_LABEL_REG_NOT_SAME_REG 'hc | ||
`define ADDR_SAME_LABEL_REG_NOT_SAME 'hc | ||
`define SAME_LABEL_REG_NOT_SAME_OFFSET 0 | ||
`define SAME_LABEL_REG_NOT_SAME 'h1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
|
||
package same_label_reg_Consts is | ||
constant SAME_LABEL_REG_SIZE : Natural := 16; | ||
constant ADDR_SAME_LABEL_REG_NO_FIELDS : Natural := 16#0#; | ||
constant SAME_LABEL_REG_NO_FIELDS_PRESET : std_logic_vector(8-1 downto 0) := x"20"; | ||
constant ADDR_SAME_LABEL_REG_SAME_NAME : Natural := 16#4#; | ||
constant SAME_LABEL_REG_SAME_NAME_OFFSET : Natural := 0; | ||
constant ADDR_SAME_LABEL_REG_SAME_NAME_MULTI : Natural := 16#8#; | ||
constant SAME_LABEL_REG_SAME_NAME_MULTI_OFFSET : Natural := 0; | ||
constant ADDR_SAME_LABEL_REG_NOT_SAME_REG : Natural := 16#c#; | ||
constant ADDR_SAME_LABEL_REG_NOT_SAME : Natural := 16#c#; | ||
constant SAME_LABEL_REG_NOT_SAME_OFFSET : Natural := 0; | ||
end package same_label_reg_Consts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
|
||
package same_label_reg_consts_pkg is | ||
constant c_SAME_LABEL_REG_SIZE : Natural := 16; | ||
constant c_SAME_LABEL_REG_NO_FIELDS_ADDR : Natural := 16#0#; | ||
constant c_SAME_LABEL_REG_NO_FIELDS_PRESET : std_logic_vector(8-1 downto 0) := x"20"; | ||
constant c_SAME_LABEL_REG_SAME_NAME_ADDR : Natural := 16#4#; | ||
constant c_SAME_LABEL_REG_SAME_NAME_OFFSET : Natural := 0; | ||
constant c_SAME_LABEL_REG_SAME_NAME_MULTI_ADDR : Natural := 16#8#; | ||
constant c_SAME_LABEL_REG_SAME_NAME_MULTI_OFFSET : Natural := 0; | ||
constant c_SAME_LABEL_REG_NOT_SAME_REG_ADDR : Natural := 16#c#; | ||
constant c_ADDR_SAME_LABEL_REG_NOT_SAME : Natural := 16#c#; | ||
constant c_SAME_LABEL_REG_NOT_SAME_OFFSET : Natural := 0; | ||
end package same_label_reg_consts_pkg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
memory-map: | ||
bus: apb-32 | ||
name: same_label_reg | ||
x-hdl: | ||
iogroup: regs | ||
pipeline: rd-out | ||
bus-error: True | ||
wmask: True | ||
reg-prefix: false # generate shorter register names | ||
description: 'Register map with same label.' | ||
children: | ||
- reg: | ||
name: no_fields | ||
description: 'Register without fields.' | ||
type: unsigned | ||
width: 8 | ||
x-hdl: | ||
type: const | ||
access: ro | ||
preset: 32 | ||
- reg: | ||
name: same_name | ||
description: 'Register with same-name field.' | ||
width: 32 | ||
access: ro | ||
x-hdl: | ||
read-strobe: True | ||
children: | ||
- field: | ||
name: same_name | ||
range: 0 | ||
- reg: | ||
name: same_name_multi | ||
description: 'Register with multi-bit same-name field.' | ||
width: 32 | ||
access: ro | ||
children: | ||
- field: | ||
name: same_name_multi | ||
range: 11-0 | ||
- reg: | ||
name: not_same_reg | ||
description: 'Register with different-name field.' | ||
width: 32 | ||
access: ro | ||
children: | ||
- field: | ||
name: not_same | ||
range: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef __CHEBY__SAME_LABEL_REG__H__ | ||
#define __CHEBY__SAME_LABEL_REG__H__ | ||
|
||
#include <stdint.h> | ||
|
||
#define SAME_LABEL_REG_SIZE 16 /* 0x10 */ | ||
|
||
/* Register without fields. */ | ||
#define SAME_LABEL_REG_NO_FIELDS 0x0UL | ||
#define SAME_LABEL_REG_NO_FIELDS_PRESET 0x20UL | ||
|
||
/* Register with same-name field. */ | ||
#define SAME_LABEL_REG_SAME_NAME 0x4UL | ||
|
||
/* Register with multi-bit same-name field. */ | ||
#define SAME_LABEL_REG_SAME_NAME_MULTI 0x8UL | ||
#define SAME_LABEL_REG_SAME_NAME_MULTI_MASK 0xfffUL | ||
#define SAME_LABEL_REG_SAME_NAME_MULTI_SHIFT 0 | ||
|
||
/* Register with different-name field. */ | ||
#define SAME_LABEL_REG_NOT_SAME_REG 0xcUL | ||
#define SAME_LABEL_REG_NOT_SAME 0x1UL | ||
|
||
#ifndef __ASSEMBLER__ | ||
struct same_label_reg { | ||
/* [0x0]: REG (ro) Register without fields. */ | ||
uint8_t no_fields; | ||
|
||
/* padding to: 4 Bytes */ | ||
uint8_t __padding_0[3]; | ||
|
||
/* [0x4]: REG (ro) Register with same-name field. */ | ||
uint32_t same_name; | ||
|
||
/* [0x8]: REG (ro) Register with multi-bit same-name field. */ | ||
uint32_t same_name_multi; | ||
|
||
/* [0xc]: REG (ro) Register with different-name field. */ | ||
uint32_t not_same_reg; | ||
}; | ||
#endif /* !__ASSEMBLER__*/ | ||
|
||
#endif /* __CHEBY__SAME_LABEL_REG__H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters