Skip to content

Commit bdbc44a

Browse files
committed
operator percedence fix according to latest IEEE verilog document - https://www.eg.bucknell.edu/~csci320/2016-fall/wp-content/uploads/2015/08/verilog-std-1364-2005.pdf
1 parent 8f6dcd0 commit bdbc44a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pyverilog/utils/op2mark.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ def op2mark(op):
3333
'Sll':4, 'Srl':4, 'Sla':4, 'Sra':4,
3434
'LessThan':5, 'GreaterThan':5, 'LessEq':5, 'GreaterEq':5,
3535
'Eq':6, 'NotEq':6, 'Eql':6, 'NotEql':6,
36-
'And':7, 'Xor':7, 'Xnor':7,
37-
'Or':8,
38-
'Land':9,
39-
'Lor':10
36+
'And':7,
37+
'Xor':8, 'Xnor':8,
38+
'Or':9,
39+
'Land':10,
40+
'Lor':11
4041
}
4142

4243
def op2order(op):

pyverilog/vparser/parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class VerilogParser(PLYParser):
3636
('left', 'LOR'),
3737
('left', 'LAND'),
3838
('left', 'OR'),
39-
('left', 'AND', 'XOR', 'XNOR'),
39+
('left', 'XOR', 'XNOR'),
40+
('left', 'AND'),
4041
('left', 'EQ', 'NE', 'EQL', 'NEL'),
4142
('left', 'LT', 'GT', 'LE', 'GE'),
4243
('left', 'LSHIFT', 'RSHIFT', 'LSHIFTA', 'RSHIFTA'),

0 commit comments

Comments
 (0)