2019-05-13 17:41:35 -05:00
|
|
|
//-----------------------------------------------------
|
|
|
|
// Design Name : static_dff
|
|
|
|
// File Name : ff.v
|
|
|
|
// Function : D flip-flop with asyn reset and set
|
|
|
|
// Coder : Xifan TANG
|
|
|
|
//-----------------------------------------------------
|
|
|
|
//------ Include defines: preproc flags -----
|
2019-11-01 19:22:40 -05:00
|
|
|
// `include "./SRC/fpga_defines.v"
|
2019-05-13 17:41:35 -05:00
|
|
|
module static_dff (
|
|
|
|
/* Global ports go first */
|
|
|
|
input set, // set input
|
2019-08-17 02:49:49 -05:00
|
|
|
input reset, // Reset input
|
2019-05-13 17:41:35 -05:00
|
|
|
input clk, // Clock Input
|
|
|
|
/* Local ports follow */
|
|
|
|
input D, // Data Input
|
2019-08-17 02:49:49 -05:00
|
|
|
output Q // Q output
|
2019-05-13 17:41:35 -05:00
|
|
|
);
|
|
|
|
//------------Internal Variables--------
|
|
|
|
reg q_reg;
|
|
|
|
|
|
|
|
//-------------Code Starts Here---------
|
|
|
|
always @ ( posedge clk or posedge reset or posedge set)
|
|
|
|
if (reset) begin
|
|
|
|
q_reg <= 1'b0;
|
|
|
|
end else if (set) begin
|
|
|
|
q_reg <= 1'b1;
|
|
|
|
end else begin
|
|
|
|
q_reg <= D;
|
|
|
|
end
|
|
|
|
|
|
|
|
// Wire q_reg to Q
|
2019-08-17 02:49:49 -05:00
|
|
|
assign Q = q_reg;
|
2019-05-13 17:41:35 -05:00
|
|
|
|
|
|
|
endmodule //End Of Module static_dff
|
|
|
|
|
|
|
|
//-----------------------------------------------------
|
|
|
|
// Design Name : scan_chain_dff
|
|
|
|
// File Name : ff.v
|
|
|
|
// Function : D flip-flop with asyn reset and set
|
|
|
|
// Coder : Xifan TANG
|
|
|
|
//-----------------------------------------------------
|
|
|
|
module sc_dff (
|
|
|
|
/* Global ports go first */
|
|
|
|
input set, // set input
|
2019-08-17 02:49:49 -05:00
|
|
|
input reset, // Reset input
|
2019-05-13 17:41:35 -05:00
|
|
|
input clk, // Clock Input
|
|
|
|
/* Local ports follow */
|
|
|
|
input D, // Data Input
|
2019-08-17 02:49:49 -05:00
|
|
|
output Q, // Q output
|
|
|
|
output Qb // Q output
|
2019-05-13 17:41:35 -05:00
|
|
|
);
|
|
|
|
//------------Internal Variables--------
|
|
|
|
reg q_reg;
|
|
|
|
|
|
|
|
//-------------Code Starts Here---------
|
|
|
|
always @ ( posedge clk or posedge reset or posedge set)
|
|
|
|
if (reset) begin
|
|
|
|
q_reg <= 1'b0;
|
|
|
|
end else if (set) begin
|
|
|
|
q_reg <= 1'b1;
|
|
|
|
end else begin
|
|
|
|
q_reg <= D;
|
|
|
|
end
|
|
|
|
|
|
|
|
// Wire q_reg to Q
|
2019-08-17 02:49:49 -05:00
|
|
|
assign Q = q_reg;
|
2019-05-13 17:41:35 -05:00
|
|
|
assign Qb = ~Q;
|
|
|
|
|
|
|
|
endmodule //End Of Module static_dff
|
|
|
|
|
|
|
|
//-----------------------------------------------------
|
|
|
|
// Design Name : scan_chain_dff compact
|
|
|
|
// File Name : ff.v
|
|
|
|
// Function : Scan-chain D flip-flop without reset and set //Modified to fit Edouards architecture
|
|
|
|
// Coder : Xifan TANG
|
|
|
|
//-----------------------------------------------------
|
|
|
|
module sc_dff_compact (
|
|
|
|
/* Global ports go first */
|
2019-11-05 16:41:59 -06:00
|
|
|
input reset, // Reset input
|
2019-05-13 17:41:35 -05:00
|
|
|
//input set, // set input
|
2019-11-05 16:41:59 -06:00
|
|
|
input clk, // Clock Input
|
2019-05-13 17:41:35 -05:00
|
|
|
/* Local ports follow */
|
|
|
|
input D, // Data Input
|
2019-08-17 02:49:49 -05:00
|
|
|
output Q, // Q output
|
|
|
|
output Qb // Q output
|
2019-05-13 17:41:35 -05:00
|
|
|
);
|
|
|
|
//------------Internal Variables--------
|
|
|
|
reg q_reg;
|
|
|
|
|
|
|
|
//-------------Code Starts Here---------
|
2019-11-05 16:41:59 -06:00
|
|
|
always @ ( posedge clk or posedge reset /*or posedge set*/)
|
|
|
|
if (reset) begin
|
2019-05-13 17:41:35 -05:00
|
|
|
q_reg <= 1'b0;
|
|
|
|
//end else if (set) begin
|
|
|
|
// q_reg <= 1'b1;
|
|
|
|
end else begin
|
|
|
|
q_reg <= D;
|
|
|
|
end
|
|
|
|
/*
|
|
|
|
// Wire q_reg to Q
|
2019-08-17 02:49:49 -05:00
|
|
|
assign Q = q_reg;
|
2019-05-13 17:41:35 -05:00
|
|
|
assign Qb = ~Q;
|
|
|
|
*/
|
|
|
|
|
|
|
|
`ifndef ENABLE_FORMAL_VERIFICATION
|
|
|
|
// Wire q_reg to Q
|
2019-08-17 02:49:49 -05:00
|
|
|
assign Q = q_reg;
|
2019-05-13 17:41:35 -05:00
|
|
|
assign Qb = ~q_reg;
|
|
|
|
`else
|
2019-08-17 02:49:49 -05:00
|
|
|
assign Q = 1'bZ;
|
2019-05-13 17:41:35 -05:00
|
|
|
assign Qb = !Q;
|
|
|
|
`endif
|
|
|
|
|
|
|
|
endmodule //End Of Module static_dff
|