Fix uart status multiple drivers
This commit is contained in:
@@ -48,30 +48,33 @@ always_ff @(posedge clk_50) begin
|
|||||||
if (reset) begin
|
if (reset) begin
|
||||||
state <= READY;
|
state <= READY;
|
||||||
irqb <= '1;
|
irqb <= '1;
|
||||||
status <= '0;
|
|
||||||
end else begin
|
end else begin
|
||||||
state <= next_state;
|
state <= next_state;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always_ff @(negedge clk) begin
|
always_ff @(negedge clk) begin
|
||||||
status[1] <= tx_busy | tx_en;
|
if (reset) begin
|
||||||
|
status <= '0;
|
||||||
|
end else begin
|
||||||
|
status[1] <= tx_busy | tx_en;
|
||||||
|
|
||||||
status[0] <= status[0] | rx_data_valid;
|
status[0] <= status[0] | rx_data_valid;
|
||||||
if (cs & ~addr & rwb) begin
|
if (cs & ~addr & rwb) begin
|
||||||
status[0] <= 0;
|
status[0] <= 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
if (cs & ~rwb) begin
|
if (cs & ~rwb) begin
|
||||||
case (addr)
|
case (addr)
|
||||||
1'b0: begin
|
1'b0: begin
|
||||||
tx_data <= i_data;
|
tx_data <= i_data;
|
||||||
end
|
end
|
||||||
|
|
||||||
1'b1: begin
|
1'b1: begin
|
||||||
control <= i_data;
|
control <= i_data;
|
||||||
end
|
end
|
||||||
endcase
|
endcase
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -80,7 +83,7 @@ always_comb begin
|
|||||||
case (addr)
|
case (addr)
|
||||||
1'b0: begin
|
1'b0: begin
|
||||||
o_data = rx_data;
|
o_data = rx_data;
|
||||||
end
|
end
|
||||||
|
|
||||||
1'b1: begin
|
1'b1: begin
|
||||||
o_data = status;
|
o_data = status;
|
||||||
|
|||||||
Reference in New Issue
Block a user