rggen 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -17
- data/lib/rggen/base/component.rb +5 -1
- data/lib/rggen/base/component_factory.rb +12 -5
- data/lib/rggen/base/item.rb +19 -9
- data/lib/rggen/base/item_factory.rb +9 -5
- data/lib/rggen/builtins.rb +12 -15
- data/lib/rggen/builtins/bit_field/{field_model_creation.rb → field_model.rb} +12 -3
- data/lib/rggen/builtins/register/accessibility.rb +3 -3
- data/lib/rggen/builtins/register/address_decoder.rb +1 -1
- data/lib/rggen/builtins/register/array.rb +30 -28
- data/lib/rggen/builtins/register/bus_exporter.erb +28 -0
- data/lib/rggen/builtins/register/bus_exporter.rb +44 -0
- data/lib/rggen/builtins/register/{reg_model_constructor.rb → constructor.rb} +1 -1
- data/lib/rggen/builtins/register/external.rb +42 -0
- data/lib/rggen/builtins/register/field_model_creator.rb +5 -1
- data/lib/rggen/builtins/register/read_data.rb +4 -0
- data/lib/rggen/builtins/register/reg_model.rb +92 -0
- data/lib/rggen/builtins/register/shadow_index_configurator.rb +5 -1
- data/lib/rggen/builtins/register/sub_block_model.rb +34 -0
- data/lib/rggen/builtins/register_block/apb.erb +1 -0
- data/lib/rggen/builtins/register_block/axi4lite.erb +1 -0
- data/lib/rggen/builtins/register_block/{block_model_definition.rb → block_model.rb} +4 -2
- data/lib/rggen/builtins/register_block/{block_model_constructor.rb → constructor.rb} +1 -1
- data/lib/rggen/builtins/register_block/{block_model_default_map_creator.rb → default_map_creator.rb} +1 -1
- data/lib/rggen/builtins/register_block/host_if.rb +1 -0
- data/lib/rggen/builtins/register_block/{ral_package_definition.rb → ral_package.rb} +1 -1
- data/lib/rggen/builtins/register_block/response_mux.erb +15 -11
- data/lib/rggen/builtins/register_block/response_mux.rb +35 -4
- data/lib/rggen/builtins/register_block/sub_model_creator.rb +14 -0
- data/lib/rggen/builtins/register_block/top_module.rb +16 -0
- data/lib/rggen/core_components.rb +2 -0
- data/lib/rggen/core_components/configuration/item_factory.rb +1 -1
- data/lib/rggen/core_components/ral/component.rb +24 -0
- data/lib/rggen/core_components/ral/item.rb +50 -5
- data/lib/rggen/core_components/ral/setup.rb +1 -1
- data/lib/rggen/core_components/register_map/bit_field_factory.rb +1 -1
- data/lib/rggen/core_components/register_map/component.rb +4 -1
- data/lib/rggen/core_components/register_map/component_factory.rb +9 -0
- data/lib/rggen/core_components/register_map/item.rb +9 -7
- data/lib/rggen/core_components/register_map/item_factory.rb +2 -2
- data/lib/rggen/core_components/register_map/register_block_factory.rb +1 -1
- data/lib/rggen/core_components/register_map/register_factory.rb +1 -1
- data/lib/rggen/core_components/register_map/register_map_factory.rb +1 -1
- data/lib/rggen/core_components/rtl/item.rb +1 -1
- data/lib/rggen/input_base/component.rb +9 -0
- data/lib/rggen/output_base/code_utility.rb +6 -0
- data/lib/rggen/output_base/component.rb +1 -0
- data/lib/rggen/output_base/item_factory.rb +3 -0
- data/lib/rggen/output_base/verilog_utility/class_definition.rb +35 -0
- data/lib/rggen/output_base/verilog_utility/declaration.rb +11 -4
- data/lib/rggen/output_base/verilog_utility/identifier.rb +1 -1
- data/lib/rggen/output_base/verilog_utility/module_definition.rb +33 -7
- data/lib/rggen/version.rb +2 -2
- data/ral/rggen_ral_block.svh +3 -8
- data/ral/rggen_ral_macros.svh +9 -2
- data/rtl/register/rggen_bus_exporter.sv +96 -0
- data/rtl/register_block/rggen_host_if_apb.sv +2 -0
- data/rtl/register_block/rggen_host_if_axi4lite.sv +7 -1
- data/rtl/register_block/rggen_response_mux.sv +53 -23
- data/sample/sample.csv +15 -14
- data/sample/sample.xls +0 -0
- data/sample/sample.xlsx +0 -0
- data/sample/sample_0.sv +77 -14
- data/sample/sample_0_ral_pkg.sv +6 -2
- data/sample/sample_1.sv +17 -11
- data/sample/sample_1_ral_pkg.sv +1 -1
- data/sample/sample_setup.rb +6 -6
- data/setup/default.rb +6 -6
- metadata +20 -19
- data/lib/rggen/builtins/bit_field/field_model_declaration.rb +0 -9
- data/lib/rggen/builtins/register/field_model_declarations.rb +0 -7
- data/lib/rggen/builtins/register/reg_model_creation.rb +0 -64
- data/lib/rggen/builtins/register/reg_model_declaration.rb +0 -13
- data/lib/rggen/builtins/register/reg_model_definition.rb +0 -22
- data/lib/rggen/builtins/register_block/module_definition.rb +0 -13
- data/lib/rggen/builtins/register_block/reg_model_creator.rb +0 -14
- data/lib/rggen/builtins/register_block/reg_model_declarations.rb +0 -7
- data/lib/rggen/builtins/register_block/signal_declarations.rb +0 -9
data/lib/rggen/version.rb
CHANGED
data/ral/rggen_ral_block.svh
CHANGED
@@ -18,8 +18,7 @@ class rggen_ral_block extends uvm_reg_block;
|
|
18
18
|
|
19
19
|
extern protected virtual function void set_cfg(uvm_object cfg);
|
20
20
|
extern protected virtual function uvm_reg_map create_default_map();
|
21
|
-
extern protected virtual function void
|
22
|
-
extern protected virtual function void create_registers();
|
21
|
+
extern protected virtual function void create_sub_models();
|
23
22
|
endclass
|
24
23
|
|
25
24
|
function rggen_ral_block::new(string name, int has_coverage);
|
@@ -32,8 +31,7 @@ function void rggen_ral_block::configure(uvm_object cfg, uvm_reg_block parent, s
|
|
32
31
|
if (default_map == null) begin
|
33
32
|
default_map = create_default_map();
|
34
33
|
end
|
35
|
-
|
36
|
-
create_registers();
|
34
|
+
create_sub_models();
|
37
35
|
endfunction
|
38
36
|
|
39
37
|
function uvm_reg_map rggen_ral_block::create_map(
|
@@ -76,9 +74,6 @@ endfunction
|
|
76
74
|
function uvm_reg_map rggen_ral_block::create_default_map();
|
77
75
|
endfunction
|
78
76
|
|
79
|
-
function void rggen_ral_block::
|
80
|
-
endfunction
|
81
|
-
|
82
|
-
function void rggen_ral_block::create_registers();
|
77
|
+
function void rggen_ral_block::create_sub_models();
|
83
78
|
endfunction
|
84
79
|
`endif
|
data/ral/rggen_ral_macros.svh
CHANGED
@@ -7,9 +7,9 @@ begin \
|
|
7
7
|
handle.configure(this.cfg, this, width, lsb, access, volatile, reset, has_reset, 1, 1); \
|
8
8
|
end
|
9
9
|
|
10
|
-
`define rggen_ral_create_reg_model(handle,
|
10
|
+
`define rggen_ral_create_reg_model(handle, base_name, array_index, offset_address, rights, unmapped) \
|
11
11
|
begin \
|
12
|
-
string __instance_name =
|
12
|
+
string __instance_name = base_name; \
|
13
13
|
int __array_index[$] = array_index; \
|
14
14
|
foreach (__array_index[__i]) begin \
|
15
15
|
$sformat(__instance_name, "%s[%0d]", __instance_name, __array_index[__i]); \
|
@@ -19,4 +19,11 @@ begin \
|
|
19
19
|
default_map.add_reg(handle, offset_address, rights, unmapped); \
|
20
20
|
end
|
21
21
|
|
22
|
+
`define rggen_ral_create_block_model(handle, name, offset_address) \
|
23
|
+
begin \
|
24
|
+
handle = new(name); \
|
25
|
+
handle.configure(this.cfg, this, ""); \
|
26
|
+
default_map.add_submap(handle.default_map, offset_address); \
|
27
|
+
end
|
28
|
+
|
22
29
|
`endif
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module rggen_bus_exporter #(
|
2
|
+
parameter DATA_WIDTH = 32,
|
3
|
+
parameter LOCAL_ADDRESS_WIDTH = 16,
|
4
|
+
parameter EXTERNAL_ADDRESS_WIDTH = 8,
|
5
|
+
parameter START_ADDRESS = 16'h0000
|
6
|
+
)(
|
7
|
+
input clk,
|
8
|
+
input rst_n,
|
9
|
+
input i_valid,
|
10
|
+
input i_select,
|
11
|
+
input i_write,
|
12
|
+
input i_read,
|
13
|
+
input [LOCAL_ADDRESS_WIDTH-1:0] i_address,
|
14
|
+
input [DATA_WIDTH/8-1:0] i_strobe,
|
15
|
+
input [DATA_WIDTH-1:0] i_write_data,
|
16
|
+
output o_ready,
|
17
|
+
output [DATA_WIDTH-1:0] o_read_data,
|
18
|
+
output [1:0] o_status,
|
19
|
+
output o_valid,
|
20
|
+
output o_write,
|
21
|
+
output o_read,
|
22
|
+
output [EXTERNAL_ADDRESS_WIDTH-1:0] o_address,
|
23
|
+
output [DATA_WIDTH/8-1:0] o_strobe,
|
24
|
+
output [DATA_WIDTH-1:0] o_write_data,
|
25
|
+
input i_ready,
|
26
|
+
input [DATA_WIDTH-1:0] i_read_data,
|
27
|
+
input [1:0] i_status
|
28
|
+
);
|
29
|
+
logic access_done;
|
30
|
+
logic valid;
|
31
|
+
logic write;
|
32
|
+
logic read;
|
33
|
+
logic [EXTERNAL_ADDRESS_WIDTH-1:0] address;
|
34
|
+
logic [DATA_WIDTH/8-1:0] strobe;
|
35
|
+
logic [DATA_WIDTH-1:0] write_data;
|
36
|
+
|
37
|
+
always_ff @(posedge clk or negedge rst_n) begin
|
38
|
+
if (!rst_n) begin
|
39
|
+
access_done <= 1'b0;
|
40
|
+
end
|
41
|
+
else if (valid && i_ready) begin
|
42
|
+
access_done <= 1'b1;
|
43
|
+
end
|
44
|
+
else begin
|
45
|
+
access_done <= 1'b0;
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
// Internal -> External
|
50
|
+
assign o_valid = valid;
|
51
|
+
assign o_write = write;
|
52
|
+
assign o_read = read;
|
53
|
+
assign o_address = address;
|
54
|
+
assign o_strobe = strobe;
|
55
|
+
assign o_write_data = write_data;
|
56
|
+
|
57
|
+
always_ff @(posedge clk or negedge rst_n) begin
|
58
|
+
if (!rst_n) begin
|
59
|
+
valid <= 1'b0;
|
60
|
+
write <= 1'b0;
|
61
|
+
read <= 1'b0;
|
62
|
+
address <= '0;
|
63
|
+
strobe <= '0;
|
64
|
+
write_data <= '0;
|
65
|
+
end
|
66
|
+
else if (valid && i_ready) begin
|
67
|
+
valid <= 1'b0;
|
68
|
+
write <= 1'b0;
|
69
|
+
read <= 1'b0;
|
70
|
+
address <= '0;
|
71
|
+
strobe <= '0;
|
72
|
+
write_data <= '0;
|
73
|
+
end
|
74
|
+
else if (i_valid && i_select && (!valid) && (!access_done)) begin
|
75
|
+
valid <= 1'b1;
|
76
|
+
write <= i_write;
|
77
|
+
read <= i_read;
|
78
|
+
address <= calc_address(i_address);
|
79
|
+
strobe <= i_strobe;
|
80
|
+
write_data <= i_write_data;
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
function automatic logic [EXTERNAL_ADDRESS_WIDTH-1:0] calc_address(
|
85
|
+
input [LOCAL_ADDRESS_WIDTH-1:0] address
|
86
|
+
);
|
87
|
+
logic [LOCAL_ADDRESS_WIDTH-1:0] external_address;
|
88
|
+
external_address = address - START_ADDRESS;
|
89
|
+
return external_address[EXTERNAL_ADDRESS_WIDTH-1:0];
|
90
|
+
endfunction
|
91
|
+
|
92
|
+
// External -> Internal
|
93
|
+
assign o_ready = i_ready;
|
94
|
+
assign o_read_data = i_read_data;
|
95
|
+
assign o_status = i_status;
|
96
|
+
endmodule
|
@@ -19,6 +19,7 @@ module rggen_host_if_apb #(
|
|
19
19
|
output o_write,
|
20
20
|
output o_read,
|
21
21
|
output [LOCAL_ADDRESS_WIDTH-1:0] o_address,
|
22
|
+
output [DATA_WIDTH/8-1:0] o_strobe,
|
22
23
|
output [DATA_WIDTH-1:0] o_write_data,
|
23
24
|
output [DATA_WIDTH-1:0] o_write_mask,
|
24
25
|
input i_response_ready,
|
@@ -35,6 +36,7 @@ module rggen_host_if_apb #(
|
|
35
36
|
assign o_write = i_pwrite;
|
36
37
|
assign o_read = ~i_pwrite;
|
37
38
|
assign o_address = i_paddr[LOCAL_ADDRESS_WIDTH-1:0];
|
39
|
+
assign o_strobe = i_pstrb;
|
38
40
|
assign o_write_data = i_pwdata;
|
39
41
|
assign o_write_mask = get_write_mask(i_pstrb);
|
40
42
|
endmodule
|
@@ -29,6 +29,7 @@ module rggen_host_if_axi4lite #(
|
|
29
29
|
output o_write,
|
30
30
|
output o_read,
|
31
31
|
output [LOCAL_ADDRESS_WIDTH-1:0] o_address,
|
32
|
+
output [DATA_WIDTH/8-1:0] o_strobe,
|
32
33
|
output [DATA_WIDTH-1:0] o_write_data,
|
33
34
|
output [DATA_WIDTH-1:0] o_write_mask,
|
34
35
|
input i_response_ready,
|
@@ -78,6 +79,7 @@ module rggen_host_if_axi4lite #(
|
|
78
79
|
logic command_valid;
|
79
80
|
logic local_done;
|
80
81
|
logic [LOCAL_ADDRESS_WIDTH-1:0] address;
|
82
|
+
logic [DATA_WIDTH/8-1:0] strobe;
|
81
83
|
logic [DATA_WIDTH-1:0] write_data;
|
82
84
|
logic [DATA_WIDTH-1:0] write_mask;
|
83
85
|
|
@@ -199,9 +201,10 @@ module rggen_host_if_axi4lite #(
|
|
199
201
|
// Local bus
|
200
202
|
//--------------------------------------------------------------
|
201
203
|
assign o_command_valid = command_valid;
|
202
|
-
assign o_address = address;
|
203
204
|
assign o_write = state[2];
|
204
205
|
assign o_read = state[4];
|
206
|
+
assign o_address = address;
|
207
|
+
assign o_strobe = strobe;
|
205
208
|
assign o_write_data = write_data;
|
206
209
|
assign o_write_mask = write_mask;
|
207
210
|
|
@@ -236,14 +239,17 @@ module rggen_host_if_axi4lite #(
|
|
236
239
|
|
237
240
|
always_ff @(posedge clk or negedge rst_n) begin
|
238
241
|
if (!rst_n) begin
|
242
|
+
strobe <= '0;
|
239
243
|
write_data <= '0;
|
240
244
|
write_mask <= '0;
|
241
245
|
end
|
242
246
|
else if (wack) begin
|
247
|
+
strobe <= i_wstrb;
|
243
248
|
write_data <= i_wdata;
|
244
249
|
write_mask <= get_write_mask(i_wstrb);
|
245
250
|
end
|
246
251
|
else if (local_done) begin
|
252
|
+
strobe <= '0;
|
247
253
|
write_data <= '0;
|
248
254
|
write_mask <= '0;
|
249
255
|
end
|
@@ -1,23 +1,34 @@
|
|
1
1
|
module rggen_response_mux #(
|
2
|
-
parameter DATA_WIDTH
|
3
|
-
parameter TOTAL_REGISTERS
|
2
|
+
parameter DATA_WIDTH = 32,
|
3
|
+
parameter TOTAL_REGISTERS = 1,
|
4
|
+
parameter TOTAL_EXTERNAL_REGISTERS = 0,
|
5
|
+
parameter EXTERNAL_REGISTERS = TOTAL_EXTERNAL_REGISTERS
|
6
|
+
+ ((TOTAL_EXTERNAL_REGISTERS == 0) ? 1 : 0)
|
4
7
|
)(
|
5
|
-
input
|
6
|
-
input
|
7
|
-
input
|
8
|
-
input
|
9
|
-
output
|
10
|
-
output [DATA_WIDTH-1:0]
|
11
|
-
output [1:0]
|
12
|
-
input [TOTAL_REGISTERS-1:0]
|
13
|
-
input [DATA_WIDTH-1:0]
|
8
|
+
input clk,
|
9
|
+
input rst_n,
|
10
|
+
input i_command_valid,
|
11
|
+
input i_read,
|
12
|
+
output o_response_ready,
|
13
|
+
output [DATA_WIDTH-1:0] o_read_data,
|
14
|
+
output [1:0] o_status,
|
15
|
+
input [TOTAL_REGISTERS-1:0] i_register_select,
|
16
|
+
input [DATA_WIDTH-1:0] i_register_read_data[TOTAL_REGISTERS],
|
17
|
+
input [EXTERNAL_REGISTERS-1:0] i_external_register_select,
|
18
|
+
input [EXTERNAL_REGISTERS-1:0] i_external_register_ready,
|
19
|
+
input [1:0] i_external_register_status[EXTERNAL_REGISTERS]
|
14
20
|
);
|
15
21
|
// Response ready
|
22
|
+
logic internal_ready;
|
23
|
+
logic external_ready;
|
16
24
|
logic response_valid;
|
17
25
|
logic response_ready;
|
18
26
|
|
27
|
+
assign internal_ready = (TOTAL_EXTERNAL_REGISTERS > 0) ? ~|i_external_register_select : 1'b1;
|
28
|
+
assign external_ready = (TOTAL_EXTERNAL_REGISTERS > 0) ? |i_external_register_ready : 1'b0;
|
29
|
+
assign response_valid = i_command_valid & (internal_ready | external_ready) & (~response_ready);
|
30
|
+
|
19
31
|
assign o_response_ready = response_ready;
|
20
|
-
assign response_valid = (i_command_valid && (!response_ready)) ? 1'b1 : 1'b0;
|
21
32
|
always_ff @(posedge clk or negedge rst_n) begin
|
22
33
|
if (!rst_n) begin
|
23
34
|
response_ready <= 1'b0;
|
@@ -31,28 +42,50 @@ module rggen_response_mux #(
|
|
31
42
|
end
|
32
43
|
|
33
44
|
// Status
|
34
|
-
logic slave_error;
|
35
|
-
logic exokay;
|
36
45
|
logic [1:0] status;
|
37
46
|
|
38
47
|
assign o_status = status;
|
39
|
-
assign slave_error = (TOTAL_REGISTERS == 1) ? ~i_register_select[0] : ~|i_register_select;
|
40
|
-
assign exokay = 1'b0;
|
41
48
|
always_ff @(posedge clk or negedge rst_n) begin
|
42
49
|
if (!rst_n) begin
|
43
50
|
status <= 2'b00;
|
44
51
|
end
|
45
52
|
else if (response_valid) begin
|
46
|
-
status <=
|
53
|
+
status <= get_internal_response(i_register_select)
|
54
|
+
| get_external_response(i_external_register_select, i_external_register_status);
|
47
55
|
end
|
48
56
|
else begin
|
49
57
|
status <= 2'b00;
|
50
58
|
end
|
51
59
|
end
|
52
60
|
|
61
|
+
function automatic logic [1:0] get_internal_response(
|
62
|
+
input [TOTAL_REGISTERS-1:0] register_select
|
63
|
+
);
|
64
|
+
logic slave_error;
|
65
|
+
logic exokay;
|
66
|
+
slave_error = ~|register_select;
|
67
|
+
exokay = 1'b0;
|
68
|
+
return {exokay, slave_error};
|
69
|
+
endfunction
|
70
|
+
|
71
|
+
function automatic logic [1:0] get_external_response(
|
72
|
+
input [EXTERNAL_REGISTERS-1:0] external_register_select,
|
73
|
+
input [1:0] external_register_status[EXTERNAL_REGISTERS]
|
74
|
+
);
|
75
|
+
if (TOTAL_EXTERNAL_REGISTERS > 0) begin
|
76
|
+
logic [1:0] masked_status[TOTAL_EXTERNAL_REGISTERS];
|
77
|
+
for (int i = 0;i < TOTAL_EXTERNAL_REGISTERS;i++) begin
|
78
|
+
masked_status[i] = {2{external_register_select[i]}} & external_register_status[i];
|
79
|
+
end
|
80
|
+
return masked_status.or();
|
81
|
+
end
|
82
|
+
else begin
|
83
|
+
return 2'b00;
|
84
|
+
end
|
85
|
+
endfunction
|
86
|
+
|
53
87
|
// Read data
|
54
88
|
logic [DATA_WIDTH-1:0] read_data;
|
55
|
-
logic [DATA_WIDTH-1:0] selected_data;
|
56
89
|
|
57
90
|
assign o_read_data = read_data;
|
58
91
|
always_ff @(posedge clk or negedge rst_n) begin
|
@@ -60,17 +93,14 @@ module rggen_response_mux #(
|
|
60
93
|
read_data <= '0;
|
61
94
|
end
|
62
95
|
else if (response_valid && i_read) begin
|
63
|
-
read_data <=
|
64
|
-
.select (i_register_select ),
|
65
|
-
.read_data (i_register_read_data )
|
66
|
-
);
|
96
|
+
read_data <= get_read_data(i_register_select, i_register_read_data);
|
67
97
|
end
|
68
98
|
else begin
|
69
99
|
read_data <= '0;
|
70
100
|
end
|
71
101
|
end
|
72
102
|
|
73
|
-
function automatic logic [DATA_WIDTH-1:0]
|
103
|
+
function automatic logic [DATA_WIDTH-1:0] get_read_data(
|
74
104
|
input logic [TOTAL_REGISTERS-1:0] select,
|
75
105
|
input logic [DATA_WIDTH-1:0] read_data[TOTAL_REGISTERS]
|
76
106
|
);
|
data/sample/sample.csv
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
,block name,block_0
|
2
|
-
,byte size,256
|
3
|
-
|
4
|
-
,offset address,registe name,array dimension,shadow index,assignment,field name,type,initial value,reference
|
5
|
-
,0x00,register_0
|
6
|
-
|
7
|
-
,0x04,register_1
|
8
|
-
,0x08,register_2
|
9
|
-
|
10
|
-
,0x0C,register_3
|
11
|
-
,0x10 - 0x1F,register_4,[4]
|
12
|
-
|
13
|
-
,0x20,register_5,"[2,4]","bit_field_2_1:1, bit_field_0_0, bit_field_0_1"
|
14
|
-
|
1
|
+
,block name,block_0,,,,,,,,
|
2
|
+
,byte size,256,,,,,,,,
|
3
|
+
,,,,,,,,,,
|
4
|
+
,offset address,registe name,array dimension,shadow index,external,assignment,field name,type,initial value,reference
|
5
|
+
,0x00,register_0,,,,[31:16],bit_field_0_0,rw,0,
|
6
|
+
,,,,,,[15:0],bit_field_0_1,rw,0,
|
7
|
+
,0x04,register_1,,,,[31:0],bit_field_1_0,rw,0,
|
8
|
+
,0x08,register_2,,,,[16],bit_field_2_0,ro,,
|
9
|
+
,,,,,,[0],bit_field_2_1,rw,0,
|
10
|
+
,0x0C,register_3,,,,[31:0],bit_field_3_0,ro,,
|
11
|
+
,0x10 - 0x1F,register_4,[4],,,[31:16],bit_field_4_0,ro,,
|
12
|
+
,,,,,,[15:0],bit_field_4_1,rw,0,
|
13
|
+
,0x20,register_5,"[2,4]","bit_field_2_1:1, bit_field_0_0, bit_field_0_1",,[31:16],bit_field_5_0,ro,,
|
14
|
+
,,,,,,[15:0],bit_field_5_1,rw,0,
|
15
|
+
,0x80-0xFF,register_6,,,true,,,,,
|
data/sample/sample.xls
CHANGED
Binary file
|
data/sample/sample.xlsx
CHANGED
Binary file
|
data/sample/sample_0.sv
CHANGED
@@ -20,19 +20,32 @@ module sample_0 (
|
|
20
20
|
input [15:0] i_bit_field_4_0[4],
|
21
21
|
output [15:0] o_bit_field_4_1[4],
|
22
22
|
input [15:0] i_bit_field_5_0[2][4],
|
23
|
-
output [15:0] o_bit_field_5_1[2][4]
|
23
|
+
output [15:0] o_bit_field_5_1[2][4],
|
24
|
+
output o_register_6_valid,
|
25
|
+
output o_register_6_write,
|
26
|
+
output o_register_6_read,
|
27
|
+
output [6:0] o_register_6_address,
|
28
|
+
output [3:0] o_register_6_strobe,
|
29
|
+
output [31:0] o_register_6_write_data,
|
30
|
+
input i_register_6_ready,
|
31
|
+
input [1:0] i_register_6_status,
|
32
|
+
input [31:0] i_register_6_read_data
|
24
33
|
);
|
25
34
|
logic command_valid;
|
26
35
|
logic write;
|
27
36
|
logic read;
|
28
37
|
logic [7:0] address;
|
38
|
+
logic [3:0] strobe;
|
29
39
|
logic [31:0] write_data;
|
30
40
|
logic [31:0] write_mask;
|
31
41
|
logic response_ready;
|
32
42
|
logic [31:0] read_data;
|
33
43
|
logic [1:0] status;
|
34
|
-
logic [
|
35
|
-
logic [31:0] register_read_data[
|
44
|
+
logic [16:0] register_select;
|
45
|
+
logic [31:0] register_read_data[17];
|
46
|
+
logic [0:0] external_register_select;
|
47
|
+
logic [0:0] external_register_ready;
|
48
|
+
logic [1:0] external_register_status[1];
|
36
49
|
logic [15:0] bit_field_0_0_value;
|
37
50
|
logic [15:0] bit_field_0_1_value;
|
38
51
|
logic [31:0] bit_field_1_0_value;
|
@@ -65,6 +78,7 @@ module sample_0 (
|
|
65
78
|
.o_write (write),
|
66
79
|
.o_read (read),
|
67
80
|
.o_address (address),
|
81
|
+
.o_strobe (strobe),
|
68
82
|
.o_write_data (write_data),
|
69
83
|
.o_write_mask (write_mask),
|
70
84
|
.i_response_ready (response_ready),
|
@@ -72,18 +86,22 @@ module sample_0 (
|
|
72
86
|
.i_status (status)
|
73
87
|
);
|
74
88
|
rggen_response_mux #(
|
75
|
-
.DATA_WIDTH
|
76
|
-
.TOTAL_REGISTERS
|
89
|
+
.DATA_WIDTH (32),
|
90
|
+
.TOTAL_REGISTERS (17),
|
91
|
+
.TOTAL_EXTERNAL_REGISTERS (1)
|
77
92
|
) u_response_mux (
|
78
|
-
.clk
|
79
|
-
.rst_n
|
80
|
-
.i_command_valid
|
81
|
-
.i_read
|
82
|
-
.o_response_ready
|
83
|
-
.o_read_data
|
84
|
-
.o_status
|
85
|
-
.i_register_select
|
86
|
-
.i_register_read_data
|
93
|
+
.clk (clk),
|
94
|
+
.rst_n (rst_n),
|
95
|
+
.i_command_valid (command_valid),
|
96
|
+
.i_read (read),
|
97
|
+
.o_response_ready (response_ready),
|
98
|
+
.o_read_data (read_data),
|
99
|
+
.o_status (status),
|
100
|
+
.i_register_select (register_select),
|
101
|
+
.i_register_read_data (register_read_data),
|
102
|
+
.i_external_register_select (external_register_select),
|
103
|
+
.i_external_register_ready (external_register_ready),
|
104
|
+
.i_external_register_status (external_register_status)
|
87
105
|
);
|
88
106
|
rggen_address_decoder #(
|
89
107
|
.READABLE (1),
|
@@ -288,4 +306,49 @@ module sample_0 (
|
|
288
306
|
end
|
289
307
|
end
|
290
308
|
end endgenerate
|
309
|
+
rggen_address_decoder #(
|
310
|
+
.READABLE (1),
|
311
|
+
.WRITABLE (1),
|
312
|
+
.ADDRESS_WIDTH (6),
|
313
|
+
.START_ADDRESS (6'h20),
|
314
|
+
.END_ADDRESS (6'h3f),
|
315
|
+
.USE_SHADOW_INDEX (0),
|
316
|
+
.SHADOW_INDEX_WIDTH (1),
|
317
|
+
.SHADOW_INDEX_VALUE (1'h0)
|
318
|
+
) u_register_6_address_decoder (
|
319
|
+
.i_read (read),
|
320
|
+
.i_write (write),
|
321
|
+
.i_address (address[7:2]),
|
322
|
+
.i_shadow_index (1'h0),
|
323
|
+
.o_select (register_select[16])
|
324
|
+
);
|
325
|
+
assign external_register_select[0] = register_select[16];
|
326
|
+
rggen_bus_exporter #(
|
327
|
+
.DATA_WIDTH (32),
|
328
|
+
.LOCAL_ADDRESS_WIDTH (8),
|
329
|
+
.EXTERNAL_ADDRESS_WIDTH (7),
|
330
|
+
.START_ADDRESS (8'h80)
|
331
|
+
) u_register_6_bus_exporter (
|
332
|
+
.clk (clk),
|
333
|
+
.rst_n (rst_n),
|
334
|
+
.i_valid (command_valid),
|
335
|
+
.i_select (register_select[16]),
|
336
|
+
.i_write (write),
|
337
|
+
.i_read (read),
|
338
|
+
.i_address (address),
|
339
|
+
.i_strobe (strobe),
|
340
|
+
.i_write_data (write_data),
|
341
|
+
.o_ready (external_register_ready[0]),
|
342
|
+
.o_read_data (register_read_data[16]),
|
343
|
+
.o_status (external_register_status[0]),
|
344
|
+
.o_valid (o_register_6_valid),
|
345
|
+
.o_write (o_register_6_write),
|
346
|
+
.o_read (o_register_6_read),
|
347
|
+
.o_address (o_register_6_address),
|
348
|
+
.o_strobe (o_register_6_strobe),
|
349
|
+
.o_write_data (o_register_6_write_data),
|
350
|
+
.i_ready (i_register_6_ready),
|
351
|
+
.i_read_data (i_register_6_read_data),
|
352
|
+
.i_status (i_register_6_status)
|
353
|
+
);
|
291
354
|
endmodule
|