Attention
This documentation is a work in progress. Expect to see errors and unfinished things.
demand_gpt Source File
1`timescale 1ns / 1ns
2
3// timing error logic for simple single-input module that
4// requires a fixed gates-per-trig (gpt).
5module demand_gpt(
6 input clk,
7 input gate,
8 input trig,
9 output time_err
10);
11parameter gpt=16;
12
13reg time_err_r=0;
14reg gate_check=0;
15reg [8:0] count=0; // XXX generous, but not general
16
17always @(posedge clk) begin
18 gate_check <= gate;
19 count <= count + gate;
20 if (trig && gate_check) begin
21 time_err_r <= (count+gate) != gpt;
22 count <= 0;
23 end
24end
25
26assign time_err = time_err_r;
27
28endmodule