// SEMI-DECOUPLED Controllers //
module master_ctrl(rst, ri, ai, ro, ao, l);
input rst, ri, ao;
output l, ai, ro;
wire nl;
wire nrst, lninp1, lninp2;
wire roainp;
wire ridp1,ridp2,ridp3;
not dnot (nridm, ri);
not rnot (nrst, rst);
nand rnand (ainrst, ai, nrst);
// nor (ainrst, ai, rst);
and andl1 (lninp1, ainrst, nridm);
and andl2 (lninp2, ro, ao, nridm);
nor norl (nl, lninp1, lninp2);
assign ai = nl;
not notl (l, nl);
not notro (nro, ro);
and andro (roainp, nro, ao);
nor norro (ro, roainp, l);
endmodule
module slave_ctrl(rst, ri, ai, ro, ao, l);
input rst, ri, ao;
output l, ai, ro;
wire nl;
wire nrst, lninp1, lninp2;
wire roainp;
wire ridp1,ridp2,ridp3;
not dnot (nridm, ri);
// not rnot (nrst, rst);
// nand rnand (ainrst, ai, nrst);
nor (ainrst, ai, rst);
and andl1 (lninp1, ainrst, nridm);
and andl2 (lninp2, ro, ao, nridm);
nor norl (nl, lninp1, lninp2);
assign ai = nl;
not notl (l, nl);
not notro (nro, ro);
and andro (roainp, nro, ao);
nor norro (ro, roainp, rst, l);
endmodule