From e3c06b11d868561638b98435f55f85e75fa49f50 Mon Sep 17 00:00:00 2001 From: Bert Lange Date: Thu, 10 Nov 2011 14:33:41 +0100 Subject: add: new toplevel with siumlation --- tools/rtl/edge_detect_synchronizer.vhd | 4 +-- tools/rtl/synchronizer_package.vhd | 43 ++++++++++++++----------- tools/rtl_tb/fio_pck_body.vhd | 18 +++++------ tools/rtl_tb/fio_pkg.vhd | 2 +- tools/rtl_tb/image_pkg.vhd | 58 +++++++++++++++++----------------- 5 files changed, 66 insertions(+), 59 deletions(-) (limited to 'tools') diff --git a/tools/rtl/edge_detect_synchronizer.vhd b/tools/rtl/edge_detect_synchronizer.vhd index 5854288..b93dc16 100644 --- a/tools/rtl/edge_detect_synchronizer.vhd +++ b/tools/rtl/edge_detect_synchronizer.vhd @@ -16,7 +16,7 @@ use ieee.std_logic_1164.all; entity edge_detect_synchronizer is generic ( - rising_edge : boolean := true + detect_rising_edge : boolean := true ); port ( clk : std_ulogic; @@ -42,7 +42,7 @@ begin in_stage_d2 <= in_stage_d1; -- third ff end process; - synced <= in_stage_d1 and not in_stage_d2 when rising_edge else + synced <= in_stage_d1 and not in_stage_d2 when detect_rising_edge else not in_stage_d1 and in_stage_d2; end architecture rtl; diff --git a/tools/rtl/synchronizer_package.vhd b/tools/rtl/synchronizer_package.vhd index b8753dc..4a58a3a 100644 --- a/tools/rtl/synchronizer_package.vhd +++ b/tools/rtl/synchronizer_package.vhd @@ -5,25 +5,32 @@ -- $Revision: 659 $ -------------------------------------------------------------------------------- +library ieee; +use ieee. std_logic_1164.all; + + package synchronizer_package is -entity level_synchronizer is - port ( - clk : std_ulogic; - input : in std_logic; - synced : out std_ulogic - ); -end entity level_synchronizer; - - -entity edge_detect_synchronizer is - generic ( - rising_edge : boolean := true - ); - port ( - clk : std_ulogic; - input : in std_logic; - synced : out std_ulogic - ); + component level_synchronizer is + port ( + clk : std_ulogic; + input : in std_logic; + synced : out std_ulogic + ); + end component level_synchronizer; + + + component edge_detect_synchronizer is + generic ( + detect_rising_edge : boolean := true + ); + port ( + clk : std_ulogic; + input : in std_logic; + synced : out std_ulogic + ); + end component edge_detect_synchronizer; + + end package synchronizer_package; diff --git a/tools/rtl_tb/fio_pck_body.vhd b/tools/rtl_tb/fio_pck_body.vhd index cac3e65..5f88513 100644 --- a/tools/rtl_tb/fio_pck_body.vhd +++ b/tools/rtl_tb/fio_pck_body.vhd @@ -708,15 +708,15 @@ return ("S:" & Result); end fo; - function fo (Arg: std_logic_vector) return string is - constant Argument: std_logic_vector(1 to Arg'length) := Arg; - variable Result: string(1 to Arg'length); - begin - for i in Argument'range loop - Result(i) := C_STD_LOGIC_MAP(Argument(i)); - end loop; - return ("V:" & Result); - end fo; +--function fo (Arg: std_logic_vector) return string is +-- constant Argument: std_logic_vector(1 to Arg'length) := Arg; +-- variable Result: string(1 to Arg'length); +--begin +-- for i in Argument'range loop +-- Result(i) := C_STD_LOGIC_MAP(Argument(i)); +-- end loop; +-- return ("V:" & Result); +--end fo; function fo (Arg: std_ulogic_vector) return string is constant Argument: std_ulogic_vector(1 to Arg'length) := Arg; diff --git a/tools/rtl_tb/fio_pkg.vhd b/tools/rtl_tb/fio_pkg.vhd index 9716da7..dc39a06 100644 --- a/tools/rtl_tb/fio_pkg.vhd +++ b/tools/rtl_tb/fio_pkg.vhd @@ -87,7 +87,7 @@ package fio_pkg is function fo (Arg: unsigned) return string; function fo (Arg: signed) return string; - function fo (Arg: std_logic_vector) return string; +--function fo (Arg: std_logic_vector) return string; function fo (Arg: std_ulogic_vector) return string; function fo (Arg: bit_vector) return string; function fo (Arg: integer) return string; diff --git a/tools/rtl_tb/image_pkg.vhd b/tools/rtl_tb/image_pkg.vhd index 59a0af3..fe93358 100644 --- a/tools/rtl_tb/image_pkg.vhd +++ b/tools/rtl_tb/image_pkg.vhd @@ -39,20 +39,20 @@ package image_pkg is function Image(In_Image : Real) return String; function Image(In_Image : Std_uLogic) return String; function Image(In_Image : Std_uLogic_Vector) return String; - function Image(In_Image : Std_Logic_Vector) return String; + --function Image(In_Image : Std_Logic_Vector) return String; function Image(In_Image : Signed) return String; function Image(In_Image : UnSigned) return String; function HexImage(InStrg : String) return String; function HexImage(In_Image : Bit_Vector) return String; function HexImage(In_Image : Std_uLogic_Vector) return String; - function HexImage(In_Image : Std_Logic_Vector) return String; + --function HexImage(In_Image : Std_Logic_Vector) return String; function HexImage(In_Image : Signed) return String; function HexImage(In_Image : UnSigned) return String; function DecImage(In_Image : Bit_Vector) return String; function DecImage(In_Image : Std_uLogic_Vector) return String; - function DecImage(In_Image : Std_Logic_Vector) return String; + --function DecImage(In_Image : Std_Logic_Vector) return String; function DecImage(In_Image : Signed) return String; function DecImage(In_Image : UnSigned) return String; end image_pkg; @@ -134,15 +134,15 @@ package body image_pkg is return W; end Image; - function Image(In_Image : Std_Logic_Vector) return String is - variable L : Line; -- access type - variable W : String(1 to In_Image'length) := (others => ' '); - begin - IEEE.Std_Logic_TextIO.WRITE(L, In_Image); - W(L.all'range) := L.all; - Deallocate(L); - return W; - end Image; +--function Image(In_Image : Std_Logic_Vector) return String is +-- variable L : Line; -- access type +-- variable W : String(1 to In_Image'length) := (others => ' '); +--begin +-- IEEE.Std_Logic_TextIO.WRITE(L, In_Image); +-- W(L.all'range) := L.all; +-- Deallocate(L); +-- return W; +--end Image; function Image(In_Image : Signed) return String is begin @@ -204,10 +204,10 @@ package body image_pkg is return HexImage(Image(In_Image)); end HexImage; - function HexImage(In_Image : Std_Logic_Vector) return String is - begin - return HexImage(Image(In_Image)); - end HexImage; +--function HexImage(In_Image : Std_Logic_Vector) return String is +--begin +-- return HexImage(Image(In_Image)); +--end HexImage; function HexImage(In_Image : Signed) return String is begin @@ -248,19 +248,19 @@ package body image_pkg is end if; end DecImage; - function DecImage(In_Image : Std_Logic_Vector) return String is - variable In_Image_v : Std_Logic_Vector(In_Image'length downto 1) - := In_Image; - begin - if In_Image'length > 31 then - assert False - report "Number too large for Integer, clipping to 31 bits" - severity Warning; - return Image(To_Integer(Unsigned(In_Image_v(31 downto 1)))); - else - return Image(To_Integer(Unsigned(In_Image))); - end if; - end DecImage; +--function DecImage(In_Image : Std_Logic_Vector) return String is +-- variable In_Image_v : Std_Logic_Vector(In_Image'length downto 1) +-- := In_Image; +--begin +-- if In_Image'length > 31 then +-- assert False +-- report "Number too large for Integer, clipping to 31 bits" +-- severity Warning; +-- return Image(To_Integer(Unsigned(In_Image_v(31 downto 1)))); +-- else +-- return Image(To_Integer(Unsigned(In_Image))); +-- end if; +--end DecImage; function DecImage(In_Image : Signed) return String is variable In_Image_v : Signed(In_Image'length downto 1) := In_Image; -- cgit v1.1