mountain
Member level 2
logic contention
I am a green hand to VHDL. Now I design a ASIC to realize the full funcions of MITSUBISHI M66500 SP/FP PROGRAMMABLE BUFFERED I/O EXPANDER.
But I encounter some differences, especially the "InOut" Port. I minimize my code to represent the main function below.
Can you give some advices about the code?
MAX+Plus II 10.23 Full. The Compiling is OK, but the simulation show such error message: Warning:Found logic contention at 40ns on node 'D0'
Warning:Found logic contention at 40ns on node 'D1'
...
Warning:Found logic contention at 40ns on node 'A7'
Beg your help!
--*************************************
Library IEEE;
Use IEEE.Std_Logic_1164.All;
Use IEEE.Std_Logic_Arith.All;
Use IEEE.Std_Logic_Unsigned.All;
--*************************************
Entity M66500 Is
Port(
Address: In Std_Logic_Vector(2 Downto 0);
D: InOut Std_Logic_Vector(7 Downto 0);
RST: In Std_Logic;
CS: In Std_Logic;
WR: In Std_Logic;
RD: In Std_Logic;
A: InOut Std_Logic_Vector(7 Downto 0)
);
End M66500;
--*************************************
Architecture a Of M66500 Is
Signal Status: Std_Logic_Vector(7 Downto 0) := "11111111";
Signal BitCon: Std_Logic_Vector(7 Downto 0) := "00000000";
Signal BuffA: Std_Logic_Vector(7 Downto 0);
Begin
Process(Address, CS, RD, WR, RST)
Variable Sel: Std_Logic_Vector(3 Downto 0);
Begin
Sel := CS & Address;
If RST = '1' And CS = '0' Then
Status <= "11111111";
ElsIf WR'Event And WR = '1' Then --Write D to Ports
Case Sel Is
When "0000" => --Write D to A if permit, or to BuffA if not
BuffA <= D;
If Status(3) = '0' Then
A <= BuffA;
Elsif Status(3) = '1' Then
A <= "ZZZZZZZZ";
End If;
When "0111" => --Write order to Control Register
If D(7) = '0' Then
BitCon <= D;
ElsIf D(7) = '1' Then
Status <= D;
End If;
When Others =>
Null;
End Case;
End If;
If RD = '0' Then --Read A to Port D
Case Sel Is
When "0000" => --Read From A to D If permit, or from BuffA if not
If Status(3) = '1' Then
D <= A;
Elsif Status(3) = '0' Then
D <= BuffA;
End If;
When Others =>
Null;
End Case;
End If;
End Process;
End a;
I am a green hand to VHDL. Now I design a ASIC to realize the full funcions of MITSUBISHI M66500 SP/FP PROGRAMMABLE BUFFERED I/O EXPANDER.
But I encounter some differences, especially the "InOut" Port. I minimize my code to represent the main function below.
Can you give some advices about the code?
MAX+Plus II 10.23 Full. The Compiling is OK, but the simulation show such error message: Warning:Found logic contention at 40ns on node 'D0'
Warning:Found logic contention at 40ns on node 'D1'
...
Warning:Found logic contention at 40ns on node 'A7'
Beg your help!
--*************************************
Library IEEE;
Use IEEE.Std_Logic_1164.All;
Use IEEE.Std_Logic_Arith.All;
Use IEEE.Std_Logic_Unsigned.All;
--*************************************
Entity M66500 Is
Port(
Address: In Std_Logic_Vector(2 Downto 0);
D: InOut Std_Logic_Vector(7 Downto 0);
RST: In Std_Logic;
CS: In Std_Logic;
WR: In Std_Logic;
RD: In Std_Logic;
A: InOut Std_Logic_Vector(7 Downto 0)
);
End M66500;
--*************************************
Architecture a Of M66500 Is
Signal Status: Std_Logic_Vector(7 Downto 0) := "11111111";
Signal BitCon: Std_Logic_Vector(7 Downto 0) := "00000000";
Signal BuffA: Std_Logic_Vector(7 Downto 0);
Begin
Process(Address, CS, RD, WR, RST)
Variable Sel: Std_Logic_Vector(3 Downto 0);
Begin
Sel := CS & Address;
If RST = '1' And CS = '0' Then
Status <= "11111111";
ElsIf WR'Event And WR = '1' Then --Write D to Ports
Case Sel Is
When "0000" => --Write D to A if permit, or to BuffA if not
BuffA <= D;
If Status(3) = '0' Then
A <= BuffA;
Elsif Status(3) = '1' Then
A <= "ZZZZZZZZ";
End If;
When "0111" => --Write order to Control Register
If D(7) = '0' Then
BitCon <= D;
ElsIf D(7) = '1' Then
Status <= D;
End If;
When Others =>
Null;
End Case;
End If;
If RD = '0' Then --Read A to Port D
Case Sel Is
When "0000" => --Read From A to D If permit, or from BuffA if not
If Status(3) = '1' Then
D <= A;
Elsif Status(3) = '0' Then
D <= BuffA;
End If;
When Others =>
Null;
End Case;
End If;
End Process;
End a;