OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [utils/] [minsoc_wb_32_8_bridge.v] - Blame information for rev 125

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 rfajardo
 
2
module minsoc_wb_32_8_bridge(
3
    wb_32_sel_i,
4
    wb_32_dat_i, wb_32_dat_o, wb_32_adr_i,
5
 
6
    wb_8_dat_i, wb_8_dat_o, wb_8_adr_i
7
);
8
 
9
input [3:0] wb_32_sel_i;
10
 
11
input [31:0] wb_32_dat_i;
12
output reg [31:0] wb_32_dat_o;
13
input [31:0] wb_32_adr_i;
14
 
15
output reg [7:0] wb_8_dat_i;
16
input [7:0] wb_8_dat_o;
17
output [31:0] wb_8_adr_i;
18
 
19
reg [1:0] wb_8_adr;
20
 
21
// put output to the correct byte in 32 bits using select line
22
always @(wb_32_sel_i or wb_8_dat_o)
23
    case (wb_32_sel_i)
24
        4'b0001: wb_32_dat_o <= #1 {24'b0, wb_8_dat_o};
25
        4'b0010: wb_32_dat_o <= #1 {16'b0,  wb_8_dat_o , 8'b0};
26
        4'b0100: wb_32_dat_o <= #1 {8'b0, wb_8_dat_o , 16'b0};
27
        4'b1000: wb_32_dat_o <= #1 {wb_8_dat_o , 24'b0};
28
        4'b1111: wb_32_dat_o <= #1 {24'b0, wb_8_dat_o};
29
        default: wb_32_dat_o <= #1 0;
30
    endcase // case(wb_sel_i)
31
 
32
always @(wb_32_sel_i or wb_32_dat_i)
33
begin
34
        case (wb_32_sel_i)
35
                4'b0001 : wb_8_dat_i = wb_32_dat_i[7:0];
36
                4'b0010 : wb_8_dat_i = wb_32_dat_i[15:8];
37
                4'b0100 : wb_8_dat_i = wb_32_dat_i[23:16];
38
                4'b1000 : wb_8_dat_i = wb_32_dat_i[31:24];
39
                default : wb_8_dat_i = wb_32_dat_i[7:0];
40
        endcase // case(wb_sel_i)
41
        case (wb_32_sel_i)
42
                4'b0001 : wb_8_adr = 2'h3;
43
                4'b0010 : wb_8_adr = 2'h2;
44
                4'b0100 : wb_8_adr = 2'h1;
45
                4'b1000 : wb_8_adr = 2'h0;
46
                default : wb_8_adr = 2'h0;
47
        endcase // case(wb_sel_i)
48
end
49
 
50
assign wb_8_adr_i = { wb_32_adr_i[31:2] , wb_8_adr };
51
 
52
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.