avl_dacfifo: Fix the avalon address switch

main
Istvan Csomortani 2017-05-15 12:33:39 +03:00
parent 04f397f688
commit da68705fee
1 changed files with 21 additions and 7 deletions

View File

@ -78,8 +78,9 @@ module avl_dacfifo #(
reg dac_bypass = 1'b0;
reg dac_xfer_out_m1 = 1'b0;
reg dac_xfer_out_bypass = 1'b0;
reg avl_xfer_req_m1 = 1'b0;
reg avl_xfer_req = 1'b0;
reg avl_xfer_wren = 1'b0;
reg avl_dma_xfer_req = 1'b0;
reg avl_dma_xfer_req_m1 = 1'b0;
// internal signals
@ -156,8 +157,21 @@ module avl_dacfifo #(
// avalon address multiplexer and output registers
always @(posedge avl_clk) begin
avl_xfer_req_m1 <= dma_xfer_req;
avl_xfer_req <= avl_xfer_req_m1;
avl_dma_xfer_req_m1 <= dma_xfer_req;
avl_dma_xfer_req <= avl_dma_xfer_req_m1;
end
always @(posedge avl_clk) begin
if (avl_reset == 1) begin
avl_xfer_wren <= 0;
end else begin
if (avl_dma_xfer_req == 1) begin
avl_xfer_wren <= 1;
end
if (avl_xfer_out_s == 1) begin
avl_xfer_wren <= 0;
end
end
end
always @(posedge avl_clk) begin
@ -169,9 +183,9 @@ module avl_dacfifo #(
avl_write <= 0;
avl_writedata <= 0;
end else begin
avl_address <= (avl_xfer_req == 1'b1) ? avl_wr_address_s : avl_rd_address_s;
avl_burstcount <= (avl_xfer_req == 1'b1) ? avl_wr_burstcount_s : avl_rd_burstcount_s;
avl_byteenable <= (avl_xfer_req == 1'b1) ? avl_wr_byteenable_s : avl_rd_byteenable_s;
avl_address <= (avl_xfer_wren == 1'b1) ? avl_wr_address_s : avl_rd_address_s;
avl_burstcount <= (avl_xfer_wren == 1'b1) ? avl_wr_burstcount_s : avl_rd_burstcount_s;
avl_byteenable <= (avl_xfer_wren == 1'b1) ? avl_wr_byteenable_s : avl_rd_byteenable_s;
avl_read <= avl_read_s;
avl_write <= avl_write_s;
avl_writedata <= avl_writedata_s;