Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using single ended port in logic expecting diff-pair?

Tags:

verilog

The logic that I am using is set up to expect a diff-pair clock port. However, for one specific application, I can only input a single ended clock (due to hardware limitation). Modifying the logic to accept single ended clock is not an option as there are many files and lines of code involved. Is there a way I can input a single ended port and somehow feed it to diff-pair ports of modules? So for example in my top level I want to have a port like this:

input single_ended_clk

And I want to feed this to a module that takes the following ports:

input diff_pair_clk_p;
input diff_pair_clk_n;

A very naïve approach would be to do this:

mymodule m_i (
.diff_pair_clk_p(single_ended_clk),
.diff_pair_clk_n(~single_ended_clk),
);

but I don't think this is the proper way to do this.

like image 580
Arash Fotouhi Avatar asked May 29 '26 14:05

Arash Fotouhi


1 Answers

Most chip designs, either ASICs or FPGAs explicitly instantiate clock buffers rather than infer them. In the FPGA world, the synthesis engines usually aren't smart enough to recognize a clock and hook the buffer outputs to the dedicated clock routing resources. So you really probably need to explicitly instantiate a clock buffer.

Now as to the case where sometimes you want a single ended clock buffer and sometimes you want a double edge clock buffer. While you can use generate statements referencing a parameter to decide which buffer to instantiate, you can't control the port list of the chip this way. You can keep the clock buffer inside the lower level module.

I would not recommend recreating a differential signal inside the chip. There are several problems with this. First, a differential clock buffer expects to be connected to external pins, not internally buffered signals. Secondly, there is a timing mismatch between the positive and negative clock which could create glitches on your resulting clock post-buffer which would make a real mess of your design.

Instead, keep both _n and _p inputs to your sub-module, and use a generate to select the type of clock buffer to be instantiated. In the case of a single ended clock, the _n input is left unconnected and only the _p input is used.

Here's an example for a Xilinx FPGA. The buffer primatives will be named differently in other types of FPGAs or ASIC libraries.

module clock_buffer (
    input   pin_clk_p,
    input   pin_clk_n,
    output  clk_int
    );

    parameter DIFF = 0;

    generate 
        if (DIFF = 1)
            clk_buf IBUFGDS(
                .I  (pin_clk_p),
                .IB (pin_clk_n),
                .O  (clk_int)
            );
        else 
            clk_buf IBUFG(
                .I  (pin_clk_p),
                .O  (clk_int)
            );
    endgenerate
endmodule
like image 183
Barry Moss Avatar answered Jun 02 '26 01:06

Barry Moss