Parse-udps
Functions for parsing User Defined Primitives (UDPs).
There are two different ways to write UDPs, basically you can have
either an integrated port/portdecl list like:
primitive foo(output reg o, input a, input b);
...
endprimitive
Or you can have a more traditional separation between the ports and their
declarations, e.g.,:
primitive foo(o, a, b);
output o;
reg o;
input a;
input b;
...
endprimitive
In either case, our parser will create a temporary vl-udp-head-p
structure that records the output port declaration, the associated input port
declarations (in the correct order), and an indication of whether the output
port is a reg or not (i.e., whether or not this is a sequential UDP).
When parsing the body we can use the head information to know whether we
should be parisng a sequential or combinational UDP and whether the initial
statement is well-formed.
Subtopics
- Vl-idtokenlist->names
- (vl-idtokenlist->names x) maps vl-idtoken->name across a list.
- Vl-make-traditional-udp-head
- Cross-check ports against port declarations for traditional UDPs.
- Vl-udp-head-p
- Temporary structure for parsing UDPs.
- Vl-parse-traditional-udp-head
- Matches port stuff for UDPs with traditional, separated ports and port
declarations lists.
- Vl-parse-1+-udp-input-declarations-separated-by-commas
- udp_input_declaration { ',' udp_input_declaration }
- Vl-parse-udp-output-declaration
- Matches udp_output_declaration.
- Vl-parse-integrated-udp-head
- Matches port stuff for UDPs with integrated port/port declaration lists.
- Vl-parse-udp-declaration
- Parse a udp_declaration.
- Vl-udp-body-p
- Temporary structure for parsing UDPs.
- Vl-parse-udp-initial-statement
- udp_initial_statement ::= 'initial' output_port_identifier '=' init_val ';'
- Vl-parse-two-level-symbols
- Horrible. To support edge_indicator, match two level_symbols,
which would be so easy except they might not be separated by
whitespace.
- Vl-parse-udp-input-declaration
- udp_input_declaration ::= { attribute_instance } 'input' list_of_port_identifiers
- Vl-parse-combinational-entries-until-endtable
- Matches combinational_entry { combinational_entry }.
- Vl-parse-udp-port-declaration
- Matches udp_port_declaration.
- Vl-parse-sequential-entries-until-endtable
- Matches sequential_entry { sequential_entry }
- Vl-parse-level-symbol
- level_symbol ::= '0' | '1' | 'x' | 'X' | '?' | 'b' | 'B'
- Vl-parse-edge-symbol
- edge_symbol ::= 'r' | 'R' | 'f' | 'F' | 'p' | 'P' | 'n' | 'N' | '*'.
- Vl-parse-1+-udp-port-declarations
- Matches udp_port_declaration { udp_port_declaration }.
- Vl-parse-0+-udp-port-declarations
- Matches { udp_port_declaration }.
- Vl-skip-through-endprimitive
- Special error recovery for parse errors encountered during primitives.
- Vl-parse-udp-reg-declaration
- udp_reg_declaration ::= { attribute_instance } 'reg' variable_identifier
- Vl-parse-udp-init-val
- init_val ::= 1'b0 | 1'b1 | 1'bx | 1'bX | 1'B0 | 1'B1 | 1'Bx | 1'BX | 1 | 0
- Vl-parse-sequential-entry
- sequential_entry ::= seq_input_list ':' current_state ':' next_state ';'
- Vl-parse-level-input-list
- level_input_list ::= level_symbol { level_symbol }
- Vl-parse-edge-input-list
- edge_input_list ::= { level_symbol } edge_indicator { level_symbol }
- Vl-parse-udp-body
- udp_body ::= combinational_body | sequential_body
- Vl-parse-seq-input-list
- seq_input_list ::= level_input_list | edge_input_list
- Vl-parse-combinational-entry
- combinational_entry ::= level_input_list ':' output_symbol ';'
- Vl-parse-combinational-body
- combinational_body ::= 'table' combinational_entry { combinational_entry } 'endtable'
- Vl-port/vardecllist-p
- (vl-port/vardecllist-p x) recognizes lists where every element satisfies vl-port/vardecl-p.
- Vl-parse-sequential-table
- Matches 'table' sequential_entry { sequential_entry } 'endtable'
- Vl-parse-edge-indicator
- edge_indicator ::= '(' level_symbol level_symbol ' | edge_symbol')
- Vl-parse-output-symbol
- output_symbol ::= '0' | '1' | 'x' | 'X'
- Vl-parse-0+-level-symbols
- Matches { level_symbol }
- Vl-parse-next-state
- next_state ::= output_symbol | '-'
- Vl-parse-current-state
- current_state ::= level_symbol
- Vl-make-udp-with-parse-error
- Vl-make-udp-portdecls
- Vl-port/vardecllist->vardecls
- Vl-port/vardecllist->portdecls
- Vl-port/vardecl
- Vl-10-integer-token-p
- Vl-01-integer-token-p