File tree Expand file tree Collapse file tree 4 files changed +49
-1
lines changed Expand file tree Collapse file tree 4 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 1+ // `default_nettype none
2+
3+ module TOP (CLK, RST);
4+ input CLK, RST;
5+ reg [7 :0 ] cnt1;
6+
7+
8+ always @(posedge CLK or negedge RST) begin
9+ if (RST) begin
10+ cnt1 <= 'd0;
11+ end else begin
12+ cnt1 <= cnt1 + 8'd1 ;
13+ end
14+ end
15+
16+
17+
18+ endmodule
19+
Original file line number Diff line number Diff line change 1+ // `default_nettype none
2+
3+ module TOP (CLK, RST);
4+ input CLK, RST;
5+ reg [7 :0 ] cnt2;
6+
7+
8+ always @(posedge CLK or negedge RST) begin
9+ if (RST) begin
10+ cnt2 <= 'd0;
11+ end else begin
12+ cnt2 <= cnt2 + 'd1;
13+ end
14+ end
15+
16+
17+ endmodule
18+
Original file line number Diff line number Diff line change @@ -45,6 +45,17 @@ def test_ptr_clock_reset(self):
4545 self .assertEqual (binddict .values ()[0 ][0 ].getClockBit (), 2 )
4646 self .assertEqual (binddict .values ()[0 ][0 ].getResetBit (), 0 )
4747
48+ def test_decimal (self ):
49+ terms , binddict = self .dataflow_wrapper ("decimal.v" )
50+ self .assertEqual (binddict .values ()[0 ][0 ].tostr (),
51+ "(Bind dest:TOP.cnt1 tree:(Branch Cond:(Terminal TOP.RST) True:(IntConst 'd0) False:(Operator Plus Next:(Terminal TOP.cnt1),(IntConst 8'd1))))" )
52+
53+ def test_ptr_clock_reset (self ):
54+ terms , binddict = self .dataflow_wrapper ("decimal2.v" )
55+ self .assertEqual (binddict .values ()[0 ][0 ].tostr (),
56+ "(Bind dest:TOP.cnt2 tree:(Branch Cond:(Terminal TOP.RST) True:(IntConst 'd0) False:(Operator Plus Next:(Terminal TOP.cnt2),(IntConst 'd1))))" )
57+
58+
4859 def dataflow_wrapper (self ,code_file ):
4960
5061 from optparse import OptionParser
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ def t_COMMENTOUT(self, t):
181181 signed_hex_number = '[0-9]*\' sh[0-9a-fA-Fxz][0-9a-fA-Fxz_]*'
182182
183183 decimal_number = '[0-9]*\' d[0-9xz][0-9xz_]*' + '|' + '([0-9]*\' d)?[0-9][0-9_]*'
184- signed_decimal_number = '[0-9]*\' s(d?)[0-9xz][0-9xz_]*' + '|' + '([0-9]* \' s(d?))?[0-9][0-9_]*'
184+ signed_decimal_number = '[0-9]*\' s(d?)[0-9xz][0-9xz_]*'
185185
186186 exponent_part = r"""([eE][-+]?[0-9]+)"""
187187 fractional_constant = r"""([0-9]*\.[0-9]+)|([0-9]+\.)"""
You can’t perform that action at this time.
0 commit comments