-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c58fd34
commit 2a363f2
Showing
7 changed files
with
455 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
RgGen.define_list_feature(:register, :type) do | ||
veryl do | ||
base_feature do | ||
include RgGen::SystemVerilog::RTL::RegisterType | ||
|
||
private | ||
|
||
def register_if | ||
register_block.register_if[register.index] | ||
end | ||
|
||
def bit_field_if | ||
register.bit_field_if | ||
end | ||
end | ||
|
||
default_feature do | ||
template = File.join(__dir__, 'type', 'default.erb') | ||
main_code :register, from_template: template | ||
end | ||
|
||
factory do | ||
def target_feature_key(_configuration, register) | ||
type = register.type | ||
return type if [:default, *target_features.keys].any? { type == _1 } | ||
|
||
error "code generator for #{type} register type " \ | ||
'is not implemented' | ||
end | ||
end | ||
end | ||
end |
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 @@ | ||
inst u_register: rggen_default_register #( | ||
READABLE: <%= readable %>, | ||
WRITABLE: <%= writable %>, | ||
ADDRESS_WIDTH: <%= address_width %>, | ||
OFFSET_ADDRESS: <%= offset_address %>, | ||
BUS_WIDTH: <%= bus_width %>, | ||
DATA_WIDTH: <%= width %>, | ||
VALUE_WIDTH: <%= value_width %>, | ||
VALID_BITS: <%= valid_bits %> | ||
)( | ||
i_clk: <%= register_block.clock %>, | ||
i_rst: <%= register_block.reset %>, | ||
register_if: <%= register_if %>, | ||
bit_field_if: <%= bit_field_if %> | ||
); |
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,6 @@ | ||
# frozen_string_literal: true | ||
|
||
RgGen.define_list_item_feature(:register, :type, :external) do | ||
veryl do | ||
end | ||
end |
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
Oops, something went wrong.