Skip to content

Commit

Permalink
couple of minor fixes. send_cnt was not being initialized in one of them
Browse files Browse the repository at this point in the history
  • Loading branch information
rdaly525 committed Nov 8, 2018
1 parent 2695b2c commit e6a3b32
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion verilog/counter.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module vcounter(input CLK, output [2:0] O);
reg [2:0] O;

always @(posedge CLK) begin
O <= O + 1;
O <= O + 1'b1;
end

endmodule
2 changes: 1 addition & 1 deletion verilog/detect111.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module detect111(
input I,
output O
);
reg [1:0] cnt = 0;
reg [1:0] cnt = 2'h0;

wire [1:0] cnt_next;

Expand Down
2 changes: 1 addition & 1 deletion verilog/lbmem.v
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module lbmem(

reg [5:0] waddr = 6'h0;
wire [5:0] raddr;
assign raddr = waddr - {2'h0, wen ? cnt : cnt-1'b1};
assign raddr = waddr - {2'h0, (wen ? cnt : cnt-1'b1)};

always @(posedge CLK) begin
if (wen) begin
Expand Down
8 changes: 2 additions & 6 deletions verilog/uart.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module uart_tx(input CLK, input [7:0] data, input valid, output tx, output ready);
reg [7:0] message;
reg [2:0] send_cnt;
reg [2:0] send_cnt = 3'h0; //Was not initialized.
reg [1:0] state = 2'h0;
always @(posedge CLK) begin
case (state)
Expand All @@ -21,11 +21,7 @@ module uart_tx(input CLK, input [7:0] data, input valid, output tx, output ready
ready <= 1'b0;
tx <= message[send_cnt];
send_cnt <= send_cnt - 1'b1;
if (send_cnt > 0) begin
state <= 2'h1;
end else begin
state <= 2'h2;
end
state <= (send_cnt > 0) ? 2'h1 : 2'h2;
end
2'h2:
begin
Expand Down

0 comments on commit e6a3b32

Please sign in to comment.