mirror of https://github.com/YosysHQ/yosys.git
simlib: Use optional SIMLIB_GLOBAL_CLOCK to define a global clock signal
This commit is contained in:
parent
605d127517
commit
99163fb822
|
@ -1700,6 +1700,9 @@ endmodule
|
||||||
|
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
`ifdef SIMLIB_FF
|
`ifdef SIMLIB_FF
|
||||||
|
`ifndef SIMLIB_GLOBAL_CLOCK
|
||||||
|
`define SIMLIB_GLOBAL_CLOCK $global_clk
|
||||||
|
`endif
|
||||||
module \$anyinit (D, Q);
|
module \$anyinit (D, Q);
|
||||||
|
|
||||||
parameter WIDTH = 0;
|
parameter WIDTH = 0;
|
||||||
|
@ -1709,7 +1712,7 @@ output reg [WIDTH-1:0] Q;
|
||||||
|
|
||||||
initial Q <= 'bx;
|
initial Q <= 'bx;
|
||||||
|
|
||||||
always @($global_clk) begin
|
always @(`SIMLIB_GLOBAL_CLOCK) begin
|
||||||
Q <= D;
|
Q <= D;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1790,6 +1793,9 @@ endmodule
|
||||||
`endif
|
`endif
|
||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
`ifdef SIMLIB_FF
|
`ifdef SIMLIB_FF
|
||||||
|
`ifndef SIMLIB_GLOBAL_CLOCK
|
||||||
|
`define SIMLIB_GLOBAL_CLOCK $global_clk
|
||||||
|
`endif
|
||||||
|
|
||||||
module \$ff (D, Q);
|
module \$ff (D, Q);
|
||||||
|
|
||||||
|
@ -1798,7 +1804,7 @@ parameter WIDTH = 0;
|
||||||
input [WIDTH-1:0] D;
|
input [WIDTH-1:0] D;
|
||||||
output reg [WIDTH-1:0] Q;
|
output reg [WIDTH-1:0] Q;
|
||||||
|
|
||||||
always @($global_clk) begin
|
always @(`SIMLIB_GLOBAL_CLOCK) begin
|
||||||
Q <= D;
|
Q <= D;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue