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

Subversion Repositories smbus_controller

[/] [smbus_controller/] [trunk/] [hw/] [simulations/] [Testbench_SMBusPec.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ldalmasso
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date: 11/19/2024 03:57:42 PM
6
-- Design Name: 
7
-- Module Name: Testbench_SMBusPec - Behavioral
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool Versions: 
11
-- Description: 
12
-- 
13
-- Dependencies: 
14
-- 
15
-- Revision:
16
-- Revision 0.01 - File Created
17
-- Additional Comments:
18
-- 
19
----------------------------------------------------------------------------------
20
 
21
 
22
library IEEE;
23
use IEEE.STD_LOGIC_1164.ALL;
24
USE IEEE.NUMERIC_STD.ALL;
25
 
26
 
27
entity Testbench_SMBusPec is
28
end Testbench_SMBusPec;
29
 
30
architecture Behavioral of Testbench_SMBusPec is
31
 
32
COMPONENT SMBusPec is
33
 
34
PORT(
35
        i_clock: IN STD_LOGIC;
36
    i_reset: IN STD_LOGIC;
37
        i_enable: IN STD_LOGIC;
38
        i_data: IN STD_LOGIC_VECTOR(7 downto 0);
39
    o_pec: OUT STD_LOGIC_VECTOR(7 downto 0)
40
);
41
 
42
END COMPONENT;
43
 
44
signal clock_12M: STD_LOGIC := '1';
45
signal reset: STD_LOGIC := '0';
46
signal enable: STD_LOGIC := '0';
47
signal data: UNSIGNED(7 downto 0):= (others => '0');
48
signal pec: STD_LOGIC_VECTOR(7 downto 0):= (others => '0');
49
 
50
begin
51
 
52
-- Clock 12 MHz
53
clock_12M <= not(clock_12M) after 41.6667 ns;
54
 
55
-- Reset (CRC-8 Single Byte)
56
process
57
begin
58
    reset <= '1';
59
    wait for 1*83.3334 ns;
60
    reset <= '0';
61
    wait for 3*83.3334 ns;
62
end process;
63
 
64
-- Reset (CRC-8 Multiple Bytes)
65
--reset <= '1', '0' after 3*83.3334 ns;
66
 
67
-- Enable
68
process
69
begin
70
    enable <= '0';
71
    wait for 2*83.3334 ns;
72
    enable <= '1';
73
    wait for 83.3334 ns;
74
    enable <= '0';
75
    wait for 83.3334 ns;
76
end process;
77
 
78
-- Data input
79
process
80
begin
81
    wait for 4*83.3334 ns;
82
    data <= data +1;
83
end process;
84
 
85
uut: SMBusPec
86
    PORT map(
87
        i_clock => clock_12M,
88
        i_reset => reset,
89
        i_enable => enable,
90
        i_data => STD_LOGIC_VECTOR(data),
91
        o_pec => pec);
92
 
93
end Behavioral;

powered by: WebSVN 2.1.0

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