Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Ring Oscillator Design VHDL

Status
Not open for further replies.

Shahin Bayat

Newbie level 4
Joined
May 20, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
37
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
Joined
Jan 22, 2008
Messages
47,443
Helped
14,036
Reputation
28,325
Reaction score
12,686
Trophy points
1,393
Location
Bochum, Germany
Activity points
275,941
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.
 

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,651
Helped
1,774
Reputation
3,554
Reaction score
1,722
Trophy points
1,393
Location
USA
Activity points
57,802

Shahin Bayat

Newbie level 4
Joined
May 20, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
37
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
Vivado 2015.1
http://www.xilinx.com/support/documentation/sw_manuals/xilinx2015_1/ug953-vivado-7series-libraries.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:
image.png

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


TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,025
Helped
2,058
Reputation
4,133
Reaction score
2,010
Trophy points
1,393
Activity points
38,601
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
Joined
Jan 22, 2008
Messages
47,443
Helped
14,036
Reputation
28,325
Reaction score
12,686
Trophy points
1,393
Location
Bochum, Germany
Activity points
275,941
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
Joined
May 20, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
37
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
Joined
May 20, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
37
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!
 

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,651
Helped
1,774
Reputation
3,554
Reaction score
1,722
Trophy points
1,393
Location
USA
Activity points
57,802
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top