rggen 0.4.2 → 0.4.3

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: b4a6ce8cdb613957faf3d1261a338b84a8b631ac
4
- data.tar.gz: 5cca3d0af73d1aa9d81d6eac43dc583fabb86491
3
+ metadata.gz: 1ba0218ce7f598b273e2c24a9ddfb965b53cfbb0
4
+ data.tar.gz: 8f8595953d40b2818c11535f6d17e181c64ee37d
5
5
  SHA512:
6
- metadata.gz: 5f74630a5687e2ab0f8a20ddb647726ee139dc240642c834e1826272bbb29e8b8066b5140c70b33d0cfc45a6828058aac53c51b195d8fb4af34f3078af7a6965
7
- data.tar.gz: 1de526c92b6c4c6304bdb4d6dcb85d0487fe8c522ad25ac369178ce5901d72f13881e5285cfb443246a8353fa63e8e1eec8b0c49c9bb056cab0f55bcaa9063fb
6
+ metadata.gz: 6cd72549ff84a9901c866890b6d685fbc528619e898fb012043e71dc7b3dc9a45c36e332ccfb29790c005caa928294c45ee6c0649f5c477425694163793510ae
7
+ data.tar.gz: 53d5e50d624edc590be59916889603e12552a2ffc876d80b6780616cdb1278ca70d2ba0910520735e82cd11b077f599b96870b1732daf44baeac24d5ada1e591
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rggen.svg)](https://badge.fury.io/rb/rggen)
2
2
  [![Build Status](https://travis-ci.org/taichi-ishitani/rggen.svg?branch=master)](https://travis-ci.org/taichi-ishitani/rggen)
3
+ [![Dependency Status](https://dependencyci.com/github/taichi-ishitani/rggen/badge)](https://dependencyci.com/github/taichi-ishitani/rggen)
3
4
  [![Code Climate](https://codeclimate.com/github/taichi-ishitani/rggen/badges/gpa.svg)](https://codeclimate.com/github/taichi-ishitani/rggen)
4
5
  [![Test Coverage](https://codeclimate.com/github/taichi-ishitani/rggen/badges/coverage.svg)](https://codeclimate.com/github/taichi-ishitani/rggen/coverage)
5
6
  [![Join the chat at https://gitter.im/taichi-ishitani/rggen](https://badges.gitter.im/taichi-ishitani/rggen.svg)](https://gitter.im/taichi-ishitani/rggen?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
data/lib/rggen.rb CHANGED
@@ -10,6 +10,7 @@ module RgGen
10
10
 
11
11
  require_relative 'rggen/exceptions'
12
12
 
13
+ require_relative 'rggen/core_extensions/array'
13
14
  require_relative 'rggen/core_extensions/facets'
14
15
  require_relative 'rggen/core_extensions/forwardable'
15
16
  require_relative 'rggen/core_extensions/integer'
@@ -34,9 +34,7 @@ simple_item :bit_field, :reference do
34
34
 
35
35
  def find_reference
36
36
  return nil unless has_reference?
37
- @found_reference ||= register_block.bit_fields.find do |bit_field|
38
- bit_field.name == @reference
39
- end
37
+ @found_reference ||= register_block.bit_fields.find_by(name: @reference)
40
38
  end
41
39
  end
42
40
  end
@@ -31,9 +31,7 @@ list_item :bit_field, :type, [:rwl, :rwe] do
31
31
  end
32
32
 
33
33
  def mode_field
34
- register_block.bit_fields.find do |f|
35
- f.name == bit_field.reference.name
36
- end
34
+ register_block.bit_fields.find_by(name: bit_field.reference.name)
37
35
  end
38
36
  end
39
37
 
@@ -1,11 +1,12 @@
1
- rggen_bit_field_w0c_w1c #(
2
- .WIDTH (<%= width %>),
3
- .INITIAL_VALUE (<%= initial_value %>),
4
- .CLEAR_VALUE (<%= clear_value %>)
1
+ rggen_bit_field_w01s_w01c #(
2
+ .WIDTH (<%= width %>),
3
+ .INITIAL_VALUE (<%= initial_value %>),
4
+ .SET_MODE (0),
5
+ .SET_CLEAR_VALUE (<%= clear_value %>)
5
6
  ) u_<%= name%> (
6
7
  .clk (<%= register_block.clock %>),
7
8
  .rst_n (<%= register_block.reset %>),
8
- .i_set (<%= set[loop_variables] %>),
9
+ .i_set_or_clear (<%= set[loop_variables] %>),
9
10
  .i_command_valid (<%= register_block.host_if.command_valid %>),
10
11
  .i_select (<%= register_block.register_select[index] %>),
11
12
  .i_write (<%= register_block.host_if.write %>),
@@ -20,7 +20,7 @@ list_item :bit_field, :type, [:w0c, :w1c] do
20
20
  end
21
21
 
22
22
  def clear_value
23
- bin({ w0c: 0, w1c: 1 }[type], 1)
23
+ { w0c: 0, w1c: 1 }[type]
24
24
  end
25
25
  end
26
26
  end
@@ -1,11 +1,12 @@
1
- rggen_bit_field_w0s_w1s #(
2
- .WIDTH (<%= width %>),
3
- .INITIAL_VALUE (<%= initial_value %>),
4
- .SET_VALUE (<%= set_value %>)
1
+ rggen_bit_field_w01s_w01c #(
2
+ .WIDTH (<%= width %>),
3
+ .INITIAL_VALUE (<%= initial_value %>),
4
+ .SET_MODE (1),
5
+ .SET_CLEAR_VALUE (<%= set_value %>)
5
6
  ) u_<%= name %> (
6
7
  .clk (<%= register_block.clock %>),
7
8
  .rst_n (<%= register_block.reset %>),
8
- .i_clear (<%= clear[loop_variables] %>),
9
+ .i_set_or_clear (<%= clear[loop_variables] %>),
9
10
  .i_command_valid (<%= register_block.host_if.command_valid %>),
10
11
  .i_select (<%= register_block.register_select[index] %>),
11
12
  .i_write (<%= register_block.host_if.write %>),
@@ -28,7 +28,7 @@ list_item :bit_field, :type, [:w0s, :w1s] do
28
28
  end
29
29
 
30
30
  def set_value
31
- bin({ w0s: 0, w1s: 1 }[type], 1)
31
+ { w0s: 0, w1s: 1 }[type]
32
32
  end
33
33
  end
34
34
  end
@@ -6,8 +6,6 @@ rggen_address_decoder #(
6
6
  .SHADOW_INDEX_WIDTH (<%= shadow_index_width %>),
7
7
  .SHADOW_INDEX_VALUE (<%= shadow_index_value %>)
8
8
  ) u_<%= register.name%>_address_decoder (
9
- .i_read (<%= register_block.host_if.read %>),
10
- .i_write (<%= register_block.host_if.write %>),
11
9
  .i_address (<%= register_block.host_if.address[local_address_width - 1, address_lsb] %>),
12
10
  .i_shadow_index (<%= (shadow? && shadow_index[loop_variables]) || shadow_index_value %>),
13
11
  .o_select (<%= register_block.register_select[register.index] %>)
@@ -43,7 +43,7 @@ simple_item :register, :address_decoder do
43
43
  def shadow_index_assignment
44
44
  assign(
45
45
  shadow_index[register.loop_variables],
46
- concat(*shadow_index_fields.map(&:value))
46
+ concat(shadow_index_fields.map(&:value))
47
47
  )
48
48
  end
49
49
 
@@ -58,14 +58,12 @@ simple_item :register, :address_decoder do
58
58
 
59
59
  def shadow_index_value
60
60
  return hex(0, 1) unless shadow?
61
- concat(*shadow_index_values)
61
+ concat(shadow_index_values)
62
62
  end
63
63
 
64
64
  def shadow_index_fields
65
65
  @shadow_index_fields ||= shadow_indexes.map do |index|
66
- register_block.bit_fields.find do |bit_field|
67
- bit_field.name == index.name
68
- end
66
+ register_block.bit_fields.find_by(name: index.name)
69
67
  end
70
68
  end
71
69
 
@@ -24,7 +24,7 @@ simple_item :register, :read_data do
24
24
 
25
25
  def read_data
26
26
  if register.readable?
27
- concat(*read_data_expressions)
27
+ concat(read_data_expressions)
28
28
  else
29
29
  hex(0, configuration.data_width)
30
30
  end
@@ -57,8 +57,7 @@ simple_item :register, :reg_model do
57
57
  end
58
58
 
59
59
  def array_index
60
- return '\'{}' unless array?
61
- array(*loop_varibles)
60
+ array((array? && loop_varibles) || [])
62
61
  end
63
62
 
64
63
  def offset_address
@@ -121,9 +121,9 @@ simple_item :register, :shadow do
121
121
 
122
122
  def shadow_index_bit_field
123
123
  @shadow_index_bit_field ||= Hash.new do |hash, index_name|
124
- hash[index_name] = register_block.bit_fields.find do |bit_field|
125
- bit_field.name == index_name && !bit_field.reserved?
126
- end
124
+ hash[index_name] = register_block.bit_fields.find_by(
125
+ name: index_name, reserved?: false
126
+ )
127
127
  end
128
128
  end
129
129
  end
@@ -33,10 +33,7 @@ simple_item :register, :shadow_index_configurator do
33
33
  end
34
34
 
35
35
  def fild_parent_register(index_name)
36
- index_field = register_block.bit_fields.find do |bit_field|
37
- bit_field.name == index_name
38
- end
39
- index_field.register
36
+ register_block.bit_fields.find_by(name: index_name).register
40
37
  end
41
38
 
42
39
  def index_name(shadow_index)
@@ -20,11 +20,11 @@ simple_item :register_block, :irq_controller do
20
20
  end
21
21
 
22
22
  def assign_ier
23
- assign(ier, concat(*ier_fields.map(&:value)))
23
+ assign(ier, concat(ier_fields.map(&:value)))
24
24
  end
25
25
 
26
26
  def assign_isr
27
- assign(isr, concat(*isr_fields.map(&:value)))
27
+ assign(isr, concat(isr_fields.map(&:value)))
28
28
  end
29
29
 
30
30
  def isr_fields
@@ -38,7 +38,7 @@ simple_item :register_block, :irq_controller do
38
38
  end
39
39
 
40
40
  def find_ier_field(reference)
41
- register_block.bit_fields.find { |field| field.name == reference.name }
41
+ register_block.bit_fields.find_by(name: reference.name)
42
42
  end
43
43
  end
44
44
  end
@@ -0,0 +1,9 @@
1
+ class Array
2
+ def find_by(conditions)
3
+ find do |i|
4
+ conditions.all? do |key, value|
5
+ i.respond_to?(key) && (i.__send__(key) == value)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -40,13 +40,12 @@ module RgGen
40
40
  "#{subroutine}(#{Array(arguments).join(', ')})"
41
41
  end
42
42
 
43
- def concat(expression, *other_expressions)
44
- expressions = Array[expression, *other_expressions]
45
- "{#{expressions.join(', ')}}"
43
+ def concat(expression_or_expressions)
44
+ "{#{Array(expression_or_expressions).join(', ')}}"
46
45
  end
47
46
 
48
- def array(expression, *other_expressions)
49
- "'#{concat(expression, *other_expressions)}"
47
+ def array(expression_or_expressions)
48
+ "'#{concat(expression_or_expressions)}"
50
49
  end
51
50
 
52
51
  def string(expression)
data/lib/rggen/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module RgGen
2
2
  MAJOR = 0
3
3
  MINOR = 4
4
- TEENY = 2
4
+ TEENY = 3
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{TEENY}".freeze
6
6
  end
@@ -0,0 +1,15 @@
1
+ function automatic logic is_write_access(
2
+ input command_valid,
3
+ input select,
4
+ input write
5
+ );
6
+ return (command_valid && select && write) ? 1'b1 : 1'b0;
7
+ endfunction
8
+
9
+ function automatic logic [WIDTH-1:0] get_write_data(
10
+ input [WIDTH-1:0] current_data,
11
+ input [WIDTH-1:0] write_data,
12
+ input [WIDTH-1:0] write_mask
13
+ );
14
+ return (current_data & (~write_mask)) | (write_data & write_mask);
15
+ endfunction
@@ -11,18 +11,17 @@ module rggen_bit_field_rw #(
11
11
  input [WIDTH-1:0] i_write_mask,
12
12
  output [WIDTH-1:0] o_value
13
13
  );
14
- logic [WIDTH-1:0] write_data;
14
+ `include "rggen_bit_field_common.svh"
15
+
15
16
  logic [WIDTH-1:0] value;
16
17
 
17
- assign o_value = value;
18
- assign write_data = (i_write_data & ( i_write_mask))
19
- | (value & (~i_write_mask));
18
+ assign o_value = value;
20
19
  always_ff @(posedge clk or negedge rst_n) begin
21
20
  if (!rst_n) begin
22
21
  value <= INITIAL_VALUE;
23
22
  end
24
- else if (i_command_valid && i_select && i_write) begin
25
- value <= write_data;
23
+ else if (is_write_access(i_command_valid, i_select, i_write)) begin
24
+ value <= get_write_data(value, i_write_data, i_write_mask);
26
25
  end
27
26
  end
28
27
  endmodule
@@ -13,18 +13,37 @@ module rggen_bit_field_rwl_rwe #(
13
13
  input [WIDTH-1:0] i_write_mask,
14
14
  output [WIDTH-1:0] o_value
15
15
  );
16
+ `include "rggen_bit_field_common.svh"
17
+
16
18
  logic [WIDTH-1:0] value;
17
- logic writable;
18
19
 
19
20
  assign o_value = value;
20
- assign writable = (LOCK_MODE) ? !i_lock_or_enable : i_lock_or_enable;
21
21
  always_ff @(posedge clk or negedge rst_n) begin
22
22
  if (!rst_n) begin
23
23
  value <= INITIAL_VALUE;
24
24
  end
25
- else if (writable && i_command_valid && i_select && i_write) begin
26
- value <= (i_write_data & ( i_write_mask))
27
- | (value & (~i_write_mask));
25
+ else if (
26
+ can_write(i_lock_or_enable, i_command_valid, i_select, i_write)
27
+ ) begin
28
+ value <= get_write_data(value, i_write_data, i_write_mask);
28
29
  end
29
30
  end
31
+
32
+ function automatic logic can_write(
33
+ input lock_or_enable,
34
+ input command_valid,
35
+ input select,
36
+ input write
37
+ );
38
+ if (LOCK_MODE) begin
39
+ return (
40
+ (!lock_or_enable) && is_write_access(command_valid, select, write)
41
+ ) ? 1'b1 : 1'b0;
42
+ end
43
+ else begin
44
+ return (
45
+ lock_or_enable && is_write_access(command_valid, select, write)
46
+ ) ? 1'b1 : 1'b0;
47
+ end
48
+ endfunction
30
49
  endmodule
@@ -0,0 +1,67 @@
1
+ module rggen_bit_field_w01s_w01c #(
2
+ parameter WIDTH = 1,
3
+ parameter INITIAL_VALUE = 0,
4
+ parameter SET_MODE = 1,
5
+ parameter SET_CLEAR_VALUE = 0
6
+ )(
7
+ input clk,
8
+ input rst_n,
9
+ input [WIDTH-1:0] i_set_or_clear,
10
+ input i_command_valid,
11
+ input i_select,
12
+ input i_write,
13
+ input [WIDTH-1:0] i_write_data,
14
+ input [WIDTH-1:0] i_write_mask,
15
+ output [WIDTH-1:0] o_value
16
+ );
17
+ `include "rggen_bit_field_common.svh"
18
+
19
+ logic [WIDTH-1:0] value;
20
+
21
+ assign o_value = value;
22
+ always_ff @(posedge clk or negedge rst_n) begin
23
+ if (!rst_n) begin
24
+ value <= INITIAL_VALUE;
25
+ end
26
+ else begin
27
+ value <= get_next_value(
28
+ i_set_or_clear,
29
+ value,
30
+ i_command_valid,
31
+ i_select,
32
+ i_write,
33
+ i_write_mask,
34
+ i_write_data
35
+ );
36
+ end
37
+ end
38
+
39
+ function automatic logic [WIDTH-1:0] get_next_value(
40
+ input [WIDTH-1:0] set_or_clear,
41
+ input [WIDTH-1:0] current_value,
42
+ input command_valid,
43
+ input select,
44
+ input write,
45
+ input [WIDTH-1:0] write_mask,
46
+ input [WIDTH-1:0] write_data
47
+ );
48
+ logic [WIDTH-1:0] control_value;
49
+ logic [WIDTH-1:0] set;
50
+ logic [WIDTH-1:0] clear;
51
+ if (is_write_access(command_valid, select, write)) begin
52
+ control_value = write_mask & ((SET_CLEAR_VALUE) ? write_data : ~write_data);
53
+ end
54
+ else begin
55
+ control_value = '0;
56
+ end
57
+ if (SET_MODE) begin
58
+ set = control_value;
59
+ clear = set_or_clear;
60
+ end
61
+ else begin
62
+ set = set_or_clear;
63
+ clear = control_value;
64
+ end
65
+ return set | (current_value & (~clear));
66
+ endfunction
67
+ endmodule
data/rtl/compile.f CHANGED
@@ -1,5 +1,6 @@
1
1
  +libext+.sv
2
2
  +incdir+${RGGEN_HOME}/rtl/register_block
3
+ +incdir+${RGGEN_HOME}/rtl/bit_field
3
4
  -y ${RGGEN_HOME}/rtl/bit_field
4
5
  -y ${RGGEN_HOME}/rtl/register
5
6
  -y ${RGGEN_HOME}/rtl/register_block
@@ -6,8 +6,6 @@ module rggen_address_decoder #(
6
6
  parameter SHADOW_INDEX_WIDTH = 1,
7
7
  parameter SHADOW_INDEX_VALUE = 'h00
8
8
  )(
9
- input i_read,
10
- input i_write,
11
9
  input [ADDRESS_WIDTH-1:0] i_address,
12
10
  input [SHADOW_INDEX_WIDTH-1:0] i_shadow_index,
13
11
  output o_select
data/sample/sample_0.sv CHANGED
@@ -139,8 +139,6 @@ module sample_0 (
139
139
  .SHADOW_INDEX_WIDTH (1),
140
140
  .SHADOW_INDEX_VALUE (1'h0)
141
141
  ) u_register_0_address_decoder (
142
- .i_read (read),
143
- .i_write (write),
144
142
  .i_address (address[7:2]),
145
143
  .i_shadow_index (1'h0),
146
144
  .o_select (register_select[0])
@@ -182,8 +180,6 @@ module sample_0 (
182
180
  .SHADOW_INDEX_WIDTH (1),
183
181
  .SHADOW_INDEX_VALUE (1'h0)
184
182
  ) u_register_1_address_decoder (
185
- .i_read (read),
186
- .i_write (write),
187
183
  .i_address (address[7:2]),
188
184
  .i_shadow_index (1'h0),
189
185
  .o_select (register_select[1])
@@ -211,8 +207,6 @@ module sample_0 (
211
207
  .SHADOW_INDEX_WIDTH (1),
212
208
  .SHADOW_INDEX_VALUE (1'h0)
213
209
  ) u_register_2_address_decoder (
214
- .i_read (read),
215
- .i_write (write),
216
210
  .i_address (address[7:2]),
217
211
  .i_shadow_index (1'h0),
218
212
  .o_select (register_select[2])
@@ -246,8 +240,6 @@ module sample_0 (
246
240
  .SHADOW_INDEX_WIDTH (1),
247
241
  .SHADOW_INDEX_VALUE (1'h0)
248
242
  ) u_register_3_address_decoder (
249
- .i_read (read),
250
- .i_write (write),
251
243
  .i_address (address[7:2]),
252
244
  .i_shadow_index (1'h0),
253
245
  .o_select (register_select[3])
@@ -270,8 +262,6 @@ module sample_0 (
270
262
  .SHADOW_INDEX_WIDTH (1),
271
263
  .SHADOW_INDEX_VALUE (1'h0)
272
264
  ) u_register_4_address_decoder (
273
- .i_read (read),
274
- .i_write (write),
275
265
  .i_address (address[7:2]),
276
266
  .i_shadow_index (1'h0),
277
267
  .o_select (register_select[4+g_i])
@@ -312,8 +302,6 @@ module sample_0 (
312
302
  .SHADOW_INDEX_WIDTH (33),
313
303
  .SHADOW_INDEX_VALUE ({1'h1, g_i[15:0], g_j[15:0]})
314
304
  ) u_register_5_address_decoder (
315
- .i_read (read),
316
- .i_write (write),
317
305
  .i_address (address[7:2]),
318
306
  .i_shadow_index (register_5_shadow_index[g_i][g_j]),
319
307
  .o_select (register_select[8+4*g_i+g_j])
@@ -350,21 +338,20 @@ module sample_0 (
350
338
  .SHADOW_INDEX_WIDTH (1),
351
339
  .SHADOW_INDEX_VALUE (1'h0)
352
340
  ) u_register_6_address_decoder (
353
- .i_read (read),
354
- .i_write (write),
355
341
  .i_address (address[7:2]),
356
342
  .i_shadow_index (1'h0),
357
343
  .o_select (register_select[16])
358
344
  );
359
345
  assign register_read_data[16] = {23'h000000, bit_field_6_0_value, 7'h00, bit_field_6_1_value};
360
- rggen_bit_field_w0c_w1c #(
361
- .WIDTH (1),
362
- .INITIAL_VALUE (1'h0),
363
- .CLEAR_VALUE (1'b0)
346
+ rggen_bit_field_w01s_w01c #(
347
+ .WIDTH (1),
348
+ .INITIAL_VALUE (1'h0),
349
+ .SET_MODE (0),
350
+ .SET_CLEAR_VALUE (0)
364
351
  ) u_bit_field_6_0 (
365
352
  .clk (clk),
366
353
  .rst_n (rst_n),
367
- .i_set (i_bit_field_6_0_set),
354
+ .i_set_or_clear (i_bit_field_6_0_set),
368
355
  .i_command_valid (command_valid),
369
356
  .i_select (register_select[16]),
370
357
  .i_write (write),
@@ -372,14 +359,15 @@ module sample_0 (
372
359
  .i_write_mask (write_mask[8]),
373
360
  .o_value (bit_field_6_0_value)
374
361
  );
375
- rggen_bit_field_w0c_w1c #(
376
- .WIDTH (1),
377
- .INITIAL_VALUE (1'h0),
378
- .CLEAR_VALUE (1'b1)
362
+ rggen_bit_field_w01s_w01c #(
363
+ .WIDTH (1),
364
+ .INITIAL_VALUE (1'h0),
365
+ .SET_MODE (0),
366
+ .SET_CLEAR_VALUE (1)
379
367
  ) u_bit_field_6_1 (
380
368
  .clk (clk),
381
369
  .rst_n (rst_n),
382
- .i_set (i_bit_field_6_1_set),
370
+ .i_set_or_clear (i_bit_field_6_1_set),
383
371
  .i_command_valid (command_valid),
384
372
  .i_select (register_select[16]),
385
373
  .i_write (write),
@@ -395,22 +383,21 @@ module sample_0 (
395
383
  .SHADOW_INDEX_WIDTH (1),
396
384
  .SHADOW_INDEX_VALUE (1'h0)
397
385
  ) u_register_7_address_decoder (
398
- .i_read (read),
399
- .i_write (write),
400
386
  .i_address (address[7:2]),
401
387
  .i_shadow_index (1'h0),
402
388
  .o_select (register_select[17])
403
389
  );
404
390
  assign register_read_data[17] = {23'h000000, bit_field_7_0_value, 7'h00, bit_field_7_1_value};
405
391
  assign o_bit_field_7_0 = bit_field_7_0_value;
406
- rggen_bit_field_w0s_w1s #(
407
- .WIDTH (1),
408
- .INITIAL_VALUE (1'h0),
409
- .SET_VALUE (1'b0)
392
+ rggen_bit_field_w01s_w01c #(
393
+ .WIDTH (1),
394
+ .INITIAL_VALUE (1'h0),
395
+ .SET_MODE (1),
396
+ .SET_CLEAR_VALUE (0)
410
397
  ) u_bit_field_7_0 (
411
398
  .clk (clk),
412
399
  .rst_n (rst_n),
413
- .i_clear (i_bit_field_7_0_clear),
400
+ .i_set_or_clear (i_bit_field_7_0_clear),
414
401
  .i_command_valid (command_valid),
415
402
  .i_select (register_select[17]),
416
403
  .i_write (write),
@@ -419,14 +406,15 @@ module sample_0 (
419
406
  .o_value (bit_field_7_0_value)
420
407
  );
421
408
  assign o_bit_field_7_1 = bit_field_7_1_value;
422
- rggen_bit_field_w0s_w1s #(
423
- .WIDTH (1),
424
- .INITIAL_VALUE (1'h0),
425
- .SET_VALUE (1'b1)
409
+ rggen_bit_field_w01s_w01c #(
410
+ .WIDTH (1),
411
+ .INITIAL_VALUE (1'h0),
412
+ .SET_MODE (1),
413
+ .SET_CLEAR_VALUE (1)
426
414
  ) u_bit_field_7_1 (
427
415
  .clk (clk),
428
416
  .rst_n (rst_n),
429
- .i_clear (i_bit_field_7_1_clear),
417
+ .i_set_or_clear (i_bit_field_7_1_clear),
430
418
  .i_command_valid (command_valid),
431
419
  .i_select (register_select[17]),
432
420
  .i_write (write),
@@ -442,8 +430,6 @@ module sample_0 (
442
430
  .SHADOW_INDEX_WIDTH (1),
443
431
  .SHADOW_INDEX_VALUE (1'h0)
444
432
  ) u_register_8_address_decoder (
445
- .i_read (read),
446
- .i_write (write),
447
433
  .i_address (address[7:2]),
448
434
  .i_shadow_index (1'h0),
449
435
  .o_select (register_select[18])
@@ -489,8 +475,6 @@ module sample_0 (
489
475
  .SHADOW_INDEX_WIDTH (1),
490
476
  .SHADOW_INDEX_VALUE (1'h0)
491
477
  ) u_register_9_address_decoder (
492
- .i_read (read),
493
- .i_write (write),
494
478
  .i_address (address[7:2]),
495
479
  .i_shadow_index (1'h0),
496
480
  .o_select (register_select[19])
data/sample/sample_1.sv CHANGED
@@ -88,8 +88,6 @@ module sample_1 (
88
88
  .SHADOW_INDEX_WIDTH (1),
89
89
  .SHADOW_INDEX_VALUE (1'h0)
90
90
  ) u_register_0_address_decoder (
91
- .i_read (read),
92
- .i_write (write),
93
91
  .i_address (address[6:2]),
94
92
  .i_shadow_index (1'h0),
95
93
  .o_select (register_select[0])
@@ -123,8 +121,6 @@ module sample_1 (
123
121
  .SHADOW_INDEX_WIDTH (1),
124
122
  .SHADOW_INDEX_VALUE (1'h0)
125
123
  ) u_register_1_address_decoder (
126
- .i_read (read),
127
- .i_write (write),
128
124
  .i_address (address[6:2]),
129
125
  .i_shadow_index (1'h0),
130
126
  .o_select (register_select[1])
@@ -152,8 +148,6 @@ module sample_1 (
152
148
  .SHADOW_INDEX_WIDTH (1),
153
149
  .SHADOW_INDEX_VALUE (1'h0)
154
150
  ) u_register_2_address_decoder (
155
- .i_read (read),
156
- .i_write (write),
157
151
  .i_address (address[6:2]),
158
152
  .i_shadow_index (1'h0),
159
153
  .o_select (register_select[2])
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.4.2
4
+ version: 0.4.3
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-07-14 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: baby_erubis
@@ -227,6 +227,7 @@ files:
227
227
  - lib/rggen/core_components/rtl/component.rb
228
228
  - lib/rggen/core_components/rtl/item.rb
229
229
  - lib/rggen/core_components/rtl/setup.rb
230
+ - lib/rggen/core_extensions/array.rb
230
231
  - lib/rggen/core_extensions/facets.rb
231
232
  - lib/rggen/core_extensions/forwardable.rb
232
233
  - lib/rggen/core_extensions/integer.rb
@@ -265,11 +266,11 @@ files:
265
266
  - ral/rggen_ral_pkg.sv
266
267
  - ral/rggen_ral_reg.svh
267
268
  - ral/rggen_ral_shadow_reg.svh
269
+ - rtl/bit_field/rggen_bit_field_common.svh
268
270
  - rtl/bit_field/rggen_bit_field_ro.sv
269
271
  - rtl/bit_field/rggen_bit_field_rw.sv
270
272
  - rtl/bit_field/rggen_bit_field_rwl_rwe.sv
271
- - rtl/bit_field/rggen_bit_field_w0c_w1c.sv
272
- - rtl/bit_field/rggen_bit_field_w0s_w1s.sv
273
+ - rtl/bit_field/rggen_bit_field_w01s_w01c.sv
273
274
  - rtl/compile.f
274
275
  - rtl/register/rggen_address_decoder.sv
275
276
  - rtl/register/rggen_bus_exporter.sv
@@ -1,36 +0,0 @@
1
- module rggen_bit_field_w0c_w1c #(
2
- parameter WIDTH = 1,
3
- parameter INITIAL_VALUE = 1'b0,
4
- parameter CLEAR_VALUE = 1'b0
5
- )(
6
- input clk,
7
- input rst_n,
8
- input [WIDTH-1:0] i_set,
9
- input i_command_valid,
10
- input i_select,
11
- input i_write,
12
- input [WIDTH-1:0] i_write_data,
13
- input [WIDTH-1:0] i_write_mask,
14
- output [WIDTH-1:0] o_value
15
- );
16
- logic [WIDTH-1:0] value;
17
- logic write_valid;
18
-
19
- assign o_value = value;
20
- assign write_valid = (i_command_valid && i_select && i_write) ? 1'b1 : 1'b0;
21
- always_ff @(posedge clk or negedge rst_n) begin
22
- if (!rst_n) begin
23
- value <= INITIAL_VALUE;
24
- end
25
- else begin
26
- for (int i = 0;i < WIDTH;i++) begin
27
- if (i_set[i]) begin
28
- value[i] <= 1'b1;
29
- end
30
- else if (write_valid && i_write_mask[i] && (i_write_data[i] == CLEAR_VALUE)) begin
31
- value[i] <= 1'b0;
32
- end
33
- end
34
- end
35
- end
36
- endmodule
@@ -1,36 +0,0 @@
1
- module rggen_bit_field_w0s_w1s #(
2
- parameter WIDTH = 1,
3
- parameter INITIAL_VALUE = 1'b0,
4
- parameter SET_VALUE = 1'b0
5
- )(
6
- input clk,
7
- input rst_n,
8
- input [WIDTH-1:0] i_clear,
9
- input i_command_valid,
10
- input i_select,
11
- input i_write,
12
- input [WIDTH-1:0] i_write_data,
13
- input [WIDTH-1:0] i_write_mask,
14
- output [WIDTH-1:0] o_value
15
- );
16
- logic [WIDTH-1:0] value;
17
- logic write_valid;
18
-
19
- assign o_value = value;
20
- assign write_valid = (i_command_valid && i_select && i_write) ? 1'b1 : 1'b0;
21
- always_ff @(posedge clk or negedge rst_n) begin
22
- if (!rst_n) begin
23
- value <= INITIAL_VALUE;
24
- end
25
- else begin
26
- for (int i = 0;i < WIDTH;i++) begin
27
- if (write_valid && i_write_mask[i] && (i_write_data[i] == SET_VALUE)) begin
28
- value[i] <= 1'b1;
29
- end
30
- else if (i_clear[i]) begin
31
- value[i] <= 1'b0;
32
- end
33
- end
34
- end
35
- end
36
- endmodule