![]() |
|
![]() |
|
Answers Database
How to use the VHDL ROC (Reset On Configuration) Component
Record #4686
Product Family: Software --CONFIGURATION Post_M1_simulation OF <testbench_entity_name> IS -- FOR <testbench_architecture_name> -- FOR <design_instance_name>:<design_entity_name> -- FOR STRUCTURE -- FOR ROC_NGD2VHDL:ROC USE ENTITY WORK.ROC(ROC_V) -- generic map (WIDTH => <PERIOD> ns); -- END FOR; -- END FOR; -- END FOR; -- END FOR; --END Post_M1_simulation; All items above within <> should be filed in with names from the testbench/design and desired values for the PERIOD. An example testbench and VHDL design file is included in resolutions 2 and 3. Solution 2: -------------------------------------- -- ROC_EXAMPLE.VHD Version 1.1 -- -- Example code using the ROC model -- -- to reset 4-bit counter -- -------------------------------------- -- pragma translate_off Library UNISIM; use UNISIM.Vcomponents.all; -- pragma translate_on LIBRARY IEEE; USE IEEE.std_logic_1164.all; USE IEEE.std_logic_unsigned.all; entity roc_example is
port (LOAD, CLOCK: in STD_LOGIC;
CE: in STD_LOGIC;
DATA: in STD_LOGIC_VECTOR (3 downto 0);
COUT: out STD_LOGIC_VECTOR (3 downto 0));
end roc_example;
architecture XILINX of roc_example is signal QOUT: STD_LOGIC_VECTOR (3 downto 0); signal GLOBAL_RESET: STD_ULOGIC; COMPONENT roc port (O: out STD_LOGIC); END COMPONENT; begin -- ------------------------------------------------- -- Reset On Configuration (ROC) Buffer Instantiation -- ------------------------------------------------- RESET_ON_CONFIG: roc port map (O=>GLOBAL_RESET); -- ----------------------------------------------- -- Behavioral description of a 4-bit Loadable -- Counter with Asnchronous Reset and Clock Enable -- ----------------------------------------------- COUNT4: process (GLOBAL_RESET, CLOCK, LOAD, CE) begin if (GLOBAL_RESET = '1') then QOUT <= "0000"; elsif (CE = '1') then if (CLOCK'event and CLOCK = '1') then if (LOAD = '1') then QOUT <=DATA; else QOUT <= QOUT + 1; end if; end if; end if; end process COUNT4; COUT <= QOUT; end XILINX; Solution 3: ------------------------------------------------ -- TESTBENCH_ROC.VHD -- -- Testbench file for testing ROC_EXAMPLE.VHD -- -- Example code using the ROC buffer -- ------------------------------------------------ LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE std.textio.ALL; ENTITY testbench IS END testbench; ARCHITECTURE tutorial OF testbench IS -- -------------------------------------------- -- Component Declaration of Top-Level of Design -- -------------------------------------------- COMPONENT roc_example
PORT ( LOAD : in STD_LOGIC;
CLOCK : in STD_LOGIC;
CE : in STD_LOGIC;
DATA : in STD_LOGIC_VECTOR (3 downto 0);
COUT : out STD_LOGIC_VECTOR (3 downto 0));
END COMPONENT;
-- --------------------------------------------------- -- Signals Used to Connect Design's Ports to Testbench -- --------------------------------------------------- SIGNAL load_signal: STD_LOGIC; SIGNAL clock_signal: STD_LOGIC; SIGNAL ce_signal: STD_LOGIC; SIGNAL data_signal: STD_LOGIC_VECTOR (3 downto 0); SIGNAL cout_signal: STD_LOGIC_VECTOR (3 downto 0); BEGIN -- ----------------------------------------------- -- -- Instantiatation of the Design -- -- ----------------------------------------------- -- uut : roc_example PORT MAP (LOAD => load_signal, CLOCK => clock_signal, CE => ce_signal, DATA => data_signal, COUT => cout_signal); -- ----------------------------------------------- -- -- Start the Simulation -- -- ----------------------------------------------- -- stimulus : PROCESS BEGIN -- -------------------------- -- Initialize All Input Ports -- -------------------------- load_signal <= '0'; clock_signal <= '0'; ce_signal <= '0'; data_signal <= "0000"; -- ------------------------------- -- Wait till Global Reset Finished -- ------------------------------- WAIT FOR 200 ns; -- --------------------- -- Apply Design Stimulus -- --------------------- ce_signal <= '1'; LOOP WAIT FOR 25 ns; clock_signal <= not (clock_signal); END LOOP; -- ---------- -- Game-over! -- ---------- END PROCESS stimulus; END tutorial; -- ---------------------- -- Use this configuration -- for RTL simulation -- ---------------------- CONFIGURATION RTL_simulation OF testbench IS FOR tutorial FOR uut:roc_example FOR xilinx FOR RESET_ON_CONFIG:ROC USE ENTITY UNISIM.ROC(ROC_V) generic map (WIDTH => 200 ns); END FOR; END FOR; END FOR; END FOR; END RTL_simulation; -- ---------------------- -- Use this configuration -- for Post M1 simulation -- ---------------------- --CONFIGURATION Post_M1_simulation OF testbench IS -- FOR tutorial -- FOR uut:roc_example -- FOR STRUCTURE -- FOR ROC_NGD2VHDL:ROC USE ENTITY WORK.ROC(ROC_V) -- generic map (WIDTH => 200 ns); -- END FOR; -- END FOR; -- END FOR;-- END FOR; --END Post_M1_simulation; End of Record #4686 - Last Modified: 12/14/98 12:21 |
| For the latest news, design tips, and patch information on the Xilinx design environment, check out the Technical Tips! |