You can also use a register instead of a constant parameter for the factor, then in your small example, you could easily modulate the sine frequency. ![]() RGB0(RGB0) ) defparam inst1.CURRENT_MODE = 1 defparam inst1.RGB0_CURRENT = "0b000011" defparam inst1.RGB1_CURRENT = "0b000111" defparam inst1.RGB2_CURRENT = "0b001111" initial begin sin_addr <= 7'b0 sin_ctr <= 17'b0 end endmodule You can use any dividing factor this way, not just a power of two. CLKHF(oclk) ) defparam OSCInst0.CLKHF_DIV = "0b01" reg sin_ctr reg sin_addr wire sin_val parameter NDIV = 17'd100000 always oclk) begin if (sin_ctr = (NDIV - 17'd1)) begin sin_addr <= sin_addr + 7'd1 sin_ctr <= 17'd0 end else begin sin_ctr <= sin_ctr + 17'd1 end end ROM_SIN_256 sin_inst(. ![]() ![]() Code: module top(rst, RGB0, a1) input rst output RGB0, a1 wire a1 HSOSC OSCInst0 (.
0 Comments
Leave a Reply. |