I created my own clock since I need a 2Mhz clock and the clock generator IP wont let me go bellow 6Mhz. I created a clock divider module.
module clock_divider#(parameter HALF_CYCLE_COUNT = 128, COUNT_BITS = 8)
(
input clk_in,
output reg clk_out = 1'b0
);
reg [COUNT_BITS - 1:0] counter = 1'b0;
always @(posedge clk_in) begin
if(counter == HALF_CYCLE_COUNT - 1) begin
counter <= 0;
clk_out = ~clk_out;
end else counter <= counter + 1;
end
endmodule
Here is my top level module.
module audio_visualizer
(
input clk,
input m_data,
output m_clk,
output reg m_lr = 1'b1
);
wire pdm_clk;
clock_divider#(.HALF_CYCLE_COUNT(100), .COUNT_BITS(7)) pdm_clk_div(clk, pdm_clk);
assign m_clk = pdm_clk;
wire [7:0] sample;
wire sample_changed;
sampler s(pdm_clk, m_data, 1'b0, sample, sample_changed);
ila_0 i(clk, sample, sample_changed, pdm_clk);
endmodule
I want to declare a constraint so that vivado knows the frequency of pdm_clk. Here is what I have right now for clocking constraints.
set_property -dict { PACKAGE_PIN E3 IOSTANDARD LVCMOS33 } [get_ports { clk }]; #IO_L12P_T1_MRCC_35 Sch=clk100mhz
create_clock -add -name clk -period 10.00 -waveform {0 5} [get_ports {clk}];
create_generated_clock -name pdm_clk -source [get_ports clk] -divide_by 50 [get_ports pdm_clk]
I keep getting this error.
[Vivado 12-1387] No valid object(s) found for create_generated_clock constraint with option '-objects [get_ports pdm_clk]'. ["/home/chase/vivado-workspace/Sound/Sound.srcs/constrs_1/imports/Desktop/Nexys4DDR_Master.xdc":9]
I am not sure how to tell vivado what the output of the generated clock is. I have also tried [get_pins audio_visualizer/pdm_clk]
.