OpenCores
URL https://opencores.org/ocsvn/ecpu_alu/ecpu_alu/trunk

Subversion Repositories ecpu_alu

[/] [ecpu_alu/] [trunk/] [alu/] [rtl/] [vhdl/] [alu_barrel_shifter_tb.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 leonous
--------------------------------------------------------------------------------
2
--------------------------------------------------------------------------------
3
-- Module   - Introduction to VLSI Design
4
-- Lecturer - Dr V. M. Dwyer
5
-- Course   - MEng Electronic and Electrical Engineering
6
-- Year     - Part D
7
-- Student  - Sahrfili Leonous Matturi A028459 [elslm]
8
--------------------------------------------------------------------------------
9
--------------------------------------------------------------------------------
10
-- Final coursework 2004
11
-- 
12
-- Details:     Design and Layout of an ALU
13
--------------------------------------------------------------------------------
14
--------------------------------------------------------------------------------
15
 
16
--      Description     :       test ALU barrel shifter
17
--  Entity                      :       alu_barrel_shifter_tb
18
--      Architecture    :       structural
19
--  Created on          :       07/03/2004
20
 
21
library ieee;
22
 
23
use ieee.std_logic_1164.all;
24
use     ieee.std_logic_unsigned.all;
25
 
26
entity alu_barrel_shifter_tb is
27
end alu_barrel_shifter_tb;
28
 
29
 
30
architecture structural of alu_barrel_shifter_tb is
31
component       alu_barrel_shifter
32
        port    (
33
                        x                       : in    std_logic_vector(7 downto 0)     ;
34
                        y                       : in    std_logic_vector(7 downto 0)     ;
35
                        z                       : out   std_logic_vector(7 downto 0)     ;
36
                        direction       : in    std_logic
37
                        );
38
end component;
39
 
40
signal  x,
41
                y,
42
                z       : std_logic_vector(7 downto 0) := (others => '0');
43
signal  direction               : std_logic;
44
signal  finished, clk   : std_logic;
45
begin
46
 
47
        ----------------------------------------------------
48
    -- adder
49
    ----------------------------------------------------
50
        clk_stim        :       process
51
                                        begin
52
 
53
                                                clk     <= '1', '0' after 10 ns;
54
                                                if ( finished = '1') then
55
                                                        wait;
56
                                                else
57
                                                        wait for 20 ns;
58
                                                end if;
59
                                        end process clk_stim;
60
 
61
        shifter         :       alu_barrel_shifter
62
                port map        (
63
                                        x,
64
                                        y,
65
                                        z,
66
                                        direction
67
                                        );
68
 
69
 
70
        stimulus        :       process (clk)
71
                                        begin
72
                                                finished <= '0';
73
                                                direction<= '1';
74
                                                if (clk'event and clk = '1') then
75
                                                        x <= x + 2;
76
                                                end if;
77
 
78
                                                if (conv_integer(x) mod 3 = 0) then
79
                                                        y <= y + 1;
80
                                                end if;
81
                                                if (x > 10) then
82
                                                        finished <= '1';
83
                                                end if;
84
                                        end process stimulus;
85
end structural;
86
 
87
 
88
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.