Line 110... |
Line 110... |
endcase
|
endcase
|
end
|
end
|
end
|
end
|
end
|
end
|
|
|
always @(p0_out or p0_in or p1_out or p1_in or p2_out or p2_in or p3_out or p3_in or rmw)
|
//always @(p0_out or p0_in or p1_out or p1_in or p2_out or p2_in or p3_out or p3_in or rmw)
|
|
always @(posedge clk or posedge rst)
|
begin
|
begin
|
if (rmw) begin
|
if (rst)
|
|
data_out <= #1 8'h0;
|
|
else if (rmw) begin
|
|
if ((rd_addr==wr_addr) & wr & !wr_bit)
|
|
data_out <= #1 data_in;
|
|
else begin
|
case (rd_addr[5:4])
|
case (rd_addr[5:4])
|
2'b00: data_out = p0_out;
|
2'b00: data_out <= #1 p0_out;
|
2'b01: data_out = p1_out;
|
2'b01: data_out <= #1 p1_out;
|
2'b10: data_out = p2_out;
|
2'b10: data_out <= #1 p2_out;
|
2'b11: data_out = p3_out;
|
2'b11: data_out <= #1 p3_out;
|
endcase
|
endcase
|
|
end
|
end else
|
end else
|
case (rd_addr[5:4])
|
case (rd_addr[5:4])
|
2'b00: data_out = p0_in;
|
2'b00: data_out <= #1 p0_in;
|
2'b01: data_out = p1_in;
|
2'b01: data_out <= #1 p1_in;
|
2'b10: data_out = p2_in;
|
2'b10: data_out <= #1 p2_in;
|
2'b11: data_out = p3_in;
|
2'b11: data_out <= #1 p3_in;
|
endcase
|
endcase
|
end
|
end
|
|
|
always @(rmw or rd_addr or p0_out or p1_out or p2_out or p3_out or p0_in or p1_in or p2_in or p3_in)
|
//always @(rmw or rd_addr or p0_out or p1_out or p2_out or p3_out or p0_in or p1_in or p2_in or p3_in)
|
|
always @(posedge clk or posedge rst)
|
begin
|
begin
|
if (rmw) begin
|
if (rst)
|
|
bit_out <= #1 1'b0;
|
|
else if (rmw) begin
|
|
if ((wr_addr==rd_addr) & wr & wr_bit)
|
|
bit_out <= #1 bit_in;
|
|
else begin
|
case (rd_addr[7:3])
|
case (rd_addr[7:3])
|
`OC8051_SFR_B_P0: bit_out = p0_out[rd_addr[2:0]];
|
`OC8051_SFR_B_P0: bit_out <= #1 p0_out[rd_addr[2:0]];
|
`OC8051_SFR_B_P1: bit_out = p1_out[rd_addr[2:0]];
|
`OC8051_SFR_B_P1: bit_out <= #1 p1_out[rd_addr[2:0]];
|
`OC8051_SFR_B_P2: bit_out = p2_out[rd_addr[2:0]];
|
`OC8051_SFR_B_P2: bit_out <= #1 p2_out[rd_addr[2:0]];
|
default: bit_out = p3_out[rd_addr[2:0]];
|
default: bit_out <= #1 p3_out[rd_addr[2:0]];
|
endcase
|
endcase
|
|
end
|
end else begin
|
end else begin
|
case (rd_addr[7:3])
|
case (rd_addr[7:3])
|
`OC8051_SFR_B_P0: bit_out = p0_in[rd_addr[2:0]];
|
`OC8051_SFR_B_P0: bit_out <= #1 p0_in[rd_addr[2:0]];
|
`OC8051_SFR_B_P1: bit_out = p1_in[rd_addr[2:0]];
|
`OC8051_SFR_B_P1: bit_out <= #1 p1_in[rd_addr[2:0]];
|
`OC8051_SFR_B_P2: bit_out = p2_in[rd_addr[2:0]];
|
`OC8051_SFR_B_P2: bit_out <= #1 p2_in[rd_addr[2:0]];
|
default: bit_out = p3_in[rd_addr[2:0]];
|
default: bit_out <= #1 p3_in[rd_addr[2:0]];
|
endcase
|
endcase
|
end
|
end
|
end
|
end
|
|
|
endmodule
|
endmodule
|