Пример #1
0
def test77(self):
    # debug(grammar.seq_block)
    # debug(grammar.statement)
    # debug(grammar.blocking_assignment)
    print_result_as_stmt(self.try_parse_pass("""begin end"""))
    print_result_as_stmt(self.try_parse_pass("""begin a=1; end"""))
    print_result_as_stmt(self.try_parse_pass("""begin a=1; b=2; end"""))
    print_result_as_stmt(self.try_parse_pass("""begin 
a = foo(); 
b <= a[3];
begin
  c <= 0;
end
end"""))
    print_result_as_stmt(self.try_parse_pass("""
begin 
 a=1; 
 b=2; 
 c=func(x); 
 begin 
   d <= 10'd5;
   e <= x.abc[0];
   f <= { 0, 1, 2 };
 end
end"""))
Пример #2
0
def test87(self):
    #debug(grammar.event_expression)
    print_result_as_stmt(self.try_parse_pass("~en"))
    print_result_as_stmt(self.try_parse_pass("posedge A or negedge CLK"))
    print_result_as_stmt(self.try_parse_pass("posedge A , negedge CLK"))
    print_result_as_stmt(self.try_parse_pass("~en or posedge A or negedge CLK"))
    print_result_as_stmt(self.try_parse_pass("~en , (posedge A or negedge CLK)"))  # must be pass! not implemented recursive Binary Exp print
    print_result(self.try_parse_pass("~en ,posedge A or negedge CLK"))
Пример #3
0
def test88(self):
    print_result_as_stmt(self.try_parse_pass("#10 A<=1;"))
    print_result_as_stmt(self.try_parse_pass("@clk A=1;"))
    print_result_as_stmt(self.try_parse_pass("#X+2 A=1;"))
    print_result_as_stmt(self.try_parse_pass("@(posedge clk or negedge reset) A=1;"))
    print_result_as_stmt(self.try_parse_pass("""@(posedge clk or negedge reset) begin 
 A<=1;
 B<=func(A,B);
end
"""))
Пример #4
0
def test94(self):
    print_result_as_stmt(self.try_parse_pass("""
case( 1 )
 X: x = 0;
 Y: y = 0;
endcase
"""))
    print_result_as_stmt(self.try_parse_pass("""
casex( 1 )
 X: x = 0;
 Y: y = 0;
endcase
"""))
Пример #5
0
def test91(self):
    print_result_as_stmt(self.try_parse_fail("""if (A > 0) a = 1;
 else if (B > 0) b = 1;
 end else        f = 1;
 else if (C > 0) c = 1;
 else if (D > 0) d = 1;
 else if (E > 0) e = 1;
 """))
    print_result_as_stmt(self.try_parse_pass("""if (A > 0) a = 1;
 else if (B > 0) b = 1;
 else if (C > 0) c = 1;
 else if (D > 0) d = 1;
 else if (E > 0) e = 1;
 else        f = 1;
 """))
Пример #6
0
def test75(self):
    print_result_as_stmt(self.try_parse_pass("""begin 
end
"""))
    print_result_as_stmt(self.try_parse_pass("""begin  a=1; end"""))
    print_result_as_stmt(self.try_parse_pass("""begin  a=1; b=2; c=func(x); end"""))
    print_result_as_stmt(self.try_parse_pass("""
begin 
 a=1; 
 b=2; 
 c=func(x); 
 begin 
   d = 10'd5;
   e = x.abc[0];
 end
end"""))
Пример #7
0
def test69(self):
    print_result_as_stmt(self.try_parse_pass("always a=1;"))
    print_result_as_stmt(self.try_parse_pass("always begin a=1; b=2; end"))
Пример #8
0
def test68(self):
    print_result_as_stmt(self.try_parse_pass("initial a=1;"))
Пример #9
0
def test66(self):
    print_result_as_stmt(self.try_parse_pass("a=1"))
    print_result_as_stmt(self.try_parse_pass("a=1,b=2"))
Пример #10
0
def test65(self):
    #debug(grammar.continuous_assign)
    print_result_as_stmt(self.try_parse_pass("assign a=1"))
    print_result_as_stmt(self.try_parse_pass("assign a=1,b=2"))
