scbtnb.v
537 Bytes
module scbtnb (co, q, qn, ci, cp, sdn, cdn);
input ci, cp, sdn, cdn;
output co, q, qn;
reg iq, iqn, ico;
buf (q,iq);
buf (qn,iqn);
and (co,ci,ico);
always @(posedge cp)
if (ci)
begin
{ico,iqn} = iqn+1;
iq = ~iqn;
end
always @(sdn or cdn)
case ({cdn,sdn})
2'b00: assign {ico,iq,iqn} = 3'b110;
2'b01: assign {ico,iq,iqn} = 3'b001;
2'b10: assign {ico,iq,iqn} = 3'b110;
2'b11: deassign {ico,iq,iqn} ;
endcase
endmodule