chipsalliance / f4pga-v2x

Tool for converting specialized annotated Verilog models into XML needed for Verilog to Routing flow.
https://f4pga-v2x.readthedocs.io/en/latest/
Apache License 2.0
10 stars 12 forks source link

FF with clock enable and syncronous set/reset does not work #91

Open litghost opened 3 years ago

litghost commented 3 years ago
(* whitebox *)                                                                                                                                                                                                                                                                            
module FF(C, D, Q, CE, SR);                                                    
    parameter RESET_VALUE = 1'b0;                                                

    (* CLOCK *)                                                                
    input C;                                                                   

    (* SETUP = "C 10e-12" *)                                                   
    input D;                                                                   

    (* SETUP = "C 10e-12" *)                                                   
    input CE;                                                                  

    (* SETUP = "C 10e-12" *)                                                   
    input SR;                                                                  

    (* CLK_TO_Q = "C 10e-12" *)                                                
    output reg Q;                                                              

    always @(posedge C) begin                                                  
        if(SR) begin                                                           
            Q <= RESET_VALUE;                                                  
        end else if(CE) begin                                                  
            Q <= D;                                                            
        end                                                                    
    end                                                                        

endmodule    

This generates no clock annotations in the .model.xml for D/CE/SR. None of the current examples in the v2x documentation show how to make this work properly.

mithro commented 3 years ago

FYI - @mkurc-ant

mithro commented 3 years ago

https://python-symbiflow-v2x.readthedocs.io/en/latest/examples/vtr/dff/README.html#timings

Classical D-Flip-Flop test — SymbiFlow Verilog to XML (V2X) 0.0-551-g728f3b9 documentation
mithro commented 3 years ago

BTW - Your example looks valid and should probably also be a test case.