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