Line | |
---|
1 | module pwm
|
---|
2 | (
|
---|
3 | input wire clock,
|
---|
4 | input wire [47:0] cfg_data,
|
---|
5 | output wire [3:0] out_data
|
---|
6 |
|
---|
7 | );
|
---|
8 |
|
---|
9 | reg [12:0] int_data_reg [3:0];
|
---|
10 | wire [11:0] cfg_data_wire [3:0];
|
---|
11 |
|
---|
12 | integer i;
|
---|
13 | genvar j;
|
---|
14 |
|
---|
15 | always @ (posedge clock)
|
---|
16 | begin
|
---|
17 | for(i = 0; i <= 3; i = i + 1)
|
---|
18 | begin
|
---|
19 | int_data_reg[i] <= {1'b0, int_data_reg[i][11:0]} + {1'b0, cfg_data_wire[i]};
|
---|
20 | end
|
---|
21 | end
|
---|
22 |
|
---|
23 | generate
|
---|
24 | for (j = 0; j <= 3; j = j + 1)
|
---|
25 | begin : PWM_DATA
|
---|
26 | assign cfg_data_wire[j] = cfg_data[j*12+11:j*12];
|
---|
27 | assign out_data[j] = int_data_reg[j][12] ? 1'bz : 1'b0;
|
---|
28 | end
|
---|
29 | endgenerate
|
---|
30 |
|
---|
31 | endmodule
|
---|
Note:
See
TracBrowser
for help on using the repository browser.