2016-11-01 05:31:13 -05:00
|
|
|
module LUT1(output F, input I0);
|
2016-11-08 11:54:00 -06:00
|
|
|
parameter [1:0] INIT = 0;
|
|
|
|
assign F = I0 ? INIT[1] : INIT[0];
|
2016-11-01 05:31:13 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module LUT2(output F, input I0, I1);
|
2016-11-08 11:54:00 -06:00
|
|
|
parameter [3:0] INIT = 0;
|
|
|
|
wire [ 1: 0] s1 = I1 ? INIT[ 3: 2] : INIT[ 1: 0];
|
|
|
|
assign F = I0 ? s1[1] : s1[0];
|
2016-11-01 05:31:13 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module LUT3(output F, input I0, I1, I2);
|
2016-11-08 11:54:00 -06:00
|
|
|
parameter [7:0] INIT = 0;
|
|
|
|
wire [ 3: 0] s2 = I2 ? INIT[ 7: 4] : INIT[ 3: 0];
|
|
|
|
wire [ 1: 0] s1 = I1 ? s2[ 3: 2] : s2[ 1: 0];
|
|
|
|
assign F = I0 ? s1[1] : s1[0];
|
2016-11-01 05:31:13 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module LUT4(output F, input I0, I1, I2, I3);
|
2016-11-08 11:54:00 -06:00
|
|
|
parameter [15:0] INIT = 0;
|
|
|
|
wire [ 7: 0] s3 = I3 ? INIT[15: 8] : INIT[ 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 F = I0 ? s1[1] : s1[0];
|
2016-11-01 05:31:13 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module DFF (output reg Q, input CLK, D);
|
2016-11-08 11:54:00 -06:00
|
|
|
parameter [0:0] INIT = 1'b0;
|
|
|
|
initial Q = INIT;
|
|
|
|
always @(posedge CLK)
|
2016-11-01 05:31:13 -05:00
|
|
|
Q <= D;
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module DFFN (output reg Q, input CLK, D);
|
2016-11-08 11:54:00 -06:00
|
|
|
parameter [0:0] INIT = 1'b0;
|
|
|
|
initial Q = INIT;
|
|
|
|
always @(negedge CLK)
|
2016-11-01 05:31:13 -05:00
|
|
|
Q <= D;
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module VCC(output V);
|
2016-11-08 11:54:00 -06:00
|
|
|
assign V = 1;
|
2016-11-01 05:31:13 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module GND(output G);
|
2016-11-08 11:54:00 -06:00
|
|
|
assign G = 0;
|
2016-11-01 05:31:13 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module IBUF(output O, input I);
|
2016-11-08 11:54:00 -06:00
|
|
|
assign O = I;
|
2016-11-01 05:31:13 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module OBUF(output O, input I);
|
2016-11-08 11:54:00 -06:00
|
|
|
assign O = I;
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module GSR (input GSRI);
|
|
|
|
wire GSRO = GSRI;
|
2016-11-01 05:31:13 -05:00
|
|
|
endmodule
|
2018-12-03 20:08:35 -06:00
|
|
|
|
|
|
|
module ALU (input I0, input I1, input I3, input CIN, output COUT, output SUM);
|
|
|
|
parameter [3:0] ALU_MODE = 0; // default 0 = ADD
|
|
|
|
assign {COUT, SUM} = CIN + I1 + I0;
|
|
|
|
endmodule // alu
|
|
|
|
|