When "read_irq_reg" and "(transmit_buffer_status & (~transmit_buffer_status_q) & transmit_irq_en)" is active both at the same time, the register "transmit_irq" do not set and IRQ is lost. I am sorry, but my English is bad.
The current code:
reg transmit_irq; always @ (posedge clk or posedge rst) begin if (rst) transmit_irq <= 1'b0; else if (reset_mode || read_irq_reg) transmit_irq <=#Tp 1'b0; else if (transmit_buffer_status & (~transmit_buffer_status_q) & transmit_irq_en) transmit_irq <=#Tp 1'b1; end
should be:
reg transmit_irq; always @ (posedge clk or posedge rst) begin if (rst) transmit_irq <= 1'b0; else if (reset_mode) transmit_irq <=#Tp 1'b0; else if (transmit_buffer_status & (~transmit_buffer_status_q) & transmit_irq_en) transmit_irq <=#Tp 1'b1; else if (read_irq_reg) transmit_irq <=#Tp 1'b0; end
I also found it and modified it in the same way. But I'm very curious why only "transmit_irq" has this problem. For example:
reg data_overrun_irq; always @ (posedge clk or posedge rst) begin if (rst) data_overrun_irq <= 1'b0; else if (overrun & (~overrun_q) & data_overrun_irq_en) data_overrun_irq <=#Tp 1'b1; else if (reset_mode || read_irq_reg) data_overrun_irq <=#Tp 1'b0; end
the "data_overrun_irq" would be set correctly and "(reset_mode || read_irq_reg)" was written in the right position. So, is it the author's mistake or the author's consideration for some other reason?