input [15:0] addr,
inout [7:0] data,
output reg serial = 1);
-
+
+ reg rdlatch = 0;
wire decode = (addr == `MMAP_ADDR);
wire [7:0] odata;
- assign data = (rd && decode) ? odata : 8'bzzzzzzzz;
+ assign data = rdlatch ? odata : 8'bzzzzzzzz;
reg [7:0] data_stor = 0;
reg [15:0] clkdiv = 0;
assign odata = have_data ? 8'b1 : 8'b0;
- always @ (negedge clk)
+ always @ (posedge clk)
begin
+ rdlatch <= rd && decode;
/* deal with diqing */
if(newdata) begin
data_stor <= data;