【问题标题】:Implementation of a TDC in System Verilog在 System Verilog 中实现 TDC
【发布时间】:2022-12-13 00:07:48
【问题描述】:

我正在尝试在 System Verilog 中实现时间数字转换器 (TDC)。到目前为止,我尝试了两种不同的方法,但不确定是否成功。

第一种方法基于下图

'''

module TDC #(
  parameter bits = 8
)(
  input logic start,
  input logic progate_stop,
  input logic reset,
  output logic [bits-1:0] comb_output
);

logic comb_one, comb_two, comb_three, comb_four, comb_five, comb_six, comb_seven, comb_eight;
logic pipo_one, pipo_two, pipo_three, pipo_four, pipo_five, pipo_six, pipo_seven, pipo_eight;


always_comb begin
  comb_one = start;
  comb_two = ~comb_one;
  comb_three = ~comb_two;
  comb_four = ~comb_three;
  comb_five = ~comb_four;
  comb_six = ~comb_five;
  comb_seven = ~comb_six;
  comb_eight = ~comb_seven;

end

always_ff@(progate_stop) begin
  if (reset ) begin
    pipo_one <= 1'b0;
    pipo_two <= 1'b0;
    pipo_three <= 1'b0;
    pipo_four <= 1'b0;
    pipo_five <= 1'b0;
    pipo_six <= 1'b0;
    pipo_seven <= 1'b0;
    pipo_eight <= 1'b0;
  end else begin

    pipo_one <= comb_one;
    pipo_two <= comb_two;
    pipo_three <= comb_three;
    pipo_four <= comb_four;
    pipo_five <= comb_five;
    pipo_six <= comb_six;
    pipo_seven <= comb_seven;
    pipo_eight <= comb_eight;
  end
end

always_comb begin
  comb_output[0] = pipo_one;
  comb_output[1] = ~pipo_two;
  comb_output[2] = pipo_three;
  comb_output[3] = ~pipo_four;
  comb_output[4] = pipo_five;
  comb_output[5] = ~pipo_six;
  comb_output[6] = pipo_seven;
  comb_output[7] = ~pipo_eight;
end

endmodule

第二种方法基于下图:

module TDC (
output reg [7:0] out     ,  // Output of the counter
input  wire      enable  ,  // enable for counter
input  wire      clk     ,  // clock Input
input  wire      reset,      // reset Input
input logic start,
input logic stop
);
//-------------Code Starts Here-------
always_ff @(posedge clk) begin
  
  if (reset) begin
    out <= 8'b0 ;
  end else begin
    if (start && !stop) begin
      out <= out+1;
    end else begin
      out <=out;
    end
  end

end

endmodule 

对其中任何一个的任何建议将不胜感激!

先感谢您

【问题讨论】:

  • 您的任何一个模型都没有“时间”;没有门延迟或指定块。两者都不会做你期望的......

标签: verilog system-verilog


【解决方案1】:

TDC 非常依赖于您使用的基础技术。虽然它是一个“数字”块(在您使用数字门和触发器来实现它的意义上),但实际情况是,为了获得准确的时序,您需要仔细布置门和触发器,因此通常您将需要:

a) 使用 ASIC 库/FPGA 中可用的单元从结构上描述电路 b) 仔细布置元件,使 TDC 计时测量准确。

换句话说,像您一样编写行为 RTL 不会实现您想要的,抱歉。

【讨论】:

    猜你喜欢
    • 2015-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多