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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9611e480b9eff4632912dfa604681ad9c6d47acb
4
- data.tar.gz: b2e6bed99859b78f9f1f37ac0dcc81fc27e76625
3
+ metadata.gz: 59adc06a285ad26b4dd71b5fccef26cceba4ee7f
4
+ data.tar.gz: 2c08390336ae73726a619515cc9ed8a61d08eafa
5
5
  SHA512:
6
- metadata.gz: 8a4f1de7b40b716eb50556b652fbb0df751e890784c6379d789dd13b95423aa6af42486197d5a4ebe6dba2fef8913c57453b4f4b02069b0d5d1e0445516d8eb8
7
- data.tar.gz: 787b94fa2320624585fda53028cd9b0bfc5bdeaf85288bb2113bf52541e0c811dd583d95b2f460e0363fe7a0bee6ab5da308e626147152fb949b69b8f9d84696
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
- ### Write Configuration File
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
- ### Write Register Map Document
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
- ### Generate Source Code
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
- ### Compile Your Design
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
- RgGen has base RTL modules and RAL model classes to build RTL and UVM RAL model.
91
- Therefore, when you compile your design, you need to add these base modules and classes like below.
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
- +libext+.sv \
95
- -y $RGGEN_INSTALL_DIRECTORY/rtl/register_block \
96
- -y $RGGEN_INSTALL_DIRECTORY/rtl/register \
97
- -y $RGGEN_INSTALL_DIRECTORY/rtl/bit_field \
98
- -f $RGGEN_INSTALL_DIRECTORY/ral/compile.f \
99
- rtl/your_register_block.sv \
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
@@ -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
@@ -1,6 +1,6 @@
1
1
  module RgGen
2
2
  MAJOR = 0
3
3
  MINOR = 3
4
- TEENY = 1
4
+ TEENY = 2
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{TEENY}".freeze
6
6
  end
data/ral/compile.f CHANGED
@@ -1,4 +1,2 @@
1
- +incdir+${UVM_HOME}/src
2
1
  +incdir+${RGGEN_HOME}/ral
3
- ${UVM_HOME}/src/uvm_pkg.sv
4
- ${RGGEN_HOME}/ral/rgen_ral_pkg.sv
2
+ ${RGGEN_HOME}/ral/rggen_ral_pkg.sv
@@ -1,10 +1,10 @@
1
- `ifndef __RGEN_RAL_SHADOW_REG_SVH__
2
- `define __RGEN_RAL_SHADOW_REG_SVH__
3
- typedef class rgen_ral_shadow_reg_index;
4
- typedef class rgen_ral_shadow_reg_ftdr_seq;
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 rgen_ral_shadow_reg extends rgen_ral_reg;
7
- protected rgen_ral_shadow_reg_index shadow_reg_indexes[$];
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 rgen_ral_shadow_reg::new(string name, int unsigned n_bits, int has_coverage);
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 rgen_ral_shadow_reg::configure(
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 rgen_ral_shadow_reg::create_frontdoor();
42
- rgen_ral_shadow_reg_ftdr_seq fd = new(shadow_reg_indexes);
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 rgen_ral_shadow_reg::is_active();
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 rgen_ral_shadow_reg::configure_shadow_indexes();
55
+ function void rggen_ral_shadow_reg::configure_shadow_indexes();
56
56
  endfunction
57
57
 
58
- function void rgen_ral_shadow_reg::set_shadow_index(string reg_name, string field_name, uvm_reg_data_t value);
59
- rgen_ral_shadow_reg_index shadow_reg_index;
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 rgen_ral_shadow_reg_index;
65
- protected rgen_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;
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
- rgen_ral_shadow_reg shadow_reg,
73
- string reg_name,
74
- string field_name,
75
- uvm_reg_data_t value
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 rgen_ral_shadow_reg_index::new(
94
- rgen_ral_shadow_reg shadow_reg,
95
- string reg_name,
96
- string field_name,
97
- uvm_reg_data_t value
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 rgen_ral_shadow_reg_index::is_matched();
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 rgen_ral_shadow_reg_index::update(
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 rgen_ral_shadow_reg_index::get_index_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("rgen_ral_shadow_reg_index", $sformatf("Unable to locate index register: %s", reg_name))
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("rgen_ral_shadow_reg_index", $sformatf("Unable to locate index field: %s", field_name))
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 rgen_ral_shadow_reg_ftdr_seq extends uvm_reg_frontdoor;
147
- protected rgen_ral_shadow_reg_index shadow_indexes[$];
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 rgen_ral_shadow_reg_index shadow_indexes[$]);
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 rgen_ral_shadow_reg_ftdr_seq::new(ref rgen_ral_shadow_reg_index shadow_indexes[$]);
155
- super.new("rgen_ral_shadow_reg_ftdr_seq");
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 rgen_ral_shadow_reg_ftdr_seq::body();
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("rgen_ral_shadow_reg_ftdr_seq", "Updating index field failed")
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
@@ -0,0 +1,4 @@
1
+ +libext+.sv
2
+ -y ${RGGEN_HOME}/rtl/bit_field
3
+ -y ${RGGEN_HOME}/rtl/register
4
+ -y ${RGGEN_HOME}/rtl/register_block
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.1
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-14 00:00:00.000000000 Z
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