mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #941 from Wren6991/sim_lib_io_clke
ice40 cells_sim.v: update clock enable behaviour based on hardware experiments
This commit is contained in:
commit
0e7901e45c
|
@ -27,18 +27,27 @@ module SB_IO (
|
|||
reg dout_q_0, dout_q_1;
|
||||
reg outena_q;
|
||||
|
||||
// IO tile generates a constant 1'b1 internally if global_cen is not connected
|
||||
wire clken_pulled = CLOCK_ENABLE || CLOCK_ENABLE === 1'bz;
|
||||
reg clken_pulled_ri;
|
||||
reg clken_pulled_ro;
|
||||
|
||||
generate if (!NEG_TRIGGER) begin
|
||||
always @(posedge INPUT_CLK) if (CLOCK_ENABLE) din_q_0 <= PACKAGE_PIN;
|
||||
always @(negedge INPUT_CLK) if (CLOCK_ENABLE) din_q_1 <= PACKAGE_PIN;
|
||||
always @(posedge OUTPUT_CLK) if (CLOCK_ENABLE) dout_q_0 <= D_OUT_0;
|
||||
always @(negedge OUTPUT_CLK) if (CLOCK_ENABLE) dout_q_1 <= D_OUT_1;
|
||||
always @(posedge OUTPUT_CLK) if (CLOCK_ENABLE) outena_q <= OUTPUT_ENABLE;
|
||||
always @(posedge INPUT_CLK) clken_pulled_ri <= clken_pulled;
|
||||
always @(posedge INPUT_CLK) if (clken_pulled) din_q_0 <= PACKAGE_PIN;
|
||||
always @(negedge INPUT_CLK) if (clken_pulled_ri) din_q_1 <= PACKAGE_PIN;
|
||||
always @(posedge OUTPUT_CLK) clken_pulled_ro <= clken_pulled;
|
||||
always @(posedge OUTPUT_CLK) if (clken_pulled) dout_q_0 <= D_OUT_0;
|
||||
always @(negedge OUTPUT_CLK) if (clken_pulled_ro) dout_q_1 <= D_OUT_1;
|
||||
always @(posedge OUTPUT_CLK) if (clken_pulled) outena_q <= OUTPUT_ENABLE;
|
||||
end else begin
|
||||
always @(negedge INPUT_CLK) if (CLOCK_ENABLE) din_q_0 <= PACKAGE_PIN;
|
||||
always @(posedge INPUT_CLK) if (CLOCK_ENABLE) din_q_1 <= PACKAGE_PIN;
|
||||
always @(negedge OUTPUT_CLK) if (CLOCK_ENABLE) dout_q_0 <= D_OUT_0;
|
||||
always @(posedge OUTPUT_CLK) if (CLOCK_ENABLE) dout_q_1 <= D_OUT_1;
|
||||
always @(negedge OUTPUT_CLK) if (CLOCK_ENABLE) outena_q <= OUTPUT_ENABLE;
|
||||
always @(negedge INPUT_CLK) clken_pulled_ri <= clken_pulled;
|
||||
always @(negedge INPUT_CLK) if (clken_pulled) din_q_0 <= PACKAGE_PIN;
|
||||
always @(posedge INPUT_CLK) if (clken_pulled_ri) din_q_1 <= PACKAGE_PIN;
|
||||
always @(negedge OUTPUT_CLK) clken_pulled_ro <= clken_pulled;
|
||||
always @(negedge OUTPUT_CLK) if (clken_pulled) dout_q_0 <= D_OUT_0;
|
||||
always @(posedge OUTPUT_CLK) if (clken_pulled_ro) dout_q_1 <= D_OUT_1;
|
||||
always @(negedge OUTPUT_CLK) if (clken_pulled) outena_q <= OUTPUT_ENABLE;
|
||||
end endgenerate
|
||||
|
||||
always @* begin
|
||||
|
|
Loading…
Reference in New Issue