Ring Oscillator Design VHDL

Status
Not open for further replies.

Shahin Bayat

Newbie level 4
Hey guys,

I need to implement some ring oscillators in Vivado on my Nexys4 FPGA from Xilinx and was wondering if anyone has some source code VHDL for a ring oscillator?

I haven't used VHDL in a very long time and can benefit from such source code. I understand that I need to have an odd number of inverters chained together. I finally need to connect the output signal of the very last inverter to one of the general purpose IOs and measure with an oscilloscope?

Please correct me if I'm wrong.

Also, my assumption is that you need a way of setting some constraints on the loop or you would get some errors?

Thanks! :bang:

FvM

Super Moderator
Staff member
Without constraints that directs the synthesis tool to keep redundant logic cells, or using low level primitives to describe the circuit, you won't get a working ring oscillator.

I could tell you how to do it in Altera Quartus, I'm not using Xilinx. But I'm quite sure that it's possible with Xilinx tools, most likely you'll find respective hints in Xilinx forums.

Staff member

Shahin Bayat

Newbie level 4
You can use LUT primitives to avoid having the tools remove logic during synthesis. This avoids any chance of the reoccurring keep attribute bugs from catching up with you ;-).

ISE 14.7
http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_7/7series_hdl.pdf

Look for LUT1, or LUT2 primitives and instantiate them directly in the code.

This sounds way too complicated...

I have written the VHDL code for the following image and the code is attached:

Is it possible to synthesize this and attach an oscilloscope to the output of the oscillator or just read the output of the counter? I'm new to FPGAs, so your reply makes no sense to me...

Thanks,

Attachments

• 3.8 KB Views: 13

TrickyDicky

Without the "complicated" lut primitives, the syntheses tool will simply minimise the not gate chain into a single not gate or just a wire (depending on how many not gates).

Also, each compilation would get you a different result, as it places the logic randomly in the FPGA each time.

FvM

Super Moderator
Staff member
I'm not sure if you actually read what has been written above about removal of redundant logic cells. Your "ring oscillator" is likely to be reduced to a single inverter during synthesis. But it's quite easy to compile the design and review the gate level output. So just try.

The other point is that you shouldn't expect any meaningful output from your counter construct because it misses to synchronize the signals from unrelated clock domains.

Shahin Bayat

Newbie level 4
Without the "complicated" lut primitives, the syntheses tool will simply minimise the not gate chain into a single not gate or just a wire (depending on how many not gates).

Also, each compilation would get you a different result, as it places the logic randomly in the FPGA each time.

Well, do you have a link to a tutorial on how to design such a circuit using LUT premitives? I'm using the Nexys 4 board from Digilent... I've never done anything like this at all, just very basic FPGA designs.

Shahin Bayat

Newbie level 4
I'm not sure if you actually read what has been written above about removal of redundant logic cells. Your "ring oscillator" is likely to be reduced to a single inverter during synthesis. But it's quite easy to compile the design and review the gate level output. So just try.

The other point is that you shouldn't expect any meaningful output from your counter construct because it misses to synchronize the signals from unrelated clock domains.
Sorry I didn't understand your initial post at all. It's starting to make more sense now though. It would be very nice if you could provide a link to a guide to how to implement such structures. I'm using Nexys 4 from Digilent and also the Vivado 2015 design suit..

Thanks!

Super Moderator
Staff member
This sounds way too complicated...

I have written the VHDL code for the following image and the code is attached:
View attachment 117914

Is it possible to synthesize this and attach an oscilloscope to the output of the oscillator or just read the output of the counter? I'm new to FPGAs, so your reply makes no sense to me...

Thanks,
Seriously it's too complicated to instantiate a bunch of LUTs configured as inverters? I could write this in like 10 lines of code in Verilog including the module declaration stuff. Probably take 20 lines in VHDL.

Here is the Verilog version:

Code Verilog - [expand]1
2
3
4
5
6
7
8
9
10
module ro #(parameter N = 9) (output o, input e);
wire [N:0] ro_sig;
generate genvar i;
for (i=0;i<N;i=i+1) begin : gen_luts
LUT1 # (.INIT(2'b01)) inst (.O(ro_sig[i+1]), .I0(ro_sig[i]));
end
assign ro_sig[0] = ro_sig[N] & e;
assign o = ro_sig[N];
endgenerate
endmodule

where
I0 O
0 INIT[0]
1 INIT[1]

Optimizations could include using LUT1_L for local CLB routing and only using the LUT1s when N causes the implementation to spill over into another CLB.

Status
Not open for further replies.