EmbDev.net

Forum: FPGA, VHDL & Verilog VHDL Generic Bus I/O MUX


von Alexander S. (Company: Home) (alex_isr)


Attached files:

Rate this post
useful
not useful
Attached ModelSim VHDL design of Generic Bus I/O MUX.

Regards Alex.

von Griz Lee (Guest)


Rate this post
useful
not useful
You published pretty lot of files today, but a closer look shows, most 
of them are simple and some even faulty and crappy. This is not standard 
code quality.

von Alexander S. (Company: Home) (alex_isr)


Rate this post
useful
not useful
Griz Lee wrote:
> You published pretty lot of files today, but a closer look shows,
>most of them

>are simple

 Yes, these are "stones" for my large projects.

>and some even faulty and crappy. This is not standard code quality.

 You can explain that to all and I'll try to repair it ... I will say 
you thanx.

 Regards alex.

: Edited by User
von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Alexander S. wrote:
> Attached ModelSim VHDL design of Generic Bus I/O MUX.
I don't understand what the whole thing is good for. A tristate buffer 
usually needs not more than two lines.

A few words to that code:
1
InOutProcess:
2
process (ClockIn,nEnableIn)
3
begin
4
 if nEnableIn = '0' then
5
  DataIO      <= DataIn;
6
 else
7
  DataIO     <= (others => 'Z');
8
 end if;
9
 if ClockIn'event and ClockIn = '1'then
10
  case nResetIn is
11
  when '0' => DataOutValid <= '0'; -- Data for trnsport from DataIO to FPGA valid
12
              DataOut <= (others => '0');
13
  when others =>
14
              DataOutValid <= nEnableIn; -- Data for trnsport from DataIO to FPGA valid
15
              DataOut   <= DataIO;
16
  end case;
17
 end if;
18
end process InOutProcess;
Never ever use combinatorial and synchronous descriptions in the same 
process!
Additionally the simulation will be wrong due to the missing "DataIn" in 
the sensitivity list.

: Edited by Moderator
von Alexander S. (Company: Home) (alex_isr)


Attached files:

Rate this post
useful
not useful
Lothar M. wrote:
> Never ever use combinatorial and synchronous descriptions in the same
> process!

 You are right :
1
library ieee;
2
use ieee.std_logic_1164.all;
3
4
entity InOutGen is
5
GENERIC (DataRange  : integer);
6
port
7
 (
8
  ClockIn,                                                                      -- General Clock
9
  nResetIn,                                                                     -- General Reset active low
10
  nEnableIn      : in    std_logic;                                              -- Active 0 for read from FPGA
11
  DataIn         : in    std_logic_vector(DataRange downto 0);                   -- Data for trnsport from FPGA to DataIO
12
  DataOutValid  : out   std_logic;                                               -- Data for trnsport from DataIO to FPGA valid
13
  DataOut        : out   std_logic_vector(DataRange downto 0);                   -- Data for trnsport from DataIO to FPGA
14
  DataIO         : inout std_logic_vector(DataRange downto 0)                    -- External Data Bus
15
 );
16
end InOutGen;
17
18
architecture ArchInOutGen of InOutGen is
19
20
begin
21
22
OutProcess:
23
process (nEnableIn)
24
begin
25
 if nEnableIn = '0' then
26
  DataIO      <= DataIn;
27
 else
28
  DataIO       <= (others => 'Z');
29
 end if;
30
end process OutProcess;
31
32
InProcess:
33
process (ClockIn)
34
begin
35
 if ClockIn'event and ClockIn = '1'then
36
  case nResetIn is
37
   when '0' =>
38
    DataOutValid <='0';                                                         -- Data for trnsport from DataIO to FPGA valid
39
    DataOut   <= (others => '0');
40
    when others =>
41
    DataOutValid   <= nEnableIn;                                                 -- Data for trnsport from DataIO to FPGA valid
42
    DataOut       <= DataIO;
43
  end case;
44
 end if;
45
end process InProcess;

 Thank you for good cooperation.

 Regards Alex.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Alexander S. wrote:
1
 OutProcess:
2
 process (nEnableIn)
3
 begin
4
  if nEnableIn = '0' then
5
   DataIO      <= DataIn;
6
  else
7
   DataIO       <= (others => 'Z');
8
  end if;
9
 end process OutProcess;
As already said: the simulation doesn't fit reality due to an incomplete 
sensitivity list. DataIn is missing.

All in all this process is just bloating code. It can be replaced by 1 
concurrent line of code:
1
 DataIO <= DataIn when nEnableIn='0' else (others => 'Z');

: Edited by Moderator
von Alexander S. (Company: Home) (alex_isr)


Attached files:

Rate this post
useful
not useful
Lothar M. wrote:

> As already said: the simulation doesn't fit reality due to an incomplete
> sensitivity list. DataIn is missing.

 Thanx.
1
 
2
OutProcess:
3
process (nEnableIn,DataIn)
4
begin
5
 if nEnableIn = '0' then
6
  DataIO      <= DataIn;
7
 else
8
  DataIO       <= (others => 'Z');
9
 end if;
10
end process OutProcess;

 Usually, I use synchronous only process which have only clock in the 
sensitivity list.

 Regards Alex.

: Edited by Moderator
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.