rggen 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -17
- data/bin/rggen +0 -0
- data/lib/rggen/generator.rb +9 -0
- data/lib/rggen/version.rb +1 -1
- data/ral/compile.f +1 -3
- data/ral/rggen_ral_shadow_reg.svh +41 -41
- data/rtl/compile.f +4 -0
- data/sample/sample.xls +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59adc06a285ad26b4dd71b5fccef26cceba4ee7f
|
4
|
+
data.tar.gz: 2c08390336ae73726a619515cc9ed8a61d08eafa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2ac02e37af14189c9ea8aca80f2cbc8dd55e61f5b1ee80a754d0fbac301299e6b630d9eabd880c4114cb3f8634d19bb405205b467b9a4daa31a41e3683dadca
|
7
|
+
data.tar.gz: ad4a174a3355412060839b9af4e38de1b79438eb001d52c809756c7addc357124beb1c8503700bb95f826751811f722dc0337ec6610536a5ca83debfe8177ac1
|
data/README.md
CHANGED
@@ -9,6 +9,12 @@ RgGen is a code generation tool for SoC designers.
|
|
9
9
|
It will automatically generate source code for control registers in a SoC design, e.g. RLT, UVM RAL model, from its register map document.
|
10
10
|
Also RgGen is customizable so you can build your specific generate tool.
|
11
11
|
|
12
|
+
## Ruby
|
13
|
+
|
14
|
+
RgGen is written in the [*Ruby*](https://www.ruby-lang.org/en/about/) programing language and supports version 2.0 or later.
|
15
|
+
If you don't have above version of Ruby, you need to install the Ruby at first.
|
16
|
+
To install the Ruby, see [this page](https://www.ruby-lang.org/en/downloads/).
|
17
|
+
|
12
18
|
## Installation
|
13
19
|
|
14
20
|
To install RgGen and required libraries, use the following command:
|
@@ -22,10 +28,9 @@ If you want to install them on other location, you need to specify the install d
|
|
22
28
|
$ gem install --install-dir YOUR_INSTALL_DIRECTORY rggen
|
23
29
|
$ export GEM_PATH=YOUR_INSTALL_DIRECTORY
|
24
30
|
|
25
|
-
|
26
31
|
## Usage
|
27
32
|
|
28
|
-
###
|
33
|
+
### Writing Configuration File
|
29
34
|
|
30
35
|
A configuration file is to describe attributes of your design, e.g. data bus width, address bus width, host interface protocol.
|
31
36
|
RgGen supports YAML and JSON for its file format and allows to use Hash notation to describe attributes of your design like below.
|
@@ -48,7 +53,7 @@ host_if: apb
|
|
48
53
|
These attributes have default values. If you use a default value, you don't specify its value.
|
49
54
|
In addition, if you use default values for all of attributes, you don't need to write a configuration file.
|
50
55
|
|
51
|
-
###
|
56
|
+
### Writing Register Map Document
|
52
57
|
|
53
58
|
RgGen allows to use a spreadsheet to input the register map of your design so you can directly input your register map document to RgGen.
|
54
59
|
To do this, you need to write your register map document according to below table format.
|
@@ -68,7 +73,7 @@ To do this, you need to write your register map document according to below tabl
|
|
68
73
|
|
69
74
|
By default, RgGen supports CSV, ODS, XLS and XLSX sparedsheet file types.
|
70
75
|
|
71
|
-
###
|
76
|
+
### Generating Source Code
|
72
77
|
|
73
78
|
To generate soruce code from your register map document, use the following command:
|
74
79
|
|
@@ -83,22 +88,31 @@ In addition, file name of generated files is accoding to below rule.
|
|
83
88
|
- RTL
|
84
89
|
- `your_block_name`.sv
|
85
90
|
- RAL model
|
86
|
-
- `your_block_name`_ral_pkg.sv
|
91
|
+
- `your_block_name`_ral_pkg.sv
|
92
|
+
|
93
|
+
### Compiling Your Design
|
87
94
|
|
88
|
-
|
95
|
+
RgGen has base RTL modules and RAL model package (the base library) to build generated RTL and UVM RAL models.
|
96
|
+
Therefore, To compile your design with the base library, you need followins steps:
|
89
97
|
|
90
|
-
|
91
|
-
|
98
|
+
1. Set the RGGEN_HOME environment variable
|
99
|
+
2. Link the base library with you design
|
100
|
+
|
101
|
+
**RGGEN_HOME** environement variable is to show the install direcoty.
|
102
|
+
To set the variable, you can use `--show-home` option like below:
|
103
|
+
|
104
|
+
$ export RGGEN_HOME=`rggen --show-home`
|
105
|
+
|
106
|
+
To link the base library with your design, RgGen has file lists for the base library.
|
107
|
+
By using the lists, you can compile your design and the base library like below:
|
92
108
|
|
93
109
|
$ simulator \
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
ral/your_register_block_ral_pkg.sv \
|
101
|
-
your_design.v
|
110
|
+
-f $RGGEN_HOME/rtl/compile.f \
|
111
|
+
-f $RGGEN_HOME/ral/compile.f \
|
112
|
+
rtl/your_register_block.sv \
|
113
|
+
ral/your_register_block_ral_pkg.sv \
|
114
|
+
your_test_bench.sv \
|
115
|
+
your_design.v
|
102
116
|
|
103
117
|
### Note
|
104
118
|
|
@@ -115,7 +129,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
115
129
|
|
116
130
|
Bug reports and pull requests are welcome on GitHub at https://github.com/taichi-ishitani/rggen. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
117
131
|
|
118
|
-
|
119
132
|
## License
|
120
133
|
|
121
134
|
Copyright © 2015-2016 [Taichi Ishitani](mailto:taichi730@gmail.com).
|
data/bin/rggen
CHANGED
File without changes
|
data/lib/rggen/generator.rb
CHANGED
@@ -92,6 +92,15 @@ module RgGen
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
add_option :show_home do |option|
|
96
|
+
option.long = '--show-home'
|
97
|
+
option.description = 'Display the path of RgGen tool home directory'
|
98
|
+
option.body = proc do
|
99
|
+
puts RGGEN_HOME
|
100
|
+
exit
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
95
104
|
add_option :version do |option|
|
96
105
|
option.short = '-v'
|
97
106
|
option.long = '--version'
|
data/lib/rggen/version.rb
CHANGED
data/ral/compile.f
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
`ifndef
|
2
|
-
`define
|
3
|
-
typedef class
|
4
|
-
typedef class
|
1
|
+
`ifndef __RGGEN_RAL_SHADOW_REG_SVH__
|
2
|
+
`define __RGGEN_RAL_SHADOW_REG_SVH__
|
3
|
+
typedef class rggen_ral_shadow_reg_index;
|
4
|
+
typedef class rggen_ral_shadow_reg_ftdr_seq;
|
5
5
|
|
6
|
-
class
|
7
|
-
protected
|
6
|
+
class rggen_ral_shadow_reg extends rggen_ral_reg;
|
7
|
+
protected rggen_ral_shadow_reg_index shadow_reg_indexes[$];
|
8
8
|
|
9
9
|
extern function new(string name, int unsigned n_bits, int has_coverage);
|
10
10
|
|
@@ -23,11 +23,11 @@ class rgen_ral_shadow_reg extends rgen_ral_reg;
|
|
23
23
|
extern protected function void set_shadow_index(string reg_name, string field_name, uvm_reg_data_t value);
|
24
24
|
endclass
|
25
25
|
|
26
|
-
function
|
26
|
+
function rggen_ral_shadow_reg::new(string name, int unsigned n_bits, int has_coverage);
|
27
27
|
super.new(name, n_bits, has_coverage);
|
28
28
|
endfunction
|
29
29
|
|
30
|
-
function void
|
30
|
+
function void rggen_ral_shadow_reg::configure(
|
31
31
|
uvm_object cfg,
|
32
32
|
uvm_reg_block blk_parent,
|
33
33
|
uvm_reg_file regfile_parent,
|
@@ -38,12 +38,12 @@ function void rgen_ral_shadow_reg::configure(
|
|
38
38
|
configure_shadow_indexes();
|
39
39
|
endfunction
|
40
40
|
|
41
|
-
function uvm_reg_frontdoor
|
42
|
-
|
41
|
+
function uvm_reg_frontdoor rggen_ral_shadow_reg::create_frontdoor();
|
42
|
+
rggen_ral_shadow_reg_ftdr_seq fd = new(shadow_reg_indexes);
|
43
43
|
return fd;
|
44
44
|
endfunction
|
45
45
|
|
46
|
-
function bit
|
46
|
+
function bit rggen_ral_shadow_reg::is_active();
|
47
47
|
foreach (shadow_reg_indexes[i]) begin
|
48
48
|
if (!shadow_reg_indexes[i].is_matched()) begin
|
49
49
|
return 0;
|
@@ -52,27 +52,27 @@ function bit rgen_ral_shadow_reg::is_active();
|
|
52
52
|
return 1;
|
53
53
|
endfunction
|
54
54
|
|
55
|
-
function void
|
55
|
+
function void rggen_ral_shadow_reg::configure_shadow_indexes();
|
56
56
|
endfunction
|
57
57
|
|
58
|
-
function void
|
59
|
-
|
58
|
+
function void rggen_ral_shadow_reg::set_shadow_index(string reg_name, string field_name, uvm_reg_data_t value);
|
59
|
+
rggen_ral_shadow_reg_index shadow_reg_index;
|
60
60
|
shadow_reg_index = new(this, reg_name, field_name, value);
|
61
61
|
shadow_reg_indexes.push_back(shadow_reg_index);
|
62
62
|
endfunction
|
63
63
|
|
64
|
-
class
|
65
|
-
protected
|
66
|
-
protected string
|
67
|
-
protected string
|
68
|
-
protected uvm_reg_data_t
|
69
|
-
protected uvm_reg_field
|
64
|
+
class rggen_ral_shadow_reg_index;
|
65
|
+
protected rggen_ral_shadow_reg shadow_reg;
|
66
|
+
protected string reg_name;
|
67
|
+
protected string field_name;
|
68
|
+
protected uvm_reg_data_t value;
|
69
|
+
protected uvm_reg_field index_field;
|
70
70
|
|
71
71
|
extern function new(
|
72
|
-
|
73
|
-
string
|
74
|
-
string
|
75
|
-
uvm_reg_data_t
|
72
|
+
rggen_ral_shadow_reg shadow_reg,
|
73
|
+
string reg_name,
|
74
|
+
string field_name,
|
75
|
+
uvm_reg_data_t value
|
76
76
|
);
|
77
77
|
|
78
78
|
extern virtual function bit is_matched();
|
@@ -90,11 +90,11 @@ class rgen_ral_shadow_reg_index;
|
|
90
90
|
extern protected virtual function uvm_reg_field get_index_field();
|
91
91
|
endclass
|
92
92
|
|
93
|
-
function
|
94
|
-
|
95
|
-
string
|
96
|
-
string
|
97
|
-
uvm_reg_data_t
|
93
|
+
function rggen_ral_shadow_reg_index::new(
|
94
|
+
rggen_ral_shadow_reg shadow_reg,
|
95
|
+
string reg_name,
|
96
|
+
string field_name,
|
97
|
+
uvm_reg_data_t value
|
98
98
|
);
|
99
99
|
this.shadow_reg = shadow_reg;
|
100
100
|
this.reg_name = reg_name;
|
@@ -102,12 +102,12 @@ function rgen_ral_shadow_reg_index::new(
|
|
102
102
|
this.value = value;
|
103
103
|
endfunction
|
104
104
|
|
105
|
-
function bit
|
105
|
+
function bit rggen_ral_shadow_reg_index::is_matched();
|
106
106
|
uvm_reg_field field = get_index_field();
|
107
107
|
return (field.value == value) ? 1 : 0;
|
108
108
|
endfunction
|
109
109
|
|
110
|
-
task
|
110
|
+
task rggen_ral_shadow_reg_index::update(
|
111
111
|
output uvm_status_e status,
|
112
112
|
input uvm_path_e path,
|
113
113
|
input uvm_reg_map map,
|
@@ -123,42 +123,42 @@ task rgen_ral_shadow_reg_index::update(
|
|
123
123
|
parent_reg.update(status, path, map, parent, prior, extension, fname, lineno);
|
124
124
|
endtask
|
125
125
|
|
126
|
-
function uvm_reg_field
|
126
|
+
function uvm_reg_field rggen_ral_shadow_reg_index::get_index_field();
|
127
127
|
if (index_field == null) begin
|
128
128
|
uvm_reg_block parent_block = shadow_reg.get_parent();
|
129
129
|
uvm_reg index_reg;
|
130
130
|
|
131
131
|
index_reg = parent_block.get_reg_by_name(reg_name);
|
132
132
|
if (index_reg == null) begin
|
133
|
-
`uvm_fatal("
|
133
|
+
`uvm_fatal("rggen_ral_shadow_reg_index", $sformatf("Unable to locate index register: %s", reg_name))
|
134
134
|
return null;
|
135
135
|
end
|
136
136
|
|
137
137
|
index_field = index_reg.get_field_by_name(field_name);
|
138
138
|
if (index_field == null) begin
|
139
|
-
`uvm_fatal("
|
139
|
+
`uvm_fatal("rggen_ral_shadow_reg_index", $sformatf("Unable to locate index field: %s", field_name))
|
140
140
|
return null;
|
141
141
|
end
|
142
142
|
end
|
143
143
|
return index_field;
|
144
144
|
endfunction
|
145
145
|
|
146
|
-
class
|
147
|
-
protected
|
146
|
+
class rggen_ral_shadow_reg_ftdr_seq extends uvm_reg_frontdoor;
|
147
|
+
protected rggen_ral_shadow_reg_index shadow_indexes[$];
|
148
148
|
|
149
|
-
extern function new(ref
|
149
|
+
extern function new(ref rggen_ral_shadow_reg_index shadow_indexes[$]);
|
150
150
|
|
151
151
|
extern virtual task body();
|
152
152
|
endclass
|
153
153
|
|
154
|
-
function
|
155
|
-
super.new("
|
154
|
+
function rggen_ral_shadow_reg_ftdr_seq::new(ref rggen_ral_shadow_reg_index shadow_indexes[$]);
|
155
|
+
super.new("rggen_ral_shadow_reg_ftdr_seq");
|
156
156
|
foreach (shadow_indexes[i]) begin
|
157
157
|
this.shadow_indexes.push_back(shadow_indexes[i]);
|
158
158
|
end
|
159
159
|
endfunction
|
160
160
|
|
161
|
-
task
|
161
|
+
task rggen_ral_shadow_reg_ftdr_seq::body();
|
162
162
|
foreach (shadow_indexes[i]) begin
|
163
163
|
uvm_status_e status;
|
164
164
|
shadow_indexes[i].update(
|
@@ -172,7 +172,7 @@ task rgen_ral_shadow_reg_ftdr_seq::body();
|
|
172
172
|
rw_info.lineno
|
173
173
|
);
|
174
174
|
if (status == UVM_NOT_OK) begin
|
175
|
-
`uvm_warning("
|
175
|
+
`uvm_warning("rggen_ral_shadow_reg_ftdr_seq", "Updating index field failed")
|
176
176
|
rw_info.status = status;
|
177
177
|
return;
|
178
178
|
end
|
data/rtl/compile.f
ADDED
data/sample/sample.xls
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rggen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: baby_erubis
|
@@ -255,6 +255,7 @@ files:
|
|
255
255
|
- ral/rggen_ral_shadow_reg.svh
|
256
256
|
- rggen.gemspec
|
257
257
|
- rtl/bit_field/rggen_bit_field_rw.sv
|
258
|
+
- rtl/compile.f
|
258
259
|
- rtl/register/rggen_address_decoder.sv
|
259
260
|
- rtl/register_block/rggen_host_if_apb.sv
|
260
261
|
- rtl/register_block/rggen_response_mux.sv
|