diff options
author | Sergey <37293587+SergeyDegtyar@users.noreply.github.com> | 2019-10-01 11:04:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-01 11:04:32 +0300 |
commit | e092c4ae6b60cf67efd16efbfbf739895ad501c0 (patch) | |
tree | 939a5b94d14a11df511aa95482458b33a1f6139f /techlibs/efinix | |
parent | 1070f2e90b9ba37856932189ef09a0f2316d9a21 (diff) | |
parent | d963e8c2c6207ad98d48dc528922ad58c030173f (diff) | |
download | yosys-e092c4ae6b60cf67efd16efbfbf739895ad501c0.tar.gz yosys-e092c4ae6b60cf67efd16efbfbf739895ad501c0.tar.bz2 yosys-e092c4ae6b60cf67efd16efbfbf739895ad501c0.zip |
Merge branch 'master' into SergeyDegtyar/efinix
Diffstat (limited to 'techlibs/efinix')
-rw-r--r-- | techlibs/efinix/cells_sim.v | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/techlibs/efinix/cells_sim.v b/techlibs/efinix/cells_sim.v index 8c8f6afaa..2fc2034a6 100644 --- a/techlibs/efinix/cells_sim.v +++ b/techlibs/efinix/cells_sim.v @@ -5,7 +5,12 @@ module EFX_LUT4( input I2, input I3 ); - parameter LUTMASK = 16'h0000; + parameter LUTMASK = 16'h0000; + + wire [7:0] s3 = I3 ? LUTMASK[15:8] : LUTMASK[7:0]; + wire [3:0] s2 = I2 ? s3[ 7:4] : s3[3:0]; + wire [1:0] s1 = I1 ? s2[ 3:2] : s2[1:0]; + assign O = I0 ? s1[1] : s1[0]; endmodule module EFX_ADD( @@ -17,10 +22,18 @@ module EFX_ADD( ); parameter I0_POLARITY = 1; parameter I1_POLARITY = 1; + + wire i0; + wire i1; + + assign i0 = I0_POLARITY ? I0 : ~I0; + assign i1 = I1_POLARITY ? I1 : ~I1; + + assign {CO, O} = i0 + i1 + CI; endmodule module EFX_FF( - output Q, + output reg Q, input D, input CE, input CLK, @@ -33,6 +46,53 @@ module EFX_FF( parameter SR_VALUE = 0; parameter SR_SYNC_PRIORITY = 0; parameter D_POLARITY = 1; + + wire clk; + wire ce; + wire sr; + wire d; + wire prio; + wire sync; + wire async; + + assign clk = CLK_POLARITY ? CLK : ~CLK; + assign ce = CE_POLARITY ? CE : ~CE; + assign sr = SR_POLARITY ? SR : ~SR; + assign d = D_POLARITY ? D : ~D; + + generate + if (SR_SYNC == 1) + begin + if (SR_SYNC_PRIORITY == 1) + begin + always @(posedge clk) + if (sr) + Q <= SR_VALUE; + else if (ce) + Q <= d; + end + else + begin + always @(posedge clk) + if (ce) + begin + if (sr) + Q <= SR_VALUE; + else + Q <= d; + end + end + end + else + begin + always @(posedge clk or posedge sr) + if (sr) + Q <= SR_VALUE; + else if (ce) + Q <= d; + + end + endgenerate endmodule module EFX_GBUFCE( @@ -41,6 +101,12 @@ module EFX_GBUFCE( output O ); parameter CE_POLARITY = 1'b1; + + wire ce; + assign ce = CE_POLARITY ? CE : ~CE; + + assign O = I & ce; + endmodule module EFX_RAM_5K( |