Freq. divider in verilog

Discussion in 'Hardware' started by UCF, Oct 20, 2011.

  1. UCF

    UCF

    Joined:
    Oct 20, 2011
    Messages:
    1
    Greetings,
    Im trying to implement simple freq. divider in verilog on SPARTAN 3E FPGA.
    The goal is to feed the device 10MHz on one of the inputs and have 5 different products of division on outputs of it. As I am new to verilog, I think I misunderstand the language. Simulation with the included testbench file does not work either. Would you point me in the right direction, what is wrong here? For my board I change the ports and have appropriate UCF file.
    input i_clk;
    input i_Reset;
    output o_Out;

    parameter Divisor = 4;
    parameter Bits = 2;

    reg [Bits-1 : 0] r_Count;
    reg o_Out;

    always @ (posedge i_clk or posedge i_Reset)
    if (i_Reset) begin
    r_Count <= 0;
    o_Out <= 0;
    end
    else
    if (r_Count != Divisor - 1) begin
    r_Count <= r_Count + 1;
    o_Out <= 0;
    end
    else begin
    r_Count <= 0;
    o_Out <= 1;
    end

    endmodule

    How do I assign an input from the port to i_clk? How do I assign o_out to output and reset to btn?

    Thanks a lot!
     
    UCF, Oct 20, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. am_y

    learning verilog

    am_y, Dec 6, 2006, in forum: Hardware
    Replies:
    0
    Views:
    1,373
  2. sueco_
    Replies:
    0
    Views:
    3,111
    sueco_
    Jul 7, 2009
  3. titan85
    Replies:
    0
    Views:
    2,309
    titan85
    Mar 24, 2010
  4. rizi
    Replies:
    0
    Views:
    2,374
  5. KyoukaNg
    Replies:
    0
    Views:
    580
    KyoukaNg
    Oct 13, 2013
Loading...

Share This Page