Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Hi-Z in std_logic_vector

Status
Not open for further replies.

TommiRouvali

Junior Member level 1
Joined
Mar 9, 2012
Messages
18
Helped
9
Reputation
18
Reaction score
9
Trophy points
1,283
Activity points
1,422
Hi,

I am trying to make IO extension board for microcontroller. Any port of XC95108 can be input or output. I had some issues getting design to fit inside XC95108 and so finally ended up design below. Pins work outputs as planned, but they don't seem to go Hi Z mode. Is it valid to scolling 'Z' in std_logic_vector like I do?



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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
 
entity main is
    Port ( DIN : in  STD_LOGIC;
              CLK : in  STD_LOGIC;
              WRD : in  STD_LOGIC;
              RDD : in  STD_LOGIC;
              TRIS : in  STD_LOGIC;
              DOUT : out  STD_LOGIC;
              PORTS : inout std_logic_vector(57 downto 0));
end main;
 
architecture Behavioral of main is
 
signal InData : std_logic_vector(51 downto 0);
 
begin
 
process (CLK)
begin
    if (CLK='1' and CLK'EVENT) then
        if (RDD='1') then           
            InData(51 downto 0)<=PORTS(51 downto 0);
        else    
            if(TRIS='1') then
                InData(51 downto 0)<=InData(50 downto 0) & 'Z';
            else
                InData(51 downto 0)<=InData(50 downto 0) & DIN; 
            end if;
            DOUT<=InData(51);           
        end if;
    end if;     
end process;
 
process (WRD)
begin
    if (WRD='1' and WRD'EVENT) then
            PORTS(51 downto 0)<=InData(51 downto 0);
        end if;
end process;
 
end Behavioral;

 
Last edited by a moderator:

You are assigning 'Z' to the internal signal InData. That may work in simulation, but it will probably not work in a real circuit.
Redesign your circuit so you only assign 'Z' directly to the inout port.

I haven't tried to understand exactly what you are doing, but if you want to shift the 'Z' value, you should use another std_logic_vector with only '0' and '1' as output enable signals and do the shifting there.
 
'Z' state must be directly assigned to an INOUT port, it can't be stored in a registered signal.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top