Last change
on this file since 96 was 91, checked in by demin, 15 years ago |
fix communication with external SRAM
|
File size:
1.5 KB
|
Rev | Line | |
---|
[90] | 1 | module configuration
|
---|
| 2 | (
|
---|
| 3 | input wire clock, reset,
|
---|
| 4 |
|
---|
| 5 | input wire bus_ssel, bus_wren,
|
---|
| 6 | input wire [3:0] bus_addr,
|
---|
| 7 | input wire [15:0] bus_mosi,
|
---|
| 8 |
|
---|
| 9 | output wire [15:0] bus_miso,
|
---|
| 10 | output wire bus_busy,
|
---|
| 11 |
|
---|
| 12 | output wire [255:0] cfg_bits
|
---|
| 13 | );
|
---|
| 14 |
|
---|
| 15 | wire [15:0] int_ssel_wire;
|
---|
| 16 | wire [15:0] int_miso_wire;
|
---|
[91] | 17 | reg [15:0] int_miso_reg;
|
---|
[90] | 18 |
|
---|
| 19 | wire [15:0] int_q_wire [15:0];
|
---|
| 20 | wire [255:0] int_bits_wire;
|
---|
| 21 |
|
---|
| 22 | integer i;
|
---|
| 23 | genvar j;
|
---|
| 24 |
|
---|
| 25 | generate
|
---|
| 26 | for (j = 0; j < 16; j = j + 1)
|
---|
| 27 | begin : BUS_OUTPUT
|
---|
| 28 | assign int_bits_wire[j*16+15:j*16] = int_q_wire[j];
|
---|
| 29 | lpm_ff #(
|
---|
| 30 | .lpm_fftype("DFF"),
|
---|
| 31 | .lpm_type("LPM_FF"),
|
---|
| 32 | .lpm_width(16)) cfg_reg_unit (
|
---|
| 33 | .enable(int_ssel_wire[j] & bus_ssel & bus_wren),
|
---|
| 34 | .sclr(reset),
|
---|
| 35 | .clock(clock),
|
---|
| 36 | .data(bus_mosi),
|
---|
| 37 | .q(int_q_wire[j]),
|
---|
| 38 | .aclr(),
|
---|
| 39 | .aload(),
|
---|
| 40 | .aset(),
|
---|
| 41 | .sload(),
|
---|
| 42 | .sset());
|
---|
| 43 | end
|
---|
| 44 | endgenerate
|
---|
| 45 |
|
---|
| 46 | lpm_mux #(
|
---|
| 47 | .lpm_size(16),
|
---|
| 48 | .lpm_type("LPM_MUX"),
|
---|
| 49 | .lpm_width(16),
|
---|
| 50 | .lpm_widths(4)) bus_miso_mux_unit (
|
---|
| 51 | .sel(bus_addr),
|
---|
| 52 | .data(int_bits_wire),
|
---|
| 53 | .result(int_miso_wire));
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | lpm_decode #(
|
---|
| 57 | .lpm_decodes(16),
|
---|
| 58 | .lpm_type("LPM_DECODE"),
|
---|
| 59 | .lpm_width(4)) lpm_decode_unit (
|
---|
| 60 | .data(bus_addr),
|
---|
| 61 | .eq(int_ssel_wire),
|
---|
| 62 | .aclr(),
|
---|
| 63 | .clken(),
|
---|
| 64 | .clock(),
|
---|
| 65 | .enable());
|
---|
| 66 |
|
---|
| 67 | always @(posedge clock)
|
---|
| 68 | begin
|
---|
| 69 | if (reset)
|
---|
| 70 | begin
|
---|
[91] | 71 | int_miso_reg <= 16'd0;
|
---|
[90] | 72 | end
|
---|
| 73 | else
|
---|
| 74 | begin
|
---|
[91] | 75 | int_miso_reg <= int_miso_wire;
|
---|
[90] | 76 | end
|
---|
| 77 | end
|
---|
| 78 |
|
---|
| 79 | // output logic
|
---|
[91] | 80 | assign bus_miso = int_miso_reg;
|
---|
[90] | 81 | assign bus_busy = 1'b0;
|
---|
| 82 | assign cfg_bits = int_bits_wire;
|
---|
| 83 |
|
---|
| 84 | endmodule
|
---|
Note:
See
TracBrowser
for help on using the repository browser.