Last change
on this file since 163 was 154, checked in by demin, 14 years ago |
add configuration registers for the clip module
|
File size:
1.5 KB
|
Line | |
---|
1 | module configuration
|
---|
2 | (
|
---|
3 | input wire clock, reset,
|
---|
4 |
|
---|
5 | input wire bus_ssel, bus_wren,
|
---|
6 | input wire [5: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 [1023:0] cfg_bits
|
---|
13 | );
|
---|
14 |
|
---|
15 | wire [63:0] int_ssel_wire;
|
---|
16 | wire [15:0] int_miso_wire;
|
---|
17 | reg [15:0] int_miso_reg;
|
---|
18 |
|
---|
19 | wire [1023:0] int_bits_wire;
|
---|
20 |
|
---|
21 | integer i;
|
---|
22 | genvar j;
|
---|
23 |
|
---|
24 | generate
|
---|
25 | for (j = 0; j < 64; j = j + 1)
|
---|
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),
|
---|
35 | .q(int_bits_wire[j*16+15:j*16]),
|
---|
36 | .aclr(),
|
---|
37 | .aload(),
|
---|
38 | .aset(),
|
---|
39 | .sload(),
|
---|
40 | .sset());
|
---|
41 | end
|
---|
42 | endgenerate
|
---|
43 |
|
---|
44 | lpm_mux #(
|
---|
45 | .lpm_size(64),
|
---|
46 | .lpm_type("LPM_MUX"),
|
---|
47 | .lpm_width(16),
|
---|
48 | .lpm_widths(6)) bus_miso_mux_unit (
|
---|
49 | .sel(bus_addr),
|
---|
50 | .data(int_bits_wire),
|
---|
51 | .result(int_miso_wire));
|
---|
52 |
|
---|
53 |
|
---|
54 | lpm_decode #(
|
---|
55 | .lpm_decodes(64),
|
---|
56 | .lpm_type("LPM_DECODE"),
|
---|
57 | .lpm_width(6)) lpm_decode_unit (
|
---|
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
|
---|
69 | int_miso_reg <= 16'd0;
|
---|
70 | end
|
---|
71 | else
|
---|
72 | begin
|
---|
73 | int_miso_reg <= int_miso_wire;
|
---|
74 | end
|
---|
75 | end
|
---|
76 |
|
---|
77 | // output logic
|
---|
78 | assign bus_miso = int_miso_reg;
|
---|
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.