scctnb.v
357 Bytes
module scctnb (co, q, qn, ci, cp, cdn);
input ci, cp, cdn;
output co, q, qn;
reg iqn, ico;
not (q,iqn);
buf (qn,iqn);
buf (co,ico);
always @(posedge cp)
if (ci)
{ico,iqn} = iqn+1;
always @(cdn)
case ({cdn})
1'b0: assign {ico,iqn} = 2'b01;
1'b1: deassign {ico,iqn} ;
endcase
endmodule