/* Machine-generated using Migen */
module top(
input sys_clk,
input sys_rst
);
reg [31:0] wishbone_dat_o;
wire [31:0] wishbone_lm32d_dat_o;
wire wishbone_lm32d_stb_o;
reg [3:0] wishbone_sel_o;
wire [3:0] wishbone_lm32d_sel_o;
reg [1:0] wishbone_bte_o;
wire [2:0] wishbone_lm32d_cti_o;
reg roundrobin_grant;
reg lm32_I_RTY_I;
reg [31:0] wishbone_lm32d_dat_i;
reg wishbone_lm32d_ack_i;
wire wishbone_lm32i_cyc_o;
reg wishbone_lm32i_ack_i;
wire [2:0] wishbone_lm32i_cti_o;
reg [31:0] wishbone_adr_o;
reg wishbone_cyc_o;
reg wishbone_lm32i_err_i;
reg [31:0] wishbone_dat_i;
reg wishbone_we_o;
reg wishbone_stb_o;
reg wishbone_ack_i;
wire wishbone_lm32d_cyc_o;
reg [2:0] wishbone_cti_o;
wire wishbone_lm32d_we_o;
reg wishbone_err_i;
wire [1:0] wishbone_lm32d_bte_o;
reg [1:0] roundrobin_request;
wire [31:0] wishbone_lm32i_adr_o;
reg [31:0] wishbone_lm32i_dat_i;
wire [31:0] wishbone_lm32i_dat_o;
wire [3:0] wishbone_lm32i_sel_o;
reg wishbone_lm32d_err_i;
wire wishbone_lm32i_stb_o;
wire wishbone_lm32i_we_o;
wire [31:0] wishbone_lm32d_adr_o;
reg lm32_D_RTY_I;
wire [1:0] wishbone_lm32i_bte_o;
always @(*) begin
lm32_I_RTY_I = 1'd0;
lm32_D_RTY_I = 1'd0;
case (roundrobin_grant)
1'd0: begin
wishbone_adr_o = wishbone_lm32i_adr_o;
end
default: begin
wishbone_adr_o = wishbone_lm32d_adr_o;
end
endcase
case (roundrobin_grant)
1'd0: begin
wishbone_dat_o = wishbone_lm32i_dat_o;
end
default: begin
wishbone_dat_o = wishbone_lm32d_dat_o;
end
endcase
case (roundrobin_grant)
1'd0: begin
wishbone_sel_o = wishbone_lm32i_sel_o;
end
default: begin
wishbone_sel_o = wishbone_lm32d_sel_o;
end
endcase
case (roundrobin_grant)
1'd0: begin
wishbone_cyc_o = wishbone_lm32i_cyc_o;
end
default: begin
wishbone_cyc_o = wishbone_lm32d_cyc_o;
end
endcase
case (roundrobin_grant)
1'd0: begin
wishbone_stb_o = wishbone_lm32i_stb_o;
end
default: begin
wishbone_stb_o = wishbone_lm32d_stb_o;
end
endcase
case (roundrobin_grant)
1'd0: begin
wishbone_we_o = wishbone_lm32i_we_o;
end
default: begin
wishbone_we_o = wishbone_lm32d_we_o;
end
endcase
case (roundrobin_grant)
1'd0: begin
wishbone_cti_o = wishbone_lm32i_cti_o;
end
default: begin
wishbone_cti_o = wishbone_lm32d_cti_o;
end
endcase
case (roundrobin_grant)
1'd0: begin
wishbone_bte_o = wishbone_lm32i_bte_o;
end
default: begin
wishbone_bte_o = wishbone_lm32d_bte_o;
end
endcase
wishbone_lm32i_dat_i = wishbone_dat_i;
wishbone_lm32d_dat_i = wishbone_dat_i;
wishbone_lm32i_ack_i = wishbone_ack_i;
wishbone_lm32d_ack_i = wishbone_ack_i;
wishbone_lm32i_err_i = wishbone_err_i;
wishbone_lm32d_err_i = wishbone_err_i;
roundrobin_request = {wishbone_lm32d_cyc_o, wishbone_lm32i_cyc_o};
end
always @(posedge sys_clk) begin
if (sys_rst) begin
roundrobin_grant <= 1'd0;
end else begin
case (roundrobin_grant)
1'd0: begin
if ((~roundrobin_request[0])) begin
if (roundrobin_request[1]) begin
roundrobin_grant <= 1'd1;
end
end
end
1'd1: begin
if ((~roundrobin_request[1])) begin
if (roundrobin_request[0]) begin
roundrobin_grant <= 1'd0;
end
end
end
endcase
end
end
lm32_top lm32(
.I_ERR_I(wishbone_lm32i_err_i),
.ext_break(lm32_ext_break),
.D_RTY_I(lm32_D_RTY_I),
.D_ACK_I(wishbone_lm32d_ack_i),
.I_ACK_I(wishbone_lm32i_ack_i),
.I_DAT_I(wishbone_lm32i_dat_i),
.D_ERR_I(wishbone_lm32d_err_i),
.interrupt(lm32_interrupt),
.D_DAT_I(wishbone_lm32d_dat_i),
.I_RTY_I(lm32_I_RTY_I),
.I_WE_O(wishbone_lm32i_we_o),
.I_ADR_O(wishbone_lm32i_adr_o),
.I_CTI_O(wishbone_lm32i_cti_o),
.I_BTE_O(wishbone_lm32i_bte_o),
.D_WE_O(wishbone_lm32d_we_o),
.D_STB_O(wishbone_lm32d_stb_o),
.D_BTE_O(wishbone_lm32d_bte_o),
.I_CYC_O(wishbone_lm32i_cyc_o),
.D_CYC_O(wishbone_lm32d_cyc_o),
.D_SEL_O(wishbone_lm32d_sel_o),
.I_SEL_O(wishbone_lm32i_sel_o),
.I_LOCK_O(lm32_I_LOCK_O),
.I_STB_O(wishbone_lm32i_stb_o),
.I_DAT_O(wishbone_lm32i_dat_o),
.D_CTI_O(wishbone_lm32d_cti_o),
.D_DAT_O(wishbone_lm32d_dat_o),
.D_LOCK_O(lm32_D_LOCK_O),
.D_ADR_O(wishbone_lm32d_adr_o),
.clk_i(sys_clk),
.rst_i(sys_rst)
);
endmodule