//Reading port
//Writing port.
wire equaladd;
reg status;
wire finalfull, finalempty;
//'data_out' logic:
//'data_in' logic:
// (binary counters) :
cntr write
(.counter_out(pwrite),
.en(wen),
.rst_n(reset),
.clk_en(wclk)
);
cntr read
(.counter_out(pread),
.en(ren),
.rst_n(reset),
.clk_en(rclk)
);
//comparator logic:
//'status' latch
if (edir | reset)
else if (fdir)
status = 1; //going full.
always @ (posedge wclk, posedge finalfull) //'full logic synchronised with write clock'.
if (finalfull)
full <= 1;
else
full <= 0;
always @ (posedge rclk, posedge finalempty) //'Empty logic synchronised with read clock'.
if (finalempty)
empty <= 1;
else
empty <= 0;
endmodule