每天进步一点点------基础实验_08_触发器 :D、T触发器各一

时间:2023-03-09 17:10:30
每天进步一点点------基础实验_08_触发器 :D、T触发器各一
 /*********************************************************************************
* Company :
* Engineer : 空气微凉
*
* Create Date : 00:00:00 22/03/2013
* Design Name :
* Module Name :
* Project Name :
* Target Devices :
* Tool versions :
* Description :
* http://www.cnblogs.com/kongqiweiliang/
* Dependencies :
*
* Revision :
* Revision : 0.01 - File Created
* Additional Comments : 基础实验_08_触发器 :D、T触发器各一
********************************************************************************/
`timescale 1ns/1ps
`define UD #
/*******************************************************************************/
module FLIP_FLOP
(
//system interface
input iCLK_50 ,//50MHz
input iRESET ,//system interface
//Interface package
input iDFF_DAT ,//
input iTFF_DAT ,//
output reg oDFF_DAT ,//
output reg oTFF_DAT //
);
//-------------------------------------------------------------------------------
//D触发器
always@(posedge iCLK_50 or negedge iRESET)begin
if(!iRESET)
oDFF_DAT <= 'h0;
else
oDFF_DAT <= iDFF_DAT;
end //T触发器
//具有保持和翻转功能的电路,即当T=0时能保持状态不变,
//T=1时一定翻转的电路,都称为T触发器
wire oTFF_DAT_N;
always@(posedge iCLK_50 or negedge iRESET)begin
if(!iRESET)
oTFF_DAT <= 'h0;
else
oTFF_DAT <= oTFF_DAT_N;
end
assign oTFF_DAT_N = iTFF_DAT ? (~oTFF_DAT) : oTFF_DAT;
//-------------------------------------------------------------------------------
endmodule