sigcounter.tdf

来自「为电子工业出版社的51单片机C语言常用模块与综合系统设计实例精讲随书光盘」· TDF 代码 · 共 54 行

TDF
54
字号
SUBDESIGN sigcounter
(
	sig, lrst,suocun,oe		: INPUT ;
	ad[7..0]	: OUTPUT;
)

VARIABLE
	cnt0[7..0]		:DFF;
	cnt1[7..0]		:DFF;
	reg[4..0]		:DFF;
	tnode[7..0] : TRI_STATE_NODE;
BEGIN
	reg0.clk=suocun;
	reg0.d=!reg0;
	reg1.clk=!oe;
	reg1.d=!reg0;
	reg2.clk=!suocun;
	reg2.d=reg0;
	reg3.clk=!oe;
	reg3.d=reg0;
	reg4.clk=!suocun;
	reg4.d=!reg0;

	cnt0[].clk=sig & reg0;
	cnt1[].clk=sig & !reg0;

	cnt0[].clrn=lrst & (reg3.q # reg4.q);
	cnt1[].clrn=lrst & (reg1.q # reg2.q);

	cnt0[].d=cnt0[]+1;
	cnt1[].d=cnt1[]+1;

	tnode[7]=TRI(cnt0[7].q,oe & !reg0);
	tnode[7]=TRI(cnt1[7].q,oe & reg0);
	tnode[6]=TRI(cnt0[6].q,oe & !reg0);
	tnode[6]=TRI(cnt1[6].q,oe & reg0);
	tnode[5]=TRI(cnt0[5].q,oe & !reg0);
	tnode[5]=TRI(cnt1[5].q,oe & reg0);
	tnode[4]=TRI(cnt0[4].q,oe & !reg0);
	tnode[4]=TRI(cnt1[4].q,oe & reg0);
	tnode[3]=TRI(cnt0[3].q,oe & !reg0);
	tnode[3]=TRI(cnt1[3].q,oe & reg0);
	tnode[2]=TRI(cnt0[2].q,oe & !reg0);
	tnode[2]=TRI(cnt1[2].q,oe & reg0);
	tnode[1]=TRI(cnt0[1].q,oe & !reg0);
	tnode[1]=TRI(cnt1[1].q,oe & reg0);
	tnode[0]=TRI(cnt0[0].q,oe & !reg0);
	tnode[0]=TRI(cnt1[0].q,oe & reg0);

	ad[]=tnode[];
	
END;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?