Skip to content

Commit 87d0cf3

Browse files
committed
corrected parity set at Tx
1 parent a6f3d95 commit 87d0cf3

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

quick_rs232.v

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -401,30 +401,27 @@ begin
401401
begin
402402
tx <= 1'b0;
403403
end
404-
`EVEN_PARITY:
405-
begin
406-
tx_data_parity <= tx_buffer[0];
407-
for (i = 1; i < DEFAULT_BYTE_LEN; i = i + 1)
408-
begin
409-
tx_data_parity <= tx_data_parity ^ tx_buffer[i];
410-
end
411-
tx <= tx_data_parity == 1'b0 ? 1'b0: 1'b1;
412-
end
413-
`ODD_PARITY:
404+
default:
414405
begin
415406
tx_data_parity <= tx_buffer[0];
416407
for (i = 1; i < DEFAULT_BYTE_LEN; i = i + 1)
417408
begin
418409
tx_data_parity <= tx_data_parity ^ tx_buffer[i];
419410
end
420-
tx <= tx_data_parity == 1'b0 ? 1'b1: 1'b0;
421411
end
422412
endcase
423413
end
424414

425415
if (DEFAULT_PARITY != `NO_PARITY)
426416
begin
427417
tx_bit_counter <= tx_bit_counter + 1;
418+
if (tx_bit_counter == 1)
419+
begin
420+
if (DEFAULT_PARITY == `EVEN_PARITY)
421+
tx <= tx_data_parity == 1'b0 ? 1'b0: 1'b1;
422+
if (DEFAULT_PARITY == `ODD_PARITY)
423+
tx <= tx_data_parity == 1'b0 ? 1'b1: 1'b0;
424+
end
428425
if (tx_bit_counter == TICKS_PER_UART_BIT)
429426
begin
430427
tx_bit_counter <= 0;

0 commit comments

Comments
 (0)