Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect formatting and lost comments for module without braces #28

Open
raffaeler opened this issue Dec 22, 2022 · 0 comments
Open

Incorrect formatting and lost comments for module without braces #28

raffaeler opened this issue Dec 22, 2022 · 0 comments

Comments

@raffaeler
Copy link

When a module is declared without parameters, the file is incorrectly formatted and the comments for the parameters are removed.

Original source to format

`timescale 1ns / 1ps
module stimulus;
    // Inputs
    reg[1:0] x;
    reg[1:0] y;
    // Outputs
    wire z;
    // Instantiate the Unit Under Test (UUT)
    comparator2bit uut (
    .x(x),
    .y(y),
    .z(z)
    );
    
    initial begin
        $dumpfile("test.vcd");
        $dumpvars(0,stimulus);
        // Initialize Inputs
        x     = 0;
        y     = 0;
        #20 x = 1;
        #20 y = 1;
        #20 y = 3;
        #20 x = 3;
        #20 y = 1;
        #20 y = 0;
        
        #40 ;
        
    end
    
    initial begin
        $monitor("t = %3d x = %2b,y = %2b,z = %d \n",$time,x,y,z,);
    end
    
endmodule

Format result without braces:

`timescale 1ns / 1ps
module stimulus; reg[1:0] x; reg[1:0] y; wire z; comparator2bit uut (.x(x), .y(y), .z(z));
    
    initial begin
        $dumpfile("test.vcd");
        $dumpvars(0,stimulus);
        // Initialize Inputs
        x     = 0;
        y     = 0;
        #20 x = 1;
        #20 y = 1;
        #20 y = 3;
        #20 x = 3;
        #20 y = 1;
        #20 y = 0;
        
        #40 ;
        
    end
    
    initial begin
        $monitor("t = %3d x = %2b,y = %2b,z = %d \n",$time,x,y,z,);
    end
    
endmodule

Please note that the comments at the beginning were totaly removed!

Format result adding braces to stimulus:

`timescale 1ns / 1ps
module stimulus();
    // Inputs
    reg[1:0] x;
    reg[1:0] y;
    // Outputs
    wire z;
    // Instantiate the Unit Under Test (UUT)
    comparator2bit uut (
    .x(x),
    .y(y),
    .z(z)
    );
    
    initial begin
        $dumpfile("test.vcd");
        $dumpvars(0,stimulus);
        // Initialize Inputs
        x     = 0;
        y     = 0;
        #20 x = 1;
        #20 y = 1;
        #20 y = 3;
        #20 x = 3;
        #20 y = 1;
        #20 y = 0;
        
        #40 ;
        
    end
    
    initial begin
        $monitor("t = %3d x = %2b,y = %2b,z = %d \n",$time,x,y,z,);
    end
    
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant