Skip to content

Commit 0232006

Browse files
authored
Merge pull request #232 from diffblue/functioncall4
Verilog: add KNOWNBUG for function with integer input
2 parents d4ed123 + 3bd3395 commit 0232006

File tree

3 files changed

+50
-8
lines changed

3 files changed

+50
-8
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
functioncall4.v
3+
--module main --bound 0
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^UNSAT: No counterexample found within bound$
7+
--
8+
^warning: ignoring
9+
--
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module main;
2+
3+
function vector_extract;
4+
input [63:0] vector;
5+
input integer index;
6+
vector_extract = vector[index];
7+
endfunction
8+
9+
wire [63:0] some_value;
10+
wire return_value = vector_extract(some_value, 10);
11+
12+
always assert p1: return_value == some_value[10];
13+
14+
endmodule

src/verilog/parser.y

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -755,15 +755,15 @@ module_port_declaration:
755755
;
756756

757757
module_port_input_declaration:
758-
TOK_INPUT port_type port_identifier
758+
TOK_INPUT net_port_type port_identifier
759759
{ init($$, ID_decl);
760760
stack_expr($$).set(ID_class, ID_input);
761761
addswap($$, ID_type, $2);
762762
mto($$, $3); }
763763
;
764764

765765
module_port_output_declaration:
766-
TOK_OUTPUT port_type port_identifier
766+
TOK_OUTPUT net_port_type port_identifier
767767
{ init($$, ID_decl);
768768
stack_expr($$).set(ID_class, ID_output);
769769
addswap($$, ID_type, $2);
@@ -867,7 +867,7 @@ specparam_declaration:
867867
// A.2.1.2 Port declarations
868868

869869
module_port_inout_declaration:
870-
TOK_INOUT port_type port_identifier
870+
TOK_INOUT net_port_type port_identifier
871871
{ init($$, ID_decl);
872872
stack_expr($$).set(ID_class, ID_inout);
873873
addswap($$, ID_type, $2);
@@ -1100,6 +1100,13 @@ net_type: TOK_SUPPLY0 { init($$, ID_supply0); }
11001100
| TOK_WOR { init($$, ID_wor); }
11011101
;
11021102

1103+
variable_port_type: var_data_type ;
1104+
1105+
var_data_type:
1106+
data_type
1107+
| TOK_VAR data_type_or_implicit { $$ = $2; }
1108+
;
1109+
11031110
interface_opt:
11041111
/* Optional */
11051112
{ make_nil($$); }
@@ -1225,6 +1232,13 @@ list_of_variable_decl_assignments:
12251232
{ $$=$1; mto($$, $3); }
12261233
;
12271234

1235+
list_of_variable_identifiers:
1236+
variable_identifier
1237+
{ init($$); mto($$, $1); }
1238+
| list_of_variable_identifiers ',' variable_identifier
1239+
{ $$=$1; mto($$, $3); }
1240+
;
1241+
12281242
// This rule is more permissive that the grammar in the standard
12291243
// to cover list_of_param_assignments.
12301244
parameter_port_declaration:
@@ -1274,35 +1288,40 @@ implicit_data_type:
12741288
;
12751289

12761290
input_declaration:
1277-
TOK_INPUT port_type list_of_port_identifiers
1291+
TOK_INPUT net_port_type list_of_port_identifiers
1292+
{ init($$, ID_decl);
1293+
stack_expr($$).set(ID_class, ID_input);
1294+
addswap($$, ID_type, $2);
1295+
swapop($$, $3); }
1296+
| TOK_INPUT variable_port_type list_of_variable_identifiers
12781297
{ init($$, ID_decl);
12791298
stack_expr($$).set(ID_class, ID_input);
12801299
addswap($$, ID_type, $2);
12811300
swapop($$, $3); }
12821301
;
12831302

12841303
output_declaration:
1285-
TOK_OUTPUT port_type list_of_port_identifiers
1304+
TOK_OUTPUT net_port_type list_of_port_identifiers
12861305
{ init($$, ID_decl);
12871306
stack_expr($$).set(ID_class, ID_output);
12881307
addswap($$, ID_type, $2);
12891308
swapop($$, $3); }
1290-
| TOK_OUTPUT data_type list_of_port_identifiers
1309+
| TOK_OUTPUT variable_port_type list_of_port_identifiers
12911310
{ init($$, ID_decl);
12921311
stack_expr($$).set(ID_class, ID_output_register);
12931312
addswap($$, ID_type, $2);
12941313
swapop($$, $3); }
12951314
;
12961315

12971316
inout_declaration:
1298-
TOK_INOUT port_type list_of_port_identifiers
1317+
TOK_INOUT net_port_type list_of_port_identifiers
12991318
{ init($$, ID_decl);
13001319
stack_expr($$).set(ID_class, ID_inout);
13011320
addswap($$, ID_type, $2);
13021321
swapop($$, $3); }
13031322
;
13041323

1305-
port_type: net_type_opt signing_opt packed_dimension_brace
1324+
net_port_type: net_type_opt signing_opt packed_dimension_brace
13061325
{
13071326
$$=$3;
13081327
add_as_subtype(stack_type($$), stack_type($2));

0 commit comments

Comments
 (0)