Skip to content

Commit

Permalink
V2: axi_dmac: Sanitize bit ops and comb logic
Browse files Browse the repository at this point in the history
Sanitize bitwise operators and combinational logic to avoid mixing them
in the same statement.

Signed-off-by: Jorge Marques <[email protected]>
  • Loading branch information
gastmaier committed Jul 16, 2024
1 parent d728cfd commit da7182a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion library/axi_dmac/axi_dmac_ext_sync.v
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module axi_dmac_ext_sync #(
end
end

assign req_ext_sync = req_src_ext_sync || req_dest_ext_sync;
assign req_ext_sync = req_src_ext_sync | req_dest_ext_sync;
assign ext_sync_ready = ext_sync_ready_s;

end else begin
Expand Down
24 changes: 12 additions & 12 deletions library/axi_dmac/axi_dmac_framelock.v
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module axi_dmac_framelock #(
always @(posedge req_aclk) begin
if (req_aresetn == 1'b0) begin
prev_buf_done <= 1'b1;
end else if (out_req_valid & out_req_ready) begin
end else if (out_req_valid && out_req_ready) begin
prev_buf_done <= 1'b0;
end else if (resp_eot) begin
prev_buf_done <= 1'b1;
Expand All @@ -120,7 +120,7 @@ module axi_dmac_framelock #(
if (req_aresetn == 1'b0) begin
transfer_id <= 'h0;
req_address <= 'h0;
end else if (req_valid & req_ready) begin
end else if (req_valid && req_ready) begin
transfer_id <= 'h0;
req_address <= FRAMELOCK_MODE ? req_src_address : req_dest_address;
end else if (calc_enable) begin
Expand All @@ -137,7 +137,7 @@ module axi_dmac_framelock #(
// Latch the transfer IDs so it can be passed to the reader
// once it is completed
always @(posedge req_aclk) begin
if (out_req_valid & out_req_ready) begin
if (out_req_valid && out_req_ready) begin
cur_frame_id <= transfer_id;
end
end
Expand All @@ -147,13 +147,13 @@ module axi_dmac_framelock #(
req_ready <= 1'b1;
end else if (req_ready == 1'b1) begin
req_ready <= ~req_valid;
end else if (out_req_valid & out_req_ready) begin
end else if (out_req_valid && out_req_ready) begin
req_ready <= ~req_cyclic;
end
end

always @(*) begin
out_req_valid = calc_enable & (calc_done || ~req_flock_en);
out_req_valid = calc_enable & (calc_done | ~req_flock_en);
end

generate if (FRAMELOCK_MODE == 0) begin
Expand All @@ -172,7 +172,7 @@ module axi_dmac_framelock #(
always @(posedge req_aclk) begin
if (req_aresetn == 1'b0) begin
reader_started <= 1'b0;
end else if (req_valid & req_ready) begin
end else if (req_valid && req_ready) begin
reader_started <= 1'b0;
end else if (~req_ready) begin
if (s_frame_id_vld) begin
Expand All @@ -187,9 +187,9 @@ module axi_dmac_framelock #(
assign s_frame_id = m_frame_in[MAX_NUM_FRAMES_WIDTH-1:0];
assign s_frame_id_vld = m_frame_in[MAX_NUM_FRAMES_WIDTH];

assign calc_done = s_frame_id != transfer_id ||
reader_started == 1'b0 ||
req_flock_mode == 1'b1;
assign calc_done = (s_frame_id != transfer_id ||
reader_started == 1'b0 ||
req_flock_mode == 1'b1);
end else begin

// Reader mode logic
Expand Down Expand Up @@ -220,7 +220,7 @@ module axi_dmac_framelock #(
always @(posedge req_aclk) begin
if (req_aresetn == 1'b0) begin
wait_distance <= 1'b1;
end else if (req_valid & req_ready) begin
end else if (req_valid && req_ready) begin
wait_distance <= req_cyclic && req_flock_en;
end else if (~req_ready) begin
if (({1'b0, m_frame_id} == req_flock_distance) && m_frame_id_vld) begin
Expand Down Expand Up @@ -288,8 +288,8 @@ module axi_dmac_framelock #(
// until the writer completes a buffer. In Dynamic Flock just wait until
// the required number of buffers are filled, then enable the request
// generation regardless of the writer.
assign enable_out_req = req_flock_wait_writer == 1'b0 ||
((m_frame_ready | ~req_flock_mode) & ~wait_distance);
assign enable_out_req = (req_flock_wait_writer == 1'b0 ||
((m_frame_ready | ~req_flock_mode) & ~wait_distance));

end
endgenerate
Expand Down
2 changes: 1 addition & 1 deletion library/axi_dmac/dmac_2d_transfer.v
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ module dmac_2d_transfer #(
end
end

assign out_req_last = (out_last || (DMA_2D_TLAST_MODE == 1)) & gen_last;
assign out_req_last = (out_last | (DMA_2D_TLAST_MODE == 1)) & gen_last;
assign out_req_islast = out_last;

endmodule

0 comments on commit da7182a

Please sign in to comment.