I think there is a big misunderstanding as to what "behavioural style" and "structural style" really mean.
"Structural style" should really mean instantiating base level primitives and wiring them together. This is just a netlist, and may prevent synthesisor optimizations.
"Behavioral style" (otherwise known as RTL) is writing code that will infer low level primitives from more abstracted code. This is basically what HDLs were designed to do.
People can get confused when they write some lower level functions in behavioral style then instantiate a ton of them and wire them together.
In reality, only masochists and "oldschool" engineers really use true "structural style" code. Behavioural style (RTL) is what everyone usually uses.
The Schematics editors are essentially structural style code shown graphically. Schematics have mostly fallen out of favor for engineers for many reasons (not portable, dont play well with versions control, cant simulate etc etc).
If you are a beginner, "structural style" can help you map your understanding directly from gates to code. Other than that, it gets really bloated, hard to understand and engineers really dont like it.
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 architecture struct of my_entity is fd : fdre port map(r, clk, d, q, qn) ... architecture rtl of my_entity is process(clk) is constant not_active : std_logic := '0'; begin if r then q <= not_active; qn <= not not_active; elsif rising_edge(clk) then q <= d; qn <= not d; end if; end process; ... architecture beh of my_entity is process begin q <= not_active; qn <= not not_active; wait until r = '0'; loop wait until rising_edge(clk); q <= d; exit when r = '1'; end loop;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 [CODE]library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity myboard is Port ( ISA_ABUS_IN : in STD_LOGIC_VECTOR (19 downto 0); ISA_DBUS_INOUT : inout STD_LOGIC_VECTOR (7 downto 0); ISA_IOR : in STD_LOGIC; ISA_IOW : in STD_LOGIC; ISA_CLK: in STD_LOGIC; -- ISA_OSC is clock signal coming from ISA BUS PC104 side FPGA_DBUS_OUT1: out STD_LOGIC_VECTOR (7 downto 0); FPGA_DBUS_OUT2: out STD_LOGIC_VECTOR (7 downto 0); FPGA_DBUS_OUT3: out STD_LOGIC_VECTOR (7 downto 0); FPGA_DBUS_OUT4: out STD_LOGIC_VECTOR (7 downto 0); FPGA_OSC : in STD_LOGIC ); -- FPGA_OSC is 50MHz oscilltor on myboard (not used in the code below) end myboard; architecture Behavioral of myboard is begin process (ISA_CLK, ISA_IOR,ISA_IOW) begin if (ISA_IOR = '0' or ISA_IOW = '0') then if (ISA_CLK'event and ISA_CLK = '1') then if (ISA_ABUS_IN = "00000000010100000000") then -- if address is 0x500 FPGA_DBUS_OUT1 <= ISA_DBUS_INOUT; elsif (ISA_ABUS_IN = "00000000010100000001") then -- if address is 0x501 FPGA_DBUS_OUT2 <= ISA_DBUS_INOUT; elsif (ISA_ABUS_IN = "00000000010100000010" then -- if address is 0x502 ISA_DBUS_INOUT <= FPGA_DBUS_OUT3; elsif (ISA_ABUS_IN = "00000000010100000011" then -- if address is 0x503 ISA_DBUS_INOUT <= FPGA_DBUS_OUT4; end if; end if; end process; end Behavioral;[/CODE]
Functional equivalent code can be expected to result in the same gate level implementation.would the two styles work in same way?
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 [CODE] library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity P0344ISAvhd is Port ( ISA_ABUS_IN : in STD_LOGIC_VECTOR (19 downto 0); ISA_DBUS_INOUT : inout STD_LOGIC_VECTOR (7 downto 0); ISA_IOR : in STD_LOGIC; ISA_IOW : in STD_LOGIC; ISA_IO16 : out STD_LOGIC; ISA_DATA_EN : out STD_LOGIC; -- Enable line for Level Shifter IC on Data Bus ISA_DATA_DIR: out STD_LOGIC; -- Direction line for Level Shifter IC on Data Bus ISA_CLK: in STD_LOGIC; -- ISA_OSC is clock signal coming from ISA BUS PC104 side FPGA_DBUS_INOUT1: inout STD_LOGIC_VECTOR (7 downto 0); FPGA_DBUS_INOUT2: inout STD_LOGIC_VECTOR (7 downto 0); FPGA_DBUS_IN1: in STD_LOGIC_VECTOR (7 downto 0)); -- FPGA_DBUS_IN2: in STD_LOGIC_VECTOR (7 downto 0)); -- FPGA_OSC : in STD_LOGIC ); -- FPGA_OSC is 50MHz oscilltor on myboard (not used in the code below) end P0344ISAvhd; architecture Behavioral of P0344ISAvhd is signal ISA_DBUS : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); signal FPGA_DBUS1 : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); signal FPGA_DBUS2 : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); begin process (ISA_CLK, ISA_IOR,ISA_IOW) begin if (ISA_CLK'event and ISA_CLK = '1') then if (ISA_IOW = '0' and ISA_IOR = '1') then -- Write is enabled ISA_IO16 <= '0'; -- It is NOT an 16 bit device ISA_DATA_DIR <= '0'; -- Set Direction of Data Bus Level TxRx as ISA to FPGA ISA_DATA_EN <= '0'; -- Enable the Data Bus Level TxRx if (ISA_ABUS_IN = "00000000010100000000") then -- if address is 0x500 FPGA_DBUS1 <= ISA_DBUS; ISA_DBUS_INOUT <= ISA_DBUS; FPGA_DBUS_INOUT1 <= FPGA_DBUS1; elsif (ISA_ABUS_IN = "00000000010100000001") then -- if address is 0x501 FPGA_DBUS2 <= ISA_DBUS; ISA_DBUS_INOUT <= ISA_DBUS; FPGA_DBUS_INOUT2 <= FPGA_DBUS2; end if; --ISA_DBUS_INOUT <= ISA_DBUS; --FPGA_DBUS_INOUT1 <= FPGA_DBUS1; --FPGA_DBUS_INOUT2 <= FPGA_DBUS2; ISA_DATA_EN <= '1'; -- Disable the Data Bus Level TxRx end if; if (ISA_IOW = '1' and ISA_IOR = '0') then -- Read is enabled ISA_IO16 <= '0'; -- It is NOT an 16 bit device ISA_DATA_DIR <= '1'; -- Set Direction of Data Bus Level TxRx as FPGA to ISA ISA_DATA_EN <= '0'; -- Enable the Data Bus Level TxRx if (ISA_ABUS_IN = "00000000010100000000") then -- if address is 0x500 ISA_DBUS <= FPGA_DBUS1; ISA_DBUS_INOUT <= ISA_DBUS; FPGA_DBUS_INOUT1 <= FPGA_DBUS1; elsif (ISA_ABUS_IN = "00000000010100000001") then -- if address is 0x501 ISA_DBUS <= FPGA_DBUS2; ISA_DBUS_INOUT <= ISA_DBUS; FPGA_DBUS_INOUT2 <= FPGA_DBUS2; elsif (ISA_ABUS_IN = "00000000010100000010") then -- if address is 0x502 ISA_DBUS <= FPGA_DBUS_IN1; ISA_DBUS_INOUT <= ISA_DBUS; -- elsif (ISA_ABUS_IN = "00000000010100000011") then -- if address is 0x503 -- ISA_DBUS <= FPGA_DBUS_IN2; -- ISA_DBUS_INOUT <= ISA_DBUS; end if; --ISA_DBUS_INOUT <= ISA_DBUS; --FPGA_DBUS_INOUT1 <= FPGA_DBUS1; --FPGA_DBUS_INOUT2 <= FPGA_DBUS2; ISA_DATA_EN <= '1'; -- Disable the Data Bus Level TxRx end if; end if; end process; end Behavioral; [/CODE]
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 -------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 13:56:50 10/31/2018 -- Design Name: -- Module Name: /home/ise/Shared_Folder/Fpga_Vhd/P0344ISAvhd/P0344ISA_TB.vhd -- Project Name: P0344ISAvhd -- Target Device: -- Tool versions: -- Description: -- -- VHDL Test Bench Created by ISE for module: P0344ISAvhd -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- -- Notes: -- This testbench has been automatically generated using types std_logic and -- std_logic_vector for the ports of the unit under test. Xilinx recommends -- that these types always be used for the top-level I/O of a design in order -- to guarantee that the testbench will bind correctly to the post-implementation -- simulation model. -------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --USE ieee.numeric_std.ALL; ENTITY P0344ISA_TB IS END P0344ISA_TB; ARCHITECTURE behavior OF P0344ISA_TB IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT P0344ISAvhd PORT( ISA_ABUS_IN : IN std_logic_vector(19 downto 0); ISA_DBUS_INOUT : INOUT std_logic_vector(7 downto 0); ISA_IOR : IN std_logic; ISA_IOW : IN std_logic; ISA_IO16 : OUT std_logic; ISA_DATA_EN : OUT std_logic; ISA_DATA_DIR : OUT std_logic; ISA_CLK : IN std_logic; FPGA_DBUS_INOUT1 : INOUT std_logic_vector(7 downto 0); FPGA_DBUS_INOUT2 : INOUT std_logic_vector(7 downto 0); FPGA_DBUS_IN1 : IN std_logic_vector(7 downto 0) ); END COMPONENT; --Inputs signal ISA_ABUS_IN : std_logic_vector(19 downto 0) := (others => '0'); signal ISA_IOR : std_logic := '0'; signal ISA_IOW : std_logic := '0'; signal ISA_CLK : std_logic := '0'; signal FPGA_DBUS_IN1 : std_logic_vector(7 downto 0) := (others => '0'); --BiDirs signal ISA_DBUS_INOUT : std_logic_vector(7 downto 0); signal FPGA_DBUS_INOUT1 : std_logic_vector(7 downto 0); signal FPGA_DBUS_INOUT2 : std_logic_vector(7 downto 0); --Outputs signal ISA_IO16 : std_logic; signal ISA_DATA_EN : std_logic; signal ISA_DATA_DIR : std_logic; -- Clock period definitions constant ISA_CLK_period : time := 125 ns; -- For 8MHz ISA Clock BEGIN -- Instantiate the Unit Under Test (UUT) uut: P0344ISAvhd PORT MAP ( ISA_ABUS_IN => ISA_ABUS_IN, ISA_DBUS_INOUT => ISA_DBUS_INOUT, ISA_IOR => ISA_IOR, ISA_IOW => ISA_IOW, ISA_IO16 => ISA_IO16, ISA_DATA_EN => ISA_DATA_EN, ISA_DATA_DIR => ISA_DATA_DIR, ISA_CLK => ISA_CLK, FPGA_DBUS_INOUT1 => FPGA_DBUS_INOUT1, FPGA_DBUS_INOUT2 => FPGA_DBUS_INOUT2, FPGA_DBUS_IN1 => FPGA_DBUS_IN1 ); -- Clock process definitions ISA_CLK_process :process begin ISA_CLK <= '0'; wait for ISA_CLK_period/2; ISA_CLK <= '1'; wait for ISA_CLK_period/2; end process; -- Stimulus process stim_proc: process begin -- hold reset state for 100 ns. wait for 100 ns; wait for ISA_CLK_period*10; -- insert stimulus here ISA_IOW <= '0'; ISA_IOR <= '1'; ISA_ABUS_IN <= "00000000010100000000"; ISA_DBUS_INOUT <= "01100101"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; ISA_DBUS_INOUT <= "01011001"; wait; end process; END;
process (ISA_CLK, ISA_IOR,ISA_IOW)
begin
if (ISA_CLK'event and ISA_CLK = '1') then
if (ISA_IOW = '0' and ISA_IOR = '1') then -- Write is enabled
However, the data on
FPGA_DBUS_INOUT1
&
FPGA_DBUS_INOUT2
always stays at 00000000
signal FPGA_DBUS_IN1 : std_logic_vector(7 downto 0) := (others => '0');
FPGA_DBUS_IN1 => FPGA_DBUS_IN1
if (ISA_ABUS_IN = "00000000010100000000") then -- if address is 0x500
FPGA_DBUS_INOUT1 <= FPGA_DBUS1;
Don't use both code and syntax tags together (I fixed it and left only the syntax tags).
As VHDL is a hardware description language, maybe it would help if you drew a schematic of what you are trying to design and then describe that design in VHDL. Right now I get the impression that you are "hacking" the code together without seeing the hardware logic you require.
Code VHDL - [expand] 1 fpga_dbus_inouta <= dbus1 when en = '1' else (others => 'Z');
That schematic from the original (?) design
is helpful as it shows some of the stuff you are missing in your HDL, namely:
View attachment 149785
No where do you have that tri-state driver in your code.
You need something like this:
Code VHDL - [expand] 1 fpga_dbus_inouta <= dbus1 when en = '1' else (others => 'Z');
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 port ( INOUT_PORT : inout std_logic ); signal temp1 : std_logic; signal temp2 : std_logic; signal en : std_logic; -- used as an input temp1 <= INOUT_PORT; -- driven as an output INOUT_PORT <= temp2 when en = '1' else 'Z';
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity P0344ISAvhd is Port ( ISA_ABUS_IN : in STD_LOGIC_VECTOR (19 downto 0); ISA_DBUS_INOUT : inout STD_LOGIC_VECTOR (7 downto 0); ISA_IOR : in STD_LOGIC; ISA_IOW : in STD_LOGIC; ISA_IO16 : out STD_LOGIC; ISA_DATA_EN : out STD_LOGIC; -- Enable line for Level Shifter IC on Data Bus ISA_DATA_DIR: out STD_LOGIC; -- Direction line for Level Shifter IC on Data Bus ISA_CLK: in STD_LOGIC; -- ISA_OSC is clock signal coming from ISA BUS PC104 side FPGA_DBUS_OUT1: out STD_LOGIC_VECTOR (7 downto 0); FPGA_DBUS_OUT2: out STD_LOGIC_VECTOR (7 downto 0); FPGA_DBUS_IN1: in STD_LOGIC_VECTOR (7 downto 0)); -- FPGA_DBUS_IN2: in STD_LOGIC_VECTOR (7 downto 0)); -- FPGA_OSC : in STD_LOGIC ); -- FPGA_OSC is 50MHz oscilltor on myboard (not used in the code below) end P0344ISAvhd; architecture Behavioral of P0344ISAvhd is signal ISA_DBUS1 : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); signal ISA_DBUS2 : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); signal FPGA_DBUS11 : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); --signal FPGA_DBUS12 : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); signal FPGA_DBUS21 : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); --signal FPGA_DBUS22 : STD_LOGIC_VECTOR (7 downto 0) := (others => '0'); signal en1 : STD_LOGIC; begin ISA_DBUS1 <= ISA_DBUS_INOUT; -- Used as an input ISA_DBUS_INOUT <= ISA_DBUS2 when en1 = '1' else "ZZZZZZZZ"; -- Used as an output FPGA_DBUS_OUT1 <= FPGA_DBUS11; -- Signal assigned to output FPGA_DBUS_OUT2 <= FPGA_DBUS21; -- Signal assigned to output process (ISA_CLK) begin if (rising_edge (ISA_CLK)) then if (ISA_IOW = '0' and ISA_IOR = '1') then -- Write is enabled en1 <= '0'; ISA_IO16 <= '0'; -- It is NOT an 16 bit device ISA_DATA_DIR <= '0'; -- Set Direction of Data Bus Level TxRx as ISA to FPGA ISA_DATA_EN <= '0'; -- Enable the Data Bus Level TxRx if (ISA_ABUS_IN = X"0500") then -- if address is 0x500 FPGA_DBUS11 <= ISA_DBUS1; elsif (ISA_ABUS_IN = X"0501") then -- if address is 0x501 FPGA_DBUS21 <= ISA_DBUS1; end if; end if; if (ISA_IOW = '1' and ISA_IOR = '0') then -- Read is enabled en1 <= '1'; ISA_IO16 <= '0'; -- It is NOT an 16 bit device ISA_DATA_DIR <= '1'; -- Set Direction of Data Bus Level TxRx as FPGA to ISA ISA_DATA_EN <= '0'; -- Enable the Data Bus Level TxRx if (ISA_ABUS_IN = X"0500") then -- if address is 0x500 ISA_DBUS2 <= FPGA_DBUS11; elsif (ISA_ABUS_IN = X"0501") then -- if address is 0x501 ISA_DBUS2 <= FPGA_DBUS21; elsif (ISA_ABUS_IN = X"0502") then -- if address is 0x502 ISA_DBUS2 <= FPGA_DBUS_IN1; end if; end if; if (ISA_IOW = '1' and ISA_IOR = '1') then -- Read is enabled ISA_DATA_EN <= '1'; end if; end if; end process; end Behavioral;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 -------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 15:31:08 11/01/2018 -- Design Name: -- Module Name: /home/ise/Shared_Folder/Fpga_Vhd/P0344ISAvhd/P0344ISA_TB5.vhd -- Project Name: P0344ISAvhd -- Target Device: -- Tool versions: -- Description: -- -- VHDL Test Bench Created by ISE for module: P0344ISAvhd -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- -- Notes: -- This testbench has been automatically generated using types std_logic and -- std_logic_vector for the ports of the unit under test. Xilinx recommends -- that these types always be used for the top-level I/O of a design in order -- to guarantee that the testbench will bind correctly to the post-implementation -- simulation model. -------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --USE ieee.numeric_std.ALL; ENTITY P0344ISA_TB5 IS END P0344ISA_TB5; ARCHITECTURE behavior OF P0344ISA_TB5 IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT P0344ISAvhd PORT( ISA_ABUS_IN : IN std_logic_vector(19 downto 0); ISA_DBUS_INOUT : INOUT std_logic_vector(7 downto 0); ISA_IOR : IN std_logic; ISA_IOW : IN std_logic; ISA_IO16 : OUT std_logic; ISA_DATA_EN : OUT std_logic; ISA_DATA_DIR : OUT std_logic; ISA_CLK : IN std_logic; FPGA_DBUS_OUT1 : OUT std_logic_vector(7 downto 0); FPGA_DBUS_OUT2 : OUT std_logic_vector(7 downto 0); FPGA_DBUS_IN1 : IN std_logic_vector(7 downto 0) ); END COMPONENT; --Inputs signal ISA_ABUS_IN : std_logic_vector(19 downto 0) := (others => '0'); signal ISA_IOR : std_logic := '0'; signal ISA_IOW : std_logic := '0'; signal ISA_CLK : std_logic := '0'; signal FPGA_DBUS_IN1 : std_logic_vector(7 downto 0) := (others => '0'); --BiDirs signal ISA_DBUS_INOUT : std_logic_vector(7 downto 0); --Outputs signal ISA_IO16 : std_logic; signal ISA_DATA_EN : std_logic; signal ISA_DATA_DIR : std_logic; signal FPGA_DBUS_OUT1 : std_logic_vector(7 downto 0); signal FPGA_DBUS_OUT2 : std_logic_vector(7 downto 0); -- Clock period definitions constant ISA_CLK_period : time := 125 ns; --8MHz clock for ISA Bus BEGIN -- Instantiate the Unit Under Test (UUT) uut: P0344ISAvhd PORT MAP ( ISA_ABUS_IN => ISA_ABUS_IN, ISA_DBUS_INOUT => ISA_DBUS_INOUT, ISA_IOR => ISA_IOR, ISA_IOW => ISA_IOW, ISA_IO16 => ISA_IO16, ISA_DATA_EN => ISA_DATA_EN, ISA_DATA_DIR => ISA_DATA_DIR, ISA_CLK => ISA_CLK, FPGA_DBUS_OUT1 => FPGA_DBUS_OUT1, FPGA_DBUS_OUT2 => FPGA_DBUS_OUT2, FPGA_DBUS_IN1 => FPGA_DBUS_IN1 ); -- Clock process definitions ISA_CLK_process :process begin ISA_CLK <= '0'; wait for ISA_CLK_period/2; ISA_CLK <= '1'; wait for ISA_CLK_period/2; end process; -- Stimulus process stim_proc: process begin -- hold reset state for 100 ns. wait for 100 ns; wait for ISA_CLK_period*10; ISA_IOW <= '0'; ISA_IOR <= '1'; ISA_ABUS_IN <= "00000000010100000000"; ISA_DBUS_INOUT <= "01100101"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; ISA_DBUS_INOUT <= "01011001"; wait for ISA_CLK_period*2; ISA_IOW <= '1'; ISA_IOR <= '0'; ISA_ABUS_IN <= "00000000010100000000"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; -- insert stimulus here wait; end process; END;
Code VHDL - [expand] 1 2 ISA_IOR <= '0'; ISA_DBUS_INOUT <= "ZZZZ;
What do you mean by status of the output ports? You can easily read back the content of the output registers.However, we would need to read the status of these Output ports.
Older vs newer versions of the VHDL standard...However, we would need to read the status of these Output ports which believe is done by using Signals rather than declaring these as INOUT ports
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 stim_proc: process begin -- hold reset state for 100 ns. wait for 100 ns; wait for ISA_CLK_period*10; FPGA_DBUS_IN1 <= "01010101"; ISA_IOW <= '0'; ISA_IOR <= '1'; ISA_ABUS_IN <= "00000000010100000000"; ISA_DBUS_INOUT <= "01100101"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; ISA_DBUS_INOUT <= "01011001"; wait for ISA_CLK_period*2; ISA_IOW <= '1'; ISA_IOR <= '0'; ISA_DBUS_INOUT<="ZZZZZZZZ"; ISA_ABUS_IN <= "00000000010100000000"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000010"; -- insert stimulus here wait; end process;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 stim_proc: process begin -- hold reset state for 100 ns. wait for 100 ns; wait for ISA_CLK_period*10; FPGA_DBUS_IN1 <= "01010101"; ISA_IOW <= '0'; ISA_IOR <= '1'; ISA_ABUS_IN <= "00000000010100000000"; ISA_DBUS_INOUT <= "01100101"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; ISA_DBUS_INOUT <= "01011001"; wait for ISA_CLK_period*2; ISA_IOW <= '1'; ISA_IOR <= '0'; ISA_DBUS_INOUT<="ZZZZZZZZ"; ISA_ABUS_IN <= "00000000010100000000"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000010"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; ISA_DBUS_INOUT <= "11111001" -- insert stimulus here wait; end process;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 -------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --USE ieee.numeric_std.ALL; ENTITY P0344ISA_TB5 IS END P0344ISA_TB5; ARCHITECTURE behavior OF P0344ISA_TB5 IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT P0344ISAvhd PORT( ISA_ABUS_IN : IN std_logic_vector(19 downto 0); ISA_DBUS_INOUT : INOUT std_logic_vector(7 downto 0); ISA_IOR : IN std_logic; ISA_IOW : IN std_logic; ISA_IO16 : OUT std_logic; ISA_DATA_EN : OUT std_logic; ISA_DATA_DIR : OUT std_logic; ISA_CLK : IN std_logic; FPGA_DBUS_OUT1 : OUT std_logic_vector(7 downto 0); FPGA_DBUS_OUT2 : OUT std_logic_vector(7 downto 0); FPGA_DBUS_IN1 : IN std_logic_vector(7 downto 0) ); END COMPONENT; --Inputs signal ISA_ABUS_IN : std_logic_vector(19 downto 0) := (others => '0'); signal ISA_IOR : std_logic := '0'; signal ISA_IOW : std_logic := '0'; signal ISA_CLK : std_logic := '0'; signal FPGA_DBUS_IN1 : std_logic_vector(7 downto 0) := (others => '0'); --BiDirs signal ISA_DBUS_INOUT : std_logic_vector(7 downto 0); --Outputs signal ISA_IO16 : std_logic; signal ISA_DATA_EN : std_logic; signal ISA_DATA_DIR : std_logic; signal FPGA_DBUS_OUT1 : std_logic_vector(7 downto 0); signal FPGA_DBUS_OUT2 : std_logic_vector(7 downto 0); -- Clock period definitions constant ISA_CLK_period : time := 125 ns; --8MHz clock for ISA Bus signal TEMP_DBUS_INOUT : std_logic_vector(7 downto 0); BEGIN -- Instantiate the Unit Under Test (UUT) uut: P0344ISAvhd PORT MAP ( ISA_ABUS_IN => ISA_ABUS_IN, ISA_DBUS_INOUT => ISA_DBUS_INOUT, ISA_IOR => ISA_IOR, ISA_IOW => ISA_IOW, ISA_IO16 => ISA_IO16, ISA_DATA_EN => ISA_DATA_EN, ISA_DATA_DIR => ISA_DATA_DIR, ISA_CLK => ISA_CLK, FPGA_DBUS_OUT1 => FPGA_DBUS_OUT1, FPGA_DBUS_OUT2 => FPGA_DBUS_OUT2, FPGA_DBUS_IN1 => FPGA_DBUS_IN1 ); ISA_DBUS_INOUT <= TEMP_DBUS_INOUT when ISA_IOR = '1' else "ZZZZZZZZ"; -- Used as an output -- Clock process definitions ISA_CLK_process :process begin ISA_CLK <= '0'; wait for ISA_CLK_period/2; ISA_CLK <= '1'; wait for ISA_CLK_period/2; end process; -- Stimulus process stim_proc: process begin -- hold reset state for 100 ns. wait for 100 ns; wait for ISA_CLK_period*10; FPGA_DBUS_IN1 <= "01010101"; ISA_IOW <= '0'; ISA_IOR <= '1'; ISA_ABUS_IN <= "00000000010100000000"; TEMP_DBUS_INOUT <= "01100101"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; TEMP_DBUS_INOUT <= "01011001"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000010"; -- Check the effect of this case during Write cycle wait for ISA_CLK_period*2; ISA_IOW <= '1'; ISA_IOR <= '0'; --ISA_DBUS_INOUT<="ZZZZZZZZ"; ISA_ABUS_IN <= "00000000010100000000"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000001"; wait for ISA_CLK_period*2; ISA_ABUS_IN <= "00000000010100000010"; wait for ISA_CLK_period*2; ISA_IOW <= '0'; ISA_IOR <= '1'; ISA_ABUS_IN <= "00000000010100000000"; TEMP_DBUS_INOUT <= "11111101"; wait for ISA_CLK_period*2; -- insert stimulus here wait; end process; END;
Code VHDL - [expand] 1 ISA_DBUS_INOUT <= TEMP_DBUS_INOUT when ISA_IOR = '1' else "ZZZZZZZZ"; -- Used as an output
The problem has been already addressed, e.g. by ads-ee in post #9. You need to tristate the bus in the test bench when performing a read.
Code VHDL - [expand] 1 2 ISA_IOR <= '0'; ISA_DBUS_INOUT <= "ZZZZ;
What do you mean by status of the output ports? You can easily read back the content of the output registers.
The X's have nothing to do with your testbench, it looks like a problem with your DUT.
Given the code snippets from earlier, you probably have a clock cycle delay before the output from your DUT goes to an active value.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?