LIBRARY ieee USE ieeestdlogic1164ALL ENTITY ram16x8 IS PORT
LIBRARY ieee; USE ieee.std_logic_1164.ALL; ENTITY ram16x8 IS PORT (address : IN STD_LOGIC_VECTOR(3 DOWNTO 0); csbar, oebar, webar : IN STD_LOGIC; data : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0)); END ram16x8; ARCHITECTURE version1 OF ram16x8 IS BEGIN PROCESS (address, csbar, oebar, webar, data) TYPE ram_array IS ARRAY (0 TO 15) OF BIT_VECTOR(7 DOWNTO 0); VARIABLE index : INTEGER := 0; VARIABLE ram_store : ram_array; BEGIN IF csbar = \'0\' THEN calculate address as an integer index := 0; FOR i IN address\'RANGE LOOP IF address(i) = \'1\' THEN index := index + 2**i; END IF; END LOOP; IF rising_edge(webar) THEN write to ram on rising edge of write pulse ram_store(index) := To_bitvector(data); ELSIF oebar = \'0\' THEN data <= To_StdlogicVector(ram_store(index)); ELSE data <= \"ZZZZZZZZ\"; END IF; ELSE data <= \"ZZZZZZZZ\"; END IF; END PROCESS; END version1;
Describe the VHDL code above in detail with step-by-step explanations as paragraphs please in the form of text.
Solution
LIBRARY ieee:::::;Means it is from the ieee standards
USE ieee.std_logic_1164.ALL::::::::The IEEE 1164 defines a package design unit that contains declarations that support a uniform representation of logic value in VHDL hardware expression.
ENTITY ram16x8 IS PORT (address : IN STD_LOGIC_VECTOR(3 DOWNTO 0);::::::Entity is the description of the interface between a design and an external environment.it may also specify declarations and statements that are the part of design entity.A design entity declaration may be share by many design entitites.3 donto o means 3 corresponds to MSB nad 0 corresponds to LSB.
16*8 means 16 words size and 8 bits per second!!!!
csbar, oebar, webar : IN STD_LOGIC; data : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0)); standard logic with in and out instructions which will be vector (7 downto 0) 7 corresponds to MSB and 0 corresponds to LSB
END ram16x8 :::::::::THE Random Access Memory will be closed which consists of 16 words and 8 bits per second
ARCHITECTURE version1 OF ram16x8 IS BEGIN PROCESS (address, csbar, oebar, webar, data) TYPE ram_array IS ARRAY (0 TO 15) OF BIT_VECTOR(7 DOWNTO 0);An architecture body is used to describe the behaviour ,data flow or structure of design entity.
Architecture means it describes internal relationship between input and output portsit consists of two parts
declaration and concurrent statements!!!!
VARIABLE index : INTEGER := 0; VARIABLE ram_store : ram_array::::::Ram will have the integer values whic consits an array
BEGIN IF csbar = \'0\' THEN calculate address as an integer index := 0; FOR i IN address\'RANGE LOOP IF address(i) = \'1\' THEN index := index + 2**i; END IF; ::::::::::::
CSBAR means chip select address base register........if it is 0 it will calculate addresss and if it is 1 it will range its address.
END LOOP;The loop will be closed
IF rising_edge(webar) THEN write to ram on rising edge of write pulse ram_store(index) := To_bitvector(data); ELSIF oebar = \'0\' THEN data <= To_StdlogicVector(ram_store(index)); ELSE data <= \"ZZZZZZZZ\"; END IF; ELSE data <= \"ZZZZZZZZ\"; END IF; END PROCESS; END version1;
if the wave has a rising edge it will be stored in index with respect to vector
that will be stored in the ram store index
Comment
