![]() |
|
|
|||||||
![]() |
VHDL - Representing the buffer with logic gates,flipflops |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hello all,
Does anyone tried implementing the an array with logic gates, flipflops in vhdl?? I f so, can u pls give me idea ... ** No need of source code...idea to start.. KSR |
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Mar 2008
Location: Denmark
Posts: 245
|
Try this page - could give you inspiration:
jjmk.dk/MMMI/Exercises/05_Counters_Shreg/No4_LIFO_Stack/index.htm jeppe |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Oct 2009
Posts: 12
|
@jeppe,
i tried to define an array ..As u can see instead of using constant sample i tried to write code such that for every rising edge of clk the array should get filled.. package arrays is type a1 is array (1 to 7) of integer range 0 to 8; --constant sample:a1:=(1,2,3,4,5,6,7); to define an array activate this.. end arrays; Library ieee; Library work; use ieee.std_logic_1164.all; use work.arrays.all; entity rbf2410 is port(i : in integer range 0 to 8; clk : in std_logic; output : out integer range 0 to end rbf2410; architecture rbf1 of rbf2410 is signal arr : a1; begin process(clk) variable i : integer range 0 to 8; begin if rising_edge(clk) then i:=i+1; if (i<7) then arr(i)<=i; output<=arr(i); -- i<=i+1; else arr(i)<=i; output<=arr(i); i:=0; end if; end if; end process; end rbf1; But i am not getting exact o/p in waveform..like there is a delay in o/p Can u hav a look at this?? KSR |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Mar 2008
Location: Denmark
Posts: 245
|
Code:
this should remove your delay - search the net for the interactive book - EVITA VHDL - chapter 6 will answer you question Jeppe jeppe Last edited by jeppe : 10-30-2009 at 10:54 AM. |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Oct 2009
Posts: 12
|
@jeppe,
delay got removed in o/p...and i read e-vita..Thanks for sharing it!! heres a quick question.. i am observed that my o/p is starting with 0 value followed by given input values..dis is because of falling edge of clk..is thr anyway to get rid of dis 0?? In addition i want to know, 1)Can we get the values stored in an array ...like wise print statement displaying the values of an array in C??(I am novice to this field donno this is a rite ques. or not) 2) Can we implement an array without a process statement??? Thanks, KSR. KSR |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Mar 2008
Location: Denmark
Posts: 245
|
Hi KSR
If your code for the purpose of simulation will some the operations be possible - like for instance some of the print like statemens. Anyway will a simulator alllow ýou to display the content of an array. Yes you can use an array without a process. But more "advanced" code will take a process to implement. jeppe |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Oct 2009
Posts: 12
|
can u pls help me in figuring out ring buffer from that array code.
I tried but my empty, full signals are not incrementing even at clock edge.. Give me some idea how to start... Waiting for reply.. Kavya. KSR |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Mar 2008
Location: Denmark
Posts: 245
|
Whats the entity of your ringbuffer?
jeppe |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Oct 2009
Posts: 12
|
entity rbf is
generic ( B : natural :=8; -- number of bit W: natural :=4 -- number of address bit ); port ( clk, reset : in std_logic; rd, wr : in std_logic; w_data : in std_logic_vector ( B-1 downto 0); empty, full : out std_logic; r_data : out std_logic_vector (B-1 downto 0) ); end rbf; heres the entity.. i got code compiled..but when i tried to view waveform by giving input data..output signals r blank(0).. Thanks KSR KSR |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Mar 2008
Location: Denmark
Posts: 245
|
Hi Kavya
Try this code - I know you wanted hints - but you got some code instead which you can modify for your needs. your welcome Jeppe Code:
jeppe |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Introduction to Logic Gates | Silverstrand | Front Page News | 0 | 10-24-2005 02:44 PM |
| Harddrives and logic cards | Grunt Huckett | Computer Support | 2 | 10-29-2003 02:08 PM |