1 | entity osc is
|
2 | Port ( inp : inout STD_LOGIC;
|
3 | oup : inout STD_LOGIC);
|
4 | end osc;
|
If i were your teacher, you would get the worst grade just for this port
definition! Why the heck is an input connected to an inout port? And why
an output even so? Summary: laziness ist not good for good grades!
Katta Satish wrote:
> and not getting expected output
What do you get instead? And how do you see the erroneuos result?
> How to give feedback (ie output to input)
You use a signal to connect them together. And you do that already with
the x1..x3 signals. Just finisch up the job by using the x4 signal:
1 | entity osc is
|
2 | Port ( inp : in STD_LOGIC;
|
3 | oup : out STD_LOGIC);
|
4 | end osc;
|
5 |
|
6 | architecture Behavioral of osc is
|
7 | signal x1, x2, x3, x4 : STD_LOGIC;
|
8 |
|
9 | component andgate is
|
10 | Port ( inp1 : in STD_LOGIC;
|
11 | inp2 : in STD_LOGIC;
|
12 | out1 : out STD_LOGIC);
|
13 | end component;
|
14 |
|
15 | component inverter1 is
|
16 | Port ( a : in STD_LOGIC;
|
17 | b : out STD_LOGIC);
|
18 | end component;
|
19 |
|
20 | begin
|
21 | oup <= x4;
|
22 |
|
23 | l0: andgate port map ( inp1 => inp, inp2 => x4, out1 => x1 );
|
24 | l1: inverter1 port map ( a => x1, b => x2 );
|
25 | l2: inverter1 port map ( a => x2, b => x3 );
|
26 | l3: inverter1 port map ( a => x3, b => x4 );
|
27 |
|
28 | end Behavioral;
|
Why do you instantiate each lousy gate manually? An AND gate you can
write down this way:
result <= a and b;
And a NOT gate is simply this:
result <= not a;
So finally your description looks like that:
1 | entity osc is
|
2 | Port ( inp : in STD_LOGIC;
|
3 | oup : out STD_LOGIC);
|
4 | end osc;
|
5 |
|
6 | architecture Behavioral of osc is
|
7 | signal x1, x2, x3, x4 : STD_LOGIC;
|
8 | begin
|
9 | oup <= o;
|
10 | x1 <= inp and x4;
|
11 | x2 <= not x1;
|
12 | x3 <= not x2;
|
13 | x4 <= not x3;
|
14 | end Behavioral;
|
Looks much more easy to read, doesn't it?
Katta Satish wrote:
> so ring oscillator will be toggle.
Have a look at my implementations, they run fairly well...
http://www.lothar-miller.de/s9y/categories/29-Ringoszillator
(Google translator will help out, its German)
One more hint: pls use the VHDL tags further on:
1 | [vhdl]
|
2 | vhdl code here
|
3 | [/vhdl]
|