Fix bugs
This commit is contained in:
parent
0af347032a
commit
b08195b68a
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
* [Fixed] apply workaround for static class method call
|
* [Fixed] apply workaround for static class method call
|
||||||
* [Fixed] randomize_call bug
|
* [Fixed] randomize_call bug
|
||||||
|
* [Fixed] parameter override by class type bug
|
||||||
|
* [Fixed] hierarchical this bug
|
||||||
|
|
||||||
## [v0.3.6](https://github.com/dalance/sv-parser/compare/v0.3.5...v0.3.6) - 2019-11-05
|
## [v0.3.6](https://github.com/dalance/sv-parser/compare/v0.3.5...v0.3.6) - 2019-11-05
|
||||||
|
|
||||||
|
@ -183,10 +183,10 @@ pub(crate) fn constant_param_expression(s: Span) -> IResult<Span, ConstantParamE
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
|
pub(crate) fn param_expression(s: Span) -> IResult<Span, ParamExpression> {
|
||||||
alt((
|
alt((
|
||||||
|
map(data_type, |x| ParamExpression::DataType(Box::new(x))),
|
||||||
map(mintypmax_expression, |x| {
|
map(mintypmax_expression, |x| {
|
||||||
ParamExpression::MintypmaxExpression(Box::new(x))
|
ParamExpression::MintypmaxExpression(Box::new(x))
|
||||||
}),
|
}),
|
||||||
map(data_type, |x| ParamExpression::DataType(Box::new(x))),
|
|
||||||
map(symbol("$"), |x| ParamExpression::Dollar(Box::new(x))),
|
map(symbol("$"), |x| ParamExpression::Dollar(Box::new(x))),
|
||||||
))(s)
|
))(s)
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,6 @@ pub(crate) fn method_call_root(s: Span) -> IResult<Span, MethodCallRoot> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn primary_method_call_root(s: Span) -> IResult<Span, Primary> {
|
pub(crate) fn primary_method_call_root(s: Span) -> IResult<Span, Primary> {
|
||||||
alt((
|
alt((
|
||||||
map(keyword("this"), |x| Primary::This(Box::new(x))),
|
|
||||||
map(keyword("$"), |x| Primary::Dollar(Box::new(x))),
|
map(keyword("$"), |x| Primary::Dollar(Box::new(x))),
|
||||||
map(keyword("null"), |x| Primary::Null(Box::new(x))),
|
map(keyword("null"), |x| Primary::Null(Box::new(x))),
|
||||||
map(assignment_pattern_expression, |x| {
|
map(assignment_pattern_expression, |x| {
|
||||||
@ -265,6 +264,7 @@ pub(crate) fn primary_method_call_root(s: Span) -> IResult<Span, Primary> {
|
|||||||
map(primary_literal, |x| Primary::PrimaryLiteral(Box::new(x))),
|
map(primary_literal, |x| Primary::PrimaryLiteral(Box::new(x))),
|
||||||
map(cast, |x| Primary::Cast(Box::new(x))),
|
map(cast, |x| Primary::Cast(Box::new(x))),
|
||||||
terminated(primary_hierarchical_method_call_root, peek(none_of("("))),
|
terminated(primary_hierarchical_method_call_root, peek(none_of("("))),
|
||||||
|
map(keyword("this"), |x| Primary::This(Box::new(x))),
|
||||||
map(empty_unpacked_array_concatenation, |x| {
|
map(empty_unpacked_array_concatenation, |x| {
|
||||||
Primary::EmptyUnpackedArrayConcatenation(Box::new(x))
|
Primary::EmptyUnpackedArrayConcatenation(Box::new(x))
|
||||||
}),
|
}),
|
||||||
@ -322,7 +322,7 @@ pub(crate) fn select_method_call_root(s: Span) -> IResult<Span, Select> {
|
|||||||
symbol("."),
|
symbol("."),
|
||||||
member_identifier,
|
member_identifier,
|
||||||
),
|
),
|
||||||
peek(symbol(".")),
|
peek(one_of(".[")),
|
||||||
))(s)?;
|
))(s)?;
|
||||||
let (s, b) = bit_select(s)?;
|
let (s, b) = bit_select(s)?;
|
||||||
let (s, c) = opt(bracket(part_select_range))(s)?;
|
let (s, c) = opt(bracket(part_select_range))(s)?;
|
||||||
|
@ -363,6 +363,21 @@ mod unit {
|
|||||||
b, c) text goes here"##,
|
b, c) text goes here"##,
|
||||||
Ok((_, _))
|
Ok((_, _))
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
source_text,
|
||||||
|
r##"class A; static uvm_pool#(string,uvm_resource#(T)) m_rsc[uvm_component]; endclass"##,
|
||||||
|
Ok((_, _))
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
source_text,
|
||||||
|
r##"module a; initial begin elements.push_back(urme_container.elements[i].clone()); end endmodule"##,
|
||||||
|
Ok((_, _))
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
source_text,
|
||||||
|
r##"class a; function a b(); return this.a.b(); endfunction endclass"##,
|
||||||
|
Ok((_, _))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6449,34 +6464,35 @@ mod spec {
|
|||||||
endclass"##,
|
endclass"##,
|
||||||
Ok((_, _))
|
Ok((_, _))
|
||||||
);
|
);
|
||||||
// TODO
|
// BNF-WA
|
||||||
|
// reported at https://accellera.mantishub.io/view.php?id=1642
|
||||||
// class static method is denied because ps_or_hierarchical_tf_identifier doesn't have class_scope.
|
// class static method is denied because ps_or_hierarchical_tf_identifier doesn't have class_scope.
|
||||||
//test!(
|
test!(
|
||||||
// many1(module_item),
|
many1(module_item),
|
||||||
// r##"module top ();
|
r##"module top ();
|
||||||
// logic [7:0] encoder_in;
|
logic [7:0] encoder_in;
|
||||||
// logic [2:0] encoder_out;
|
logic [2:0] encoder_out;
|
||||||
// logic [1:0] decoder_in;
|
logic [1:0] decoder_in;
|
||||||
// logic [3:0] decoder_out;
|
logic [3:0] decoder_out;
|
||||||
|
|
||||||
// // Encoder and Decoder Input Assignments
|
// Encoder and Decoder Input Assignments
|
||||||
// assign encoder_in = 8'b0100_0000;
|
assign encoder_in = 8'b0100_0000;
|
||||||
// assign decoder_in = 2'b11;
|
assign decoder_in = 2'b11;
|
||||||
|
|
||||||
// // Encoder and Decoder Function calls
|
// Encoder and Decoder Function calls
|
||||||
// assign encoder_out = C#(8)::ENCODER_f(encoder_in);
|
assign encoder_out = C#(8)::ENCODER_f(encoder_in);
|
||||||
// assign decoder_out = C#(4)::DECODER_f(decoder_in);
|
assign decoder_out = C#(4)::DECODER_f(decoder_in);
|
||||||
|
|
||||||
// initial begin
|
initial begin
|
||||||
// #50;
|
#50;
|
||||||
// $display("Encoder input = %b Encoder output = %b\n",
|
$display("Encoder input = %b Encoder output = %b\n",
|
||||||
// encoder_in, encoder_out );
|
encoder_in, encoder_out );
|
||||||
// $display("Decoder input = %b Decoder output = %b\n",
|
$display("Decoder input = %b Decoder output = %b\n",
|
||||||
// decoder_in, decoder_out );
|
decoder_in, decoder_out );
|
||||||
// end
|
end
|
||||||
// endmodule"##,
|
endmodule"##,
|
||||||
// Ok((_, _))
|
Ok((_, _))
|
||||||
//);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -15822,7 +15838,7 @@ mod spec {
|
|||||||
fn debug() {
|
fn debug() {
|
||||||
test!(
|
test!(
|
||||||
source_text,
|
source_text,
|
||||||
r##"module top (); initial begin p.randomize() with { length == 1512;}; end endmodule"##,
|
r##"module a; initial begin this.a.b(); end endmodule"##,
|
||||||
Ok((_, _))
|
Ok((_, _))
|
||||||
);
|
);
|
||||||
nom_tracable::cumulative_histogram();
|
nom_tracable::cumulative_histogram();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user