Class: Udb::DocLink

Inherits:
Object
  • Object
show all
Defined in:
lib/udb/doc_link.rb

Overview

Creates links into RISC-V documentation with the following formats for the destination link:

Documenation  Format
============  ===============================================================
ISA manuals   manual:ext:<ext_name>:<identifier>
              manual:inst:<inst_name>:<identifier>
              manual:insts:<inst_name>[-<inst_name>]+:<identifier>
              manual:inst_group:<group_name>:<identifier>
              manual:csr:<csr_name>:<identifier>
              manual:csr_field:<csr_name>:<field_name>:<identifier>
              manual:param:<ext_name>:<param_name>:<identifier>
                where <identifier> is a string that describes the tagged text
UDB doc       udb:doc:ext:<ext_name>
              udb:doc:ext_param:<ext_name>:<param_name>
              udb:doc:inst:<inst_name>
              udb:doc:csr:<csr_name>
              udb:doc:csr_field:<csr_name>:<field_name>
              udb:doc:func:<func_name>  (Documentation of common/built-in IDL functions)
              udb:doc:cov_pt:<org>:<id>
                where <org> is:
                   sep for UDB documentation that "separates" normative rules from test plans
                   combo for UDB documentation that "combines" normative rules with test plans
                   appendix for UDB documentation that has normative rules and test plans in appendices
                where <id> is the ID of the normative rule
IDL code      idl:code:inst:<inst-name>:<location>
              TODO for CSR and CSR Fields

Instance Method Summary collapse

Constructor Details

#initialize(dst_link, db_obj) ⇒ DocLink

Returns a new instance of DocLink.

Parameters:

  • dst_link (String)

    The documentation link provided in the YAML

  • db_obj (String)

    Database object

Raises:

  • (ArgumentError)


35
36
37
38
39
40
# File 'lib/udb/doc_link.rb', line 35

def initialize(dst_link, db_obj)
  raise ArgumentError, "Need String but was passed a #{data.class}" unless dst_link.is_a?(String)
  @dst_link = dst_link

  raise ArgumentError, "Missing documentation link for #{db_obj.name} of kind #{db_obj.kind}" if @dst_link.nil?
end

Instance Method Details

Returns Unique ID of the linked to normative rule.

Returns:

  • (String)

    Unique ID of the linked to normative rule



43
# File 'lib/udb/doc_link.rb', line 43

def dst_link = @dst_link

#to_adocString

Returns Asciidoc to create desired link.

Returns:

  • (String)

    Asciidoc to create desired link.



46
47
48
# File 'lib/udb/doc_link.rb', line 46

def to_adoc
  "<<#{@dst_link},#{@dst_link}>>"
end