Пример #11
0
def test99(self):
    print_result_as_stmt(self.try_parse_pass("""
 for ( i=0; i<10; i=i+1) 
  count <= foo(i);
"""))
Пример #12
0
def test85(self):
    print_result_as_stmt(self.try_parse_pass("@A"))
    print_result_as_stmt(self.try_parse_pass("@( hoge )"))
    print_result_as_stmt(self.try_parse_pass("@*"))
    print_result_as_stmt(self.try_parse_pass("@(*)"))
    print_result_as_stmt(self.try_parse_pass("@( posedge CLK or ~RESET )"))
Пример #13
0
def test76(self):
    print_result_as_stmt(self.try_parse_pass("A = 1"))
    print_result_as_stmt(self.try_parse_pass("A = foo(0,1)"))
Пример #14
0
def test78(self):
    print_result_as_stmt(self.try_parse_pass("""fork
join
"""))
Пример #15
0
def test90(self):
    # debug(grammar.conditional_statement)
    # debug(grammar.if_else_if_statement)
    # debug(grammar.expression)
    # debug(grammar.function_call)
    # debug(grammar.statement_or_null)
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 0)  ;
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 0)  A = B;
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 0) a = foo(); 
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 0) a = foo(); else b = 1;
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) a = 1;
 else if (X > 2) a = 2;
 else a = 3;
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) begin a = 1; end
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) begin a = 1; end
 else begin b = 2; end
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) begin a = 1; end
 else begin 
    b = 2; 
    if ( a==0 ) x = 1;
 end
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) a = 1;
 else begin
    if (X > 2) begin 
       a = 2;
    end else begin
       X = 1;
       Y = 1;
    end
 end
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (A > 0) a = 1;
 else if (B > 0) begin
    b = 1;
 end else 
    c = 1;
 """))
Пример #16
0
def test89(self):
    print_result_as_stmt(self.try_parse_pass("wait (X) A=1;"))
    print_result_as_stmt(self.try_parse_pass("wait (X) ;"))
Пример #17
0
def test81(self):
    print_result_as_stmt(self.try_parse_fail("a<=1;"))
    print_result_as_stmt(self.try_parse_pass("a=1;"))
Пример #18
0
def test80(self):
    print_result_as_stmt(self.try_parse_pass(";"))
    print_result_as_stmt(self.try_parse_pass("A=1;"))
Пример #19
0
def test86(self):
    print_result_as_stmt(self.try_parse_pass("->A;"))
Пример #20
0
def test71(self):
    print_result_as_stmt(self.try_parse_pass("a<=1"))
Пример #21
0
def test72(self):
    print_result_as_stmt(self.try_parse_pass("deassign A"))
    print_result_as_stmt(self.try_parse_pass("assign A=1"))
    print_result_as_stmt(self.try_parse_pass("force A=1"))
    print_result_as_stmt(self.try_parse_pass("release A"))
Пример #22
0
def test92(self):
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 0)  ;
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 0)  A = B;
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 0) a = foo(); 
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 0) a = foo(); else b = 1;
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) a = 1;
 else if (X > 2) a = 2;
 else a = 3;
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) begin a = 1; end
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) begin a = 1; end
 else begin b = 2; end
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) begin a = 1; end
 else begin 
    b = 2; 
    if ( a==0 ) x = 1;
 end
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (X > 3) a = 1;
 else begin
    if (X > 2) begin 
       a = 2;
    end else begin
       X = 1;
       Y = 1;
    end
 end
 """))
    print_result_as_stmt(self.try_parse_pass("""
 if (A > 0) a = 1;
 else if (B > 0) begin
    b = 1;
 end else 
    c = 1;
 """))
Пример #23
0
def test79(self):
    print_result_as_stmt(self.try_parse_pass("e = x.abc[0];"))
    print_result_as_stmt(self.try_parse_pass("a<=1;"))
    print_result_as_stmt(self.try_parse_pass("a=1;"))
    print_result_as_stmt(self.try_parse_pass("""begin a=1; end"""))
    print_result_as_stmt(self.try_parse_fail("a<=1"))
    print_result_as_stmt(self.try_parse_fail("a=1"))
    print_result_as_stmt(self.try_parse_pass("assign x = 1;"))
    print_result_as_stmt(self.try_parse_pass("""begin 
force x= y + 1;
deassign x;
release x;
end """))
Пример #24
0
def test83(self):
    print_result_as_stmt(self.try_parse_pass("@A"))
    print_result_as_stmt(self.try_parse_pass("#A"))