diff options
author | William D. Jones <thor0505@comcast.net> | 2020-11-16 15:07:32 -0500 |
---|---|---|
committer | Marcelina KoĆcielnicka <mwk@0x04.net> | 2021-02-23 17:39:58 +0100 |
commit | 88c8f812602c25ef0a062002bede8fe737b6ac77 (patch) | |
tree | d5708ff20cb24d30a9a96dc36d9e0b3e91879efd /techlibs/machxo2/cells_sim.v | |
parent | cc7d18d29a5314c6350b7378bc788f48f3925337 (diff) | |
download | yosys-88c8f812602c25ef0a062002bede8fe737b6ac77.tar.gz yosys-88c8f812602c25ef0a062002bede8fe737b6ac77.tar.bz2 yosys-88c8f812602c25ef0a062002bede8fe737b6ac77.zip |
machxo2: Create basic techlibs and synth_machxo2 pass.
Diffstat (limited to 'techlibs/machxo2/cells_sim.v')
-rw-r--r-- | techlibs/machxo2/cells_sim.v | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/techlibs/machxo2/cells_sim.v b/techlibs/machxo2/cells_sim.v new file mode 100644 index 000000000..06fbe2023 --- /dev/null +++ b/techlibs/machxo2/cells_sim.v @@ -0,0 +1,62 @@ +module LUT4 #( + parameter [15:0] INIT = 0 +) ( + input A, B, C, D, + output F +); + wire [3:0] I; + wire [3:0] I_pd; + + genvar ii; + generate + for (ii = 0; ii < 4; ii = ii + 1'b1) + assign I_pd[ii] = (I[ii] === 1'bz) ? 1'b0 : I[ii]; + endgenerate + + assign I = {D, C, B, A}; + assign F = INIT[I_pd]; +endmodule + +module FACADE_FF #( + parameter GSR = "ENABLED", + parameter CEMUX = "1", + parameter CLKMUX = "0", + parameter LSRMUX = "LSR", + parameter LSRONMUX = "LSRMUX", + parameter SRMODE = "LSR_OVER_CE", + parameter REGSET = "SET" +) ( + input CLK, D, LSR, CE, + output reg Q +); + + wire muxce; + generate + case (CEMUX) + "1": assign muxce = 1'b1; + "0": assign muxce = 1'b0; + "INV": assign muxce = ~CE; + default: assign muxce = CE; + endcase + endgenerate + + wire muxlsr = (LSRMUX == "INV") ? ~LSR : LSR; + wire muxclk = (CLKMUX == "INV") ? ~CLK : CLK; + assign srval = (REGSET == "SET") ? 1'b1 : 1'b0; + + generate + if (SRMODE == "ASYNC") begin + always @(posedge muxclk, posedge muxlsr) + if (muxlsr) + Q <= srval; + else if (muxce) + Q <= DI; + end else begin + always @(posedge muxclk) + if (muxlsr) + Q <= srval; + else if (muxce) + Q <= DI; + end + endgenerate +endmodule |