Skip to content

Commit 1de6441

Browse files
committed
Minor fixes
1 parent ee9d1b9 commit 1de6441

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

ActionBurst.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ end
7878

7979
genvar i;
8080
generate
81-
for (i=0; i<WIDTH; i=i+1) begin
81+
for (i=0; i<WIDTH; i=i+1) begin : AB_GEN_FOR
8282
assign out[i] = PgOut && ( i == state[31:0] );
8383
end
8484
endgenerate

UartRx.v

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ UartRx UR1 (
1717
.rx_data(),
1818
.rx_busy(),
1919
.rx_done(),
20+
.rx_err(),
2021
.rxd()
2122
);
2223
defparam UR1.CLK_HZ = 200_000_000;
@@ -25,7 +26,7 @@ defparam UR1.BAUD = 9600; // max. BAUD is CLK_HZ / 2
2526
--- INSTANTIATION TEMPLATE END ---*/
2627

2728

28-
module UartRx(clk, nrst, rx_data, rx_busy, rx_done, rxd);
29+
module UartRx(clk, nrst, rx_data, rx_busy, rx_done, rx_err, rxd);
2930

3031
parameter CLK_HZ = 200_000_000;
3132
parameter BAUD = 9600;
@@ -37,6 +38,7 @@ input wire nrst;
3738
output reg [7:0] rx_data = 0;
3839
output reg rx_busy = 0;
3940
output reg rx_done = 0; // read strobe
41+
output reg rx_err = 0; // read strobe
4042
input wire rxd;
4143

4244

@@ -60,6 +62,7 @@ always @ (posedge clk) begin
6062
rx_data[7:0] <= 0;
6163
rx_busy <= 0;
6264
rx_done <= 0;
65+
rx_err <= 0;
6366
rx_sample_cntr[15:0] <= (BAUD_DIVISOR_2 - 1);
6467
rx_data_cntr[3:0] <= 4'b1000;
6568
end else begin
@@ -69,6 +72,7 @@ always @ (posedge clk) begin
6972
rx_data[7:0] <= 0;
7073
rx_busy <= 1;
7174
rx_done <= 0;
75+
rx_err <= 0;
7276
rx_data_cntr[3:0] <= 4'b1000;
7377
end // start_bit_strobe
7478
end else begin
@@ -84,17 +88,18 @@ always @ (posedge clk) begin
8488
if (rxd) begin
8589
rx_done <= 1;
8690
end else begin
87-
rx_busy <= 0;
91+
rx_err <= 1;
8892
end // rxd
8993
end else begin // do sample and shift data
9094
rx_data[7:0] <= {rxd, rx_data[7:1]};
9195
rx_data_cntr[3:0] <= rx_data_cntr[3:0] - 1;
9296
end // rx_data_cntr[3:0]
9397
end // rx_do_sample
9498

95-
if (rx_done) begin
99+
if (rx_done || rx_err) begin
96100
rx_busy <= 0;
97101
rx_done <= 0;
102+
rx_err <= 0;
98103
end // rx_done
99104

100105
end // ~rx_busy

0 commit comments

Comments
 (0)