VHDL simulazione -> VHDL sintesi

Sezione dedicata al linguaggio di descrizione hardware per logiche programmabili

VHDL simulazione -> VHDL sintesi

Postby kaiyu » 28 Jul 2013, 15:08

Ciao!

Ho appena iniziato ad imparare il VHDL e sto trovando difficoltà nel cercare di adattare il
seguente codice preso da una simulazione ad un codice da sintetizzare:

Code: Select all
  p_tx_stimulus : process

    variable column_index : natural := 0;

  begin

    wait until configuration_finished;
    wait until stim_tx_clk'event and stim_tx_clk = '0';

    for frame_index in frame_data'low to frame_data'high loop

      column_index := 0;

      -- loop over columns in frame.
      while to_stdulogic(frame_data(frame_index).columns(column_index).valid) /= '0' loop
        gmii_txd    <= to_stdlogicvector(frame_data(frame_index).columns(column_index).data);
        gmii_tx_en  <= to_stdulogic(frame_data(frame_index).columns(column_index).valid);
        gmii_tx_er  <= to_stdulogic(frame_data(frame_index).columns(column_index).error);
        column_index := column_index + 1;
        wait until stim_tx_clk'event and stim_tx_clk = '0';
      end loop;

      -- Clear the data lines.
      gmii_txd   <= (others => '0');
      gmii_tx_en <= '0';
      gmii_tx_er <= '0';

      for j in 0 to 11 loop
        wait until stim_tx_clk'event and stim_tx_clk = '0';
      end loop; -- j

    end loop;
    wait;
  end process p_tx_stimulus;


so che dovrei inserire configuration_finished e stim_tx_clk dentro la sensitivity list del processo ma da lì in poi il codice che scrivo mi da sempre errore.

Mi sapete dare una mano? Grazie.
kaiyu
 
Posts: 6
Joined: 28 Jul 2013, 14:59

Re: VHDL simulazione -> VHDL sintesi

Postby Leonardo » 28 Jul 2013, 21:37

Salve kaiyu e benvenuto al forum
Quale errore ricevi e cosa vorresti fare col codice VHDL che hai postato?
Il mio blog di elettronica: http://electro-logic.blogspot.it
User avatar
Leonardo
 
Posts: 502
Joined: 29 May 2013, 22:31
Location: Parma

Re: VHDL simulazione -> VHDL sintesi

Postby kaiyu » 29 Jul 2013, 09:23

Ciao Leonardo! Grazie per l'aiuto.
Ho bisogno di generare dei frame ethernet da inviare verso un core PHY PCS/PMA.
Gli errori che riscontro sono nelle forme d'onda in iSim di ISE, non sono quelli che vorrei.
Dato che "wait", "wait untill" e tutti i comandi temporali non sono sintetizzabili, voglio trascriverli in qualcosa di sintetizzabile.
Il codice che ho scritto è così:
Code: Select all
p_tx_stimulus : process(configuration_finished, stim_tx_clk)

    variable column_index : natural := 0;

  begin
 
   if configuration_finished = false and stim_tx_clk'event and stim_tx_clk = '0' then

      for frame_index in frame_data'low to frame_data'high loop

        column_index := 0;

        -- loop over columns in frame.
        while to_stdulogic(frame_data(frame_index).columns(column_index).valid) /= '0' loop
         if stim_tx_clk'event and stim_tx_clk = '0' then
            gmii_txd    <= to_stdlogicvector(frame_data(frame_index).columns(column_index).data);
            gmii_tx_en  <= to_stdulogic(frame_data(frame_index).columns(column_index).valid);
            gmii_tx_er  <= to_stdulogic(frame_data(frame_index).columns(column_index).error);
            column_index := column_index + 1;
         end if;
        end loop;

        -- Clear the data lines.
        gmii_txd   <= (others => '0');
        gmii_tx_en <= '0';
        gmii_tx_er <= '0';

--        for j in 0 to 11 loop
--         wait until stim_tx_clk'event and stim_tx_clk = '0';
--        end loop; -- j

      end loop;
   end if;
  end process p_tx_stimulus;


le tre righe commentate di codice non so proprio come riscriverle:
Code: Select all
        for j in 0 to 11 loop
         wait until stim_tx_clk'event and stim_tx_clk = '0';
        end loop; -- j


Mi sai aiutare? Grazie.
kaiyu
 
Posts: 6
Joined: 28 Jul 2013, 14:59

Re: VHDL simulazione -> VHDL sintesi

Postby deluca » 29 Jul 2013, 09:24

salve kaiyu, benvenuto al forum.

Non so se il codice è top-secret,
ma almeno una piccola tua presentazione e una descrizione del codice ci aiuterebbe a risolvere i tuoi inghippi.

Non siamo maghi, capisci?
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Re: VHDL simulazione -> VHDL sintesi

Postby kaiyu » 29 Jul 2013, 09:36

Ciao! Scusa, è che non volevo complicarvi le idee buttandovi giù tutto il progetto.
Il modulo vhdl da cui è preso il pezzo di codice è il seguente:
Code: Select all
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;


entity stimulus_tb is

    generic (
      INSTANCE_NUMBER          : integer := 0
    );

    port (

      -- Physical Interface (Transceiver)
      --------------------------------
      txp                     : in  std_logic;
      txn                     : in  std_logic;
      rxp                     : out std_logic;
      rxn                     : out std_logic;

      -- GMII Interface
      -----------------
      gmii_tx_clk             : out std_logic;
      gmii_rx_clk             : in std_logic;
      gmii_txd                : out std_logic_vector(7 downto 0);
      gmii_tx_en              : out std_logic;
      gmii_tx_er              : out std_logic;
      gmii_rxd                : in std_logic_vector(7 downto 0);
      gmii_rx_dv              : in std_logic;
      gmii_rx_er              : in std_logic;

      -- Test Bench Semaphores
      ------------------------
      configuration_finished  : in  boolean
      );
    
end stimulus_tb;



architecture behav of stimulus_tb is

  -- Unit Interval for Gigabit Ethernet
  constant UI    : time := 800 ps;
  -- FAKE RX SIGNAL TO ACTIVATE LINK STATUS BIT
  constant d      : std_logic_vector(0 to 19) := "00111110101001000101";

  ------------------------------------------------------------------------------
  -- types to support frame data
  ------------------------------------------------------------------------------
  -- gmii_txd, gmii_tx_en and gmii_tx_er record
  type data_typ is record
                       data  : bit_vector(7 downto 0);  -- data
                       valid : bit;                     -- data valid
                       error : bit;                     -- data error
                     end record;
  type frame_of_data_typ is array (natural range <>) of data_typ;

  -- Tx Data, Data_valid and underrun record
  type frame_typ is record
                      columns  : frame_of_data_typ(0 to 73);
                    end record;
  type frame_typ_ary is array (natural range <>) of frame_typ;



  ------------------------------------------------------------------------------
  -- Stimulus - Frame data
  ------------------------------------------------------------------------------
  -- The following constant holds the stimulus for the testbench. It is
  -- an ordered array of frames, with frame 0 the first to be injected
  -- into the core by the testbench.
  --
  -- This stimulus is used for both transmitter and receiver paths.
  ------------------------------------------------------------------------------
  constant frame_data : frame_typ_ary := (
    0          => (                     -- Frame 0
      columns  => (
        0      => ( data => X"55", valid => '1', error => '0'), -- Preamble
        1      => ( data => X"55", valid => '1', error => '0'),
        2      => ( data => X"55", valid => '1', error => '0'),
        3      => ( data => X"55", valid => '1', error => '0'),
        4      => ( data => X"55", valid => '1', error => '0'),
        5      => ( data => X"55", valid => '1', error => '0'),
        6      => ( data => X"55", valid => '1', error => '0'),
        7      => ( data => X"D5", valid => '1', error => '0'), -- SFD
        8      => ( data => X"DA", valid => '1', error => '0'), -- Destination Address (DA)
        9      => ( data => X"02", valid => '1', error => '0'),
        10     => ( data => X"03", valid => '1', error => '0'),
        11     => ( data => X"04", valid => '1', error => '0'),
        12     => ( data => X"05", valid => '1', error => '0'),
        13     => ( data => X"06", valid => '1', error => '0'),
        14     => ( data => X"5A", valid => '1', error => '0'), -- Source Address (5A)
        15     => ( data => X"02", valid => '1', error => '0'),
        16     => ( data => X"03", valid => '1', error => '0'),
        17     => ( data => X"04", valid => '1', error => '0'),
        18     => ( data => X"05", valid => '1', error => '0'),
        19     => ( data => X"06", valid => '1', error => '0'),
        20     => ( data => X"00", valid => '1', error => '0'),
        21     => ( data => X"2E", valid => '1', error => '0'), -- Length/Type = Length = 46
        22     => ( data => X"01", valid => '1', error => '0'),
        23     => ( data => X"02", valid => '1', error => '0'),
        24     => ( data => X"03", valid => '1', error => '0'),
        25     => ( data => X"04", valid => '1', error => '0'),
        26     => ( data => X"05", valid => '1', error => '0'),
        27     => ( data => X"06", valid => '1', error => '0'),
        28     => ( data => X"07", valid => '1', error => '0'),
        29     => ( data => X"08", valid => '1', error => '0'),
        30     => ( data => X"09", valid => '1', error => '0'),
        31     => ( data => X"0A", valid => '1', error => '0'),
        32     => ( data => X"0B", valid => '1', error => '0'),
        33     => ( data => X"0C", valid => '1', error => '0'),
        34     => ( data => X"0D", valid => '1', error => '0'),
        35     => ( data => X"0E", valid => '1', error => '0'),
        36     => ( data => X"0F", valid => '1', error => '0'),
        37     => ( data => X"10", valid => '1', error => '0'),
        38     => ( data => X"11", valid => '1', error => '0'),
        39     => ( data => X"12", valid => '1', error => '0'),
        40     => ( data => X"13", valid => '1', error => '0'),
        41     => ( data => X"14", valid => '1', error => '0'),
        42     => ( data => X"15", valid => '1', error => '0'),
        43     => ( data => X"16", valid => '1', error => '0'),
        44     => ( data => X"17", valid => '1', error => '0'),
        45     => ( data => X"18", valid => '1', error => '0'),
        46     => ( data => X"19", valid => '1', error => '0'),
        47     => ( data => X"1A", valid => '1', error => '0'),
        48     => ( data => X"1B", valid => '1', error => '0'),
        49     => ( data => X"1C", valid => '1', error => '0'),
        50     => ( data => X"1D", valid => '1', error => '0'),
        51     => ( data => X"1E", valid => '1', error => '0'),
        52     => ( data => X"1F", valid => '1', error => '0'),
        53     => ( data => X"20", valid => '1', error => '0'),
        54     => ( data => X"21", valid => '1', error => '0'),
        55     => ( data => X"22", valid => '1', error => '0'),
        56     => ( data => X"23", valid => '1', error => '0'),
        57     => ( data => X"24", valid => '1', error => '0'),
        58     => ( data => X"25", valid => '1', error => '0'),
        59     => ( data => X"26", valid => '1', error => '0'),
        60     => ( data => X"27", valid => '1', error => '0'),
        61     => ( data => X"28", valid => '1', error => '0'),
        62     => ( data => X"29", valid => '1', error => '0'),
        63     => ( data => X"2A", valid => '1', error => '0'),
        64     => ( data => X"2B", valid => '1', error => '0'),
        65     => ( data => X"2C", valid => '1', error => '0'),
        66     => ( data => X"2D", valid => '1', error => '0'),
        67     => ( data => X"2E", valid => '1', error => '0'),
        68     => ( data => X"14", valid => '1', error => '0'), -- FCS field
        69     => ( data => X"19", valid => '1', error => '0'),
        70     => ( data => X"D1", valid => '1', error => '0'),
        71     => ( data => X"DD", valid => '1', error => '0'),
        others => ( data => X"00", valid => '0', error => '0'))
      ),
    1          => (                     -- Frame 1
      columns  => (
        0      => ( data => X"55", valid => '1', error => '0'), -- Preamble
        1      => ( data => X"55", valid => '1', error => '0'),
        2      => ( data => X"55", valid => '1', error => '0'),
        3      => ( data => X"55", valid => '1', error => '0'),
        4      => ( data => X"55", valid => '1', error => '0'),
        5      => ( data => X"55", valid => '1', error => '0'),
        6      => ( data => X"55", valid => '1', error => '0'),
        7      => ( data => X"D5", valid => '1', error => '0'), -- SFD
        8      => ( data => X"DA", valid => '1', error => '0'), -- Destination Address (DA)
        9      => ( data => X"02", valid => '1', error => '0'),
        10     => ( data => X"03", valid => '1', error => '0'),
        11     => ( data => X"04", valid => '1', error => '0'),
        12     => ( data => X"05", valid => '1', error => '0'),
        13     => ( data => X"06", valid => '1', error => '0'),
        14     => ( data => X"5A", valid => '1', error => '0'), -- Source Address (5A)
        15     => ( data => X"02", valid => '1', error => '0'),
        16     => ( data => X"03", valid => '1', error => '0'),
        17     => ( data => X"04", valid => '1', error => '0'),
        18     => ( data => X"05", valid => '1', error => '0'),
        19     => ( data => X"06", valid => '1', error => '0'),
        20     => ( data => X"00", valid => '1', error => '0'),
        21     => ( data => X"2E", valid => '1', error => '0'), -- Length/Type = Length = 46
        22     => ( data => X"01", valid => '1', error => '0'),
        23     => ( data => X"02", valid => '1', error => '0'),
        24     => ( data => X"03", valid => '1', error => '0'),
        25     => ( data => X"04", valid => '1', error => '0'),
        26     => ( data => X"05", valid => '1', error => '0'),
        27     => ( data => X"06", valid => '1', error => '0'),
        28     => ( data => X"07", valid => '1', error => '0'),
        29     => ( data => X"08", valid => '1', error => '0'),
        30     => ( data => X"09", valid => '1', error => '0'),
        31     => ( data => X"0A", valid => '1', error => '0'),
        32     => ( data => X"0B", valid => '1', error => '0'),
        33     => ( data => X"0C", valid => '1', error => '0'),
        34     => ( data => X"0D", valid => '1', error => '0'),
        35     => ( data => X"0E", valid => '1', error => '0'),
        36     => ( data => X"0F", valid => '1', error => '0'),
        37     => ( data => X"10", valid => '1', error => '0'),
        38     => ( data => X"11", valid => '1', error => '0'),
        39     => ( data => X"12", valid => '1', error => '0'),
        40     => ( data => X"13", valid => '1', error => '0'),
        41     => ( data => X"14", valid => '1', error => '0'),
        42     => ( data => X"15", valid => '1', error => '0'),
        43     => ( data => X"16", valid => '1', error => '0'),
        44     => ( data => X"17", valid => '1', error => '0'),
        45     => ( data => X"18", valid => '1', error => '0'),
        46     => ( data => X"19", valid => '1', error => '0'),
        47     => ( data => X"1A", valid => '1', error => '0'),
        48     => ( data => X"1B", valid => '1', error => '0'),
        49     => ( data => X"1C", valid => '1', error => '0'),
        50     => ( data => X"1D", valid => '1', error => '0'),
        51     => ( data => X"1E", valid => '1', error => '0'),
        52     => ( data => X"1F", valid => '1', error => '0'),
        53     => ( data => X"20", valid => '1', error => '0'),
        54     => ( data => X"21", valid => '1', error => '0'),
        55     => ( data => X"22", valid => '1', error => '0'),
        56     => ( data => X"23", valid => '1', error => '0'),
        57     => ( data => X"24", valid => '1', error => '0'),
        58     => ( data => X"25", valid => '1', error => '0'),
        59     => ( data => X"26", valid => '1', error => '0'),
        60     => ( data => X"27", valid => '1', error => '0'),
        61     => ( data => X"28", valid => '1', error => '0'),
        62     => ( data => X"29", valid => '1', error => '0'),
        63     => ( data => X"2A", valid => '1', error => '0'),
        64     => ( data => X"2B", valid => '1', error => '0'),
        65     => ( data => X"2C", valid => '1', error => '0'),
        66     => ( data => X"2D", valid => '1', error => '0'),
        67     => ( data => X"2E", valid => '1', error => '0'),
        68     => ( data => X"14", valid => '1', error => '0'), -- FCS field
        69     => ( data => X"19", valid => '1', error => '0'),
        70     => ( data => X"D1", valid => '1', error => '0'),
        71     => ( data => X"DD", valid => '1', error => '0'),
        others => ( data => X"00", valid => '0', error => '0'))
      ),
    2          => (                     -- Frame 2
     columns   => (
        0      => ( data => X"55", valid => '1', error => '0'), -- Preamble
        1      => ( data => X"55", valid => '1', error => '0'),
        2      => ( data => X"55", valid => '1', error => '0'),
        3      => ( data => X"55", valid => '1', error => '0'),
        4      => ( data => X"55", valid => '1', error => '0'),
        5      => ( data => X"55", valid => '1', error => '0'),
        6      => ( data => X"55", valid => '1', error => '0'),
        7      => ( data => X"D5", valid => '1', error => '0'), -- SFD
        8      => ( data => X"DA", valid => '1', error => '0'), -- Destination Address (DA)
        9      => ( data => X"02", valid => '1', error => '0'),
        10     => ( data => X"03", valid => '1', error => '0'),
        11     => ( data => X"04", valid => '1', error => '0'),
        12     => ( data => X"05", valid => '1', error => '0'),
        13     => ( data => X"06", valid => '1', error => '0'),
        14     => ( data => X"5A", valid => '1', error => '0'), -- Source Address (5A)
        15     => ( data => X"02", valid => '1', error => '0'),
        16     => ( data => X"03", valid => '1', error => '0'),
        17     => ( data => X"04", valid => '1', error => '0'),
        18     => ( data => X"05", valid => '1', error => '0'),
        19     => ( data => X"06", valid => '1', error => '0'),
        20     => ( data => X"00", valid => '1', error => '0'),
        21     => ( data => X"2E", valid => '1', error => '0'), -- Length/Type = Length = 46
        22     => ( data => X"01", valid => '1', error => '0'),
        23     => ( data => X"02", valid => '1', error => '0'),
        24     => ( data => X"03", valid => '1', error => '0'),
        25     => ( data => X"04", valid => '1', error => '0'),
        26     => ( data => X"05", valid => '1', error => '0'),
        27     => ( data => X"06", valid => '1', error => '0'),
        28     => ( data => X"07", valid => '1', error => '0'),
        29     => ( data => X"08", valid => '1', error => '0'),
        30     => ( data => X"09", valid => '1', error => '0'),
        31     => ( data => X"0A", valid => '1', error => '0'),
        32     => ( data => X"0B", valid => '1', error => '0'),
        33     => ( data => X"0C", valid => '1', error => '0'),
        34     => ( data => X"0D", valid => '1', error => '0'),
        35     => ( data => X"0E", valid => '1', error => '0'),
        36     => ( data => X"0F", valid => '1', error => '0'),
        37     => ( data => X"10", valid => '1', error => '0'),
        38     => ( data => X"11", valid => '1', error => '0'),
        39     => ( data => X"12", valid => '1', error => '0'),
        40     => ( data => X"13", valid => '1', error => '0'),
        41     => ( data => X"14", valid => '1', error => '0'),
        42     => ( data => X"15", valid => '1', error => '0'),
        43     => ( data => X"16", valid => '1', error => '0'),
        44     => ( data => X"17", valid => '1', error => '0'),
        45     => ( data => X"18", valid => '1', error => '0'),
        46     => ( data => X"19", valid => '1', error => '0'),
        47     => ( data => X"1A", valid => '1', error => '0'),
        48     => ( data => X"1B", valid => '1', error => '0'),
        49     => ( data => X"1C", valid => '1', error => '0'),
        50     => ( data => X"1D", valid => '1', error => '0'),
        51     => ( data => X"1E", valid => '1', error => '0'),
        52     => ( data => X"1F", valid => '1', error => '0'),
        53     => ( data => X"20", valid => '1', error => '0'),
        54     => ( data => X"21", valid => '1', error => '0'),
        55     => ( data => X"22", valid => '1', error => '0'),
        56     => ( data => X"23", valid => '1', error => '0'),
        57     => ( data => X"24", valid => '1', error => '0'),
        58     => ( data => X"25", valid => '1', error => '0'),
        59     => ( data => X"26", valid => '1', error => '0'),
        60     => ( data => X"27", valid => '1', error => '0'),
        61     => ( data => X"28", valid => '1', error => '0'),
        62     => ( data => X"29", valid => '1', error => '0'),
        63     => ( data => X"2A", valid => '1', error => '0'),
        64     => ( data => X"2B", valid => '1', error => '0'),
        65     => ( data => X"2C", valid => '1', error => '0'),
        66     => ( data => X"2D", valid => '1', error => '0'),
        67     => ( data => X"2E", valid => '1', error => '0'),
        68     => ( data => X"14", valid => '1', error => '0'), -- FCS field
        69     => ( data => X"19", valid => '1', error => '0'),
        70     => ( data => X"D1", valid => '1', error => '0'),
        71     => ( data => X"DD", valid => '1', error => '0'),
        others => ( data => X"00", valid => '0', error => '0'))
     ),
   3           => (                     -- Frame 3
     columns   => (
        0      => ( data => X"55", valid => '1', error => '0'), -- Preamble
        1      => ( data => X"55", valid => '1', error => '0'),
        2      => ( data => X"55", valid => '1', error => '0'),
        3      => ( data => X"55", valid => '1', error => '0'),
        4      => ( data => X"55", valid => '1', error => '0'),
        5      => ( data => X"55", valid => '1', error => '0'),
        6      => ( data => X"55", valid => '1', error => '0'),
        7      => ( data => X"D5", valid => '1', error => '0'), -- SFD
        8      => ( data => X"DA", valid => '1', error => '0'), -- Destination Address (DA)
        9      => ( data => X"02", valid => '1', error => '0'),
        10     => ( data => X"03", valid => '1', error => '0'),
        11     => ( data => X"04", valid => '1', error => '0'),
        12     => ( data => X"05", valid => '1', error => '0'),
        13     => ( data => X"06", valid => '1', error => '0'),
        14     => ( data => X"5A", valid => '1', error => '0'), -- Source Address (5A)
        15     => ( data => X"02", valid => '1', error => '0'),
        16     => ( data => X"03", valid => '1', error => '0'),
        17     => ( data => X"04", valid => '1', error => '0'),
        18     => ( data => X"05", valid => '1', error => '0'),
        19     => ( data => X"06", valid => '1', error => '0'),
        20     => ( data => X"00", valid => '1', error => '0'),
        21     => ( data => X"2E", valid => '1', error => '0'), -- Length/Type = Length = 46
        22     => ( data => X"01", valid => '1', error => '0'),
        23     => ( data => X"02", valid => '1', error => '0'),
        24     => ( data => X"03", valid => '1', error => '0'),
        25     => ( data => X"04", valid => '1', error => '0'),
        26     => ( data => X"05", valid => '1', error => '0'),
        27     => ( data => X"06", valid => '1', error => '0'),
        28     => ( data => X"07", valid => '1', error => '0'),
        29     => ( data => X"08", valid => '1', error => '0'),
        30     => ( data => X"09", valid => '1', error => '0'),
        31     => ( data => X"0A", valid => '1', error => '0'),
        32     => ( data => X"0B", valid => '1', error => '0'),
        33     => ( data => X"0C", valid => '1', error => '0'),
        34     => ( data => X"0D", valid => '1', error => '0'),
        35     => ( data => X"0E", valid => '1', error => '0'),
        36     => ( data => X"0F", valid => '1', error => '0'),
        37     => ( data => X"10", valid => '1', error => '0'),
        38     => ( data => X"11", valid => '1', error => '0'),
        39     => ( data => X"12", valid => '1', error => '0'),
        40     => ( data => X"13", valid => '1', error => '0'),
        41     => ( data => X"14", valid => '1', error => '0'),
        42     => ( data => X"15", valid => '1', error => '0'),
        43     => ( data => X"16", valid => '1', error => '0'),
        44     => ( data => X"17", valid => '1', error => '0'),
        45     => ( data => X"18", valid => '1', error => '0'),
        46     => ( data => X"19", valid => '1', error => '0'),
        47     => ( data => X"1A", valid => '1', error => '0'),
        48     => ( data => X"1B", valid => '1', error => '0'),
        49     => ( data => X"1C", valid => '1', error => '0'),
        50     => ( data => X"1D", valid => '1', error => '0'),
        51     => ( data => X"1E", valid => '1', error => '0'),
        52     => ( data => X"1F", valid => '1', error => '0'),
        53     => ( data => X"20", valid => '1', error => '0'),
        54     => ( data => X"21", valid => '1', error => '0'),
        55     => ( data => X"22", valid => '1', error => '0'),
        56     => ( data => X"23", valid => '1', error => '0'),
        57     => ( data => X"24", valid => '1', error => '0'),
        58     => ( data => X"25", valid => '1', error => '0'),
        59     => ( data => X"26", valid => '1', error => '0'),
        60     => ( data => X"27", valid => '1', error => '0'),
        61     => ( data => X"28", valid => '1', error => '0'),
        62     => ( data => X"29", valid => '1', error => '0'),
        63     => ( data => X"2A", valid => '1', error => '0'),
        64     => ( data => X"2B", valid => '1', error => '0'),
        65     => ( data => X"2C", valid => '1', error => '0'),
        66     => ( data => X"2D", valid => '1', error => '0'),
        67     => ( data => X"2E", valid => '1', error => '0'),
        68     => ( data => X"14", valid => '1', error => '0'), -- FCS field
        69     => ( data => X"19", valid => '1', error => '0'),
        70     => ( data => X"D1", valid => '1', error => '0'),
        71     => ( data => X"DD", valid => '1', error => '0'),
        others => ( data => X"00", valid => '0', error => '0'))
     ));



  -- signals for the Tx monitor following 8B10B decode
  signal stim_tx_clk      : std_logic;                           -- Transmitter clock (stimulus process).

  -- signals for the Rx stimulus prior to 8B10B encode
  signal stim_rx_clk      : std_logic;                           -- Receiver clock (stimulus process).
  signal bitclock         : std_logic;                           -- clock running at Transceiver serial frequency


begin  -- behav


  ------------------------------------------------------------------------------
  -- Clock drivers
  ------------------------------------------------------------------------------

  p_stim_rx_clk : process        -- drives Rx stimulus clock at 125 MHz
  begin
      stim_rx_clk <= '0';
      wait for 4 ns;
      stim_rx_clk <= '1';
      wait for 4 ns;
  end process p_stim_rx_clk;

  p_stim_tx_clk : process        -- drives stim_tx_clk at 125 MHz
  begin
      stim_tx_clk <= '0';
      wait for 4 ns;
      stim_tx_clk <= '1';
      wait for 4 ns;
  end process p_stim_tx_clk;

  gmii_tx_clk <= stim_tx_clk;

  p_bitclock : process           -- drives bitclock at 1.25GHz
  begin
    bitclock <= '0';
    wait for 100 ps;
   loop
      bitclock <= '0';
      wait for UI / 2;
      bitclock <= '1';
      wait for UI / 2;
   end loop;
  end process p_bitclock;


  ------------------------------------------------------------------------------
  -- Tx stimulus process. This process will push frames of data into the
  -- GMII transmitter side of the PCS/PMA core.
  ------------------------------------------------------------------------------
  p_tx_stimulus : process
    variable column_index : natural := 0;  -- Column counter within frame
    variable stats_value  : std_logic_vector(63 downto 0);
  begin

    -- Initialize
--    gmii_txd    <= X"FF";
--    gmii_tx_en  <= '1';
--    gmii_tx_er  <= '1';
--    wait for 1 ns;
    gmii_txd    <= X"00";
    gmii_tx_en  <= '0';
    gmii_tx_er  <= '0';

    -- Wait for the configuration process to finish
    wait until configuration_finished;

    -- Synchronise to the transmitter clock
    wait until stim_tx_clk'event and stim_tx_clk = '0';

    for frame_index in frame_data'low to frame_data'high loop

      column_index := 0;

      -- loop over columns in frame.
      while to_stdulogic(frame_data(frame_index).columns(column_index).valid) /= '0' loop
        gmii_txd    <= to_stdlogicvector(frame_data(frame_index).columns(column_index).data);
        gmii_tx_en  <= to_stdulogic(frame_data(frame_index).columns(column_index).valid);
        gmii_tx_er  <= to_stdulogic(frame_data(frame_index).columns(column_index).error);
        column_index := column_index + 1;
        wait until stim_tx_clk'event and stim_tx_clk = '0';
      end loop;

      -- Clear the data lines.
      gmii_txd   <= (others => '0');
      gmii_tx_en <= '0';
      gmii_tx_er <= '0';

      for j in 0 to 11 loop                                 -- delay to create Inter Packet Gap.
        wait until stim_tx_clk'event and stim_tx_clk = '0';
      end loop; -- j

    end loop;   -- frame_index
    wait;
  end process p_tx_stimulus;



  fake_rx : process
 
    begin
      for i in 0 to 19 loop
        rxp <= d(i);
        rxn <= not d(i);
        wait until bitclock'event and bitclock = '1';
      end loop; 

  end process fake_rx;

end behav;



questo modulo è per la simulazione del core PHY della Xilinx, più esattamente il 1000BASE-X PCS/PMA (sto cercando di creare una comunicazione FPGA-PC tramite fibra su protocollo ethernet).
Dato che alle prime armi col VHDL non sono in grado di creare un wrapper al core che mi stabilisca la connessione, ho pensato bene di riutilizzare il procedimento del codice di simulazione.
Grazie.
kaiyu
 
Posts: 6
Joined: 28 Jul 2013, 14:59

Re: VHDL simulazione -> VHDL sintesi

Postby Leonardo » 29 Jul 2013, 11:11

Salve kaiyu,
Partiamo da un'analisi delle righe di codice:

for j in 0 to 11 loop
wait until stim_tx_clk'event and stim_tx_clk = '0';
end loop; -- j


Cosa fanno? Aspettano per 12 volte il fronte di discesa del segnale stim_tx_clk
Chiediamoci quindi come sintetizzare un comportamento simile, un contatore che conta fino a 12 e viene incrementato ad ogni fronte di discesa del segnale potrebbe essere un'inizio.

Ciao
Leonardo
Il mio blog di elettronica: http://electro-logic.blogspot.it
User avatar
Leonardo
 
Posts: 502
Joined: 29 May 2013, 22:31
Location: Parma

Re: VHDL simulazione -> VHDL sintesi

Postby kaiyu » 29 Jul 2013, 11:41

si ci ho pensato però dovrei inserire un segnale di flag da mettere nella sensitivity list del primo loop.
O sbaglio?
kaiyu
 
Posts: 6
Joined: 28 Jul 2013, 14:59

Re: VHDL simulazione -> VHDL sintesi

Postby Leonardo » 29 Jul 2013, 12:48

Ti consiglio di ripensare tramite macchina a stati il comportamento del circuito, avresti altrimenti un comportamento differente.

Ti faccio un esempio, il ciclo while

Code: Select all
while to_stdulogic(frame_data(frame_index).columns(column_index).valid) /= '0' loop
        gmii_txd    <= to_stdlogicvector(frame_data(frame_index).columns(column_index).data);
        gmii_tx_en  <= to_stdulogic(frame_data(frame_index).columns(column_index).valid);
        gmii_tx_er  <= to_stdulogic(frame_data(frame_index).columns(column_index).error);
        column_index := column_index + 1;
        wait until stim_tx_clk'event and stim_tx_clk = '0';
end loop;


se riscritto come hai fatto

Code: Select all
while to_stdulogic(frame_data(frame_index).columns(column_index).valid) /= '0' loop
         if stim_tx_clk'event and stim_tx_clk = '0' then
            gmii_txd    <= to_stdlogicvector(frame_data(frame_index).columns(column_index).data);
            gmii_tx_en  <= to_stdulogic(frame_data(frame_index).columns(column_index).valid);
            gmii_tx_er  <= to_stdulogic(frame_data(frame_index).columns(column_index).error);
            column_index := column_index + 1;
         end if;
end loop;


assume un comportamento del tutto diverso, se l'if è falso il processo continua ugualmente le istruzioni successive (dopo il ciclo while se ci sono le condizioni per uscirne) a differenza dell'istruzione wait until.
Last edited by Leonardo on 29 Jul 2013, 13:52, edited 1 time in total.
Il mio blog di elettronica: http://electro-logic.blogspot.it
User avatar
Leonardo
 
Posts: 502
Joined: 29 May 2013, 22:31
Location: Parma

Re: VHDL simulazione -> VHDL sintesi

Postby kaiyu » 29 Jul 2013, 13:16

Grazie Leonardo.
Il "while" e il "loop" sono sintetizzabili?
Il "if" dopo un "while" è sempre ignorato?
kaiyu
 
Posts: 6
Joined: 28 Jul 2013, 14:59

Re: VHDL simulazione -> VHDL sintesi

Postby Leonardo » 29 Jul 2013, 13:42

Di nulla, figurati

Il "while" e il "loop" sono sintetizzabili?


Non sono sempre sintetizzabili, ad esempio Quartus sintetizza il costrutto se il ciclo termina entro 10.000 iterazioni, altri compilatori potrebbero non sintetizzare il costrutto o avere altre restrizioni

Il "if" dopo un "while" è sempre ignorato?


Intendevo con l'intervento di prima dire naturalmente che la valutazione delle condizioni se falsa non comporterà l'esecuzione delle istruzioni conseguenti all'if. La valutazione se falsa porterà il processo a continuare immediatamente la sua esecuzione, nel tuo caso restando dentro al ciclo while fino a che le condizioni del ciclo rimangono soddisfatte. Situazione differente dall'utilizzo dell'istruzione wait until in quel caso.

Prima differenza: nello stralcio di codice le istruzioni (nella prima versione con wait until) vengono eseguite almeno una volta indipendentemente dal segnale stim_tx_clk , nella seconda versione con l'if la prima esecuzione degli assegnamenti può non avvenire subito ma solamente al fronte di discesa di stim_tx_clk se la condizione del while si mantiene vera

Ti lascio trovare le altre differenze
Il mio blog di elettronica: http://electro-logic.blogspot.it
User avatar
Leonardo
 
Posts: 502
Joined: 29 May 2013, 22:31
Location: Parma

Re: VHDL simulazione -> VHDL sintesi

Postby deluca » 29 Jul 2013, 21:51

@kaiyu,
ti stai imbatendo su TEMAC ?
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Re: VHDL simulazione -> VHDL sintesi

Postby kaiyu » 01 Aug 2013, 14:36

si e no.. avevo intenzione di mettere insieme il core TEMAC e il 1000BASE-X della Xilinx per far funzionare un ethernet a 1Gb su fibra tra FPGA e PC.

Ho dovuto scartare tale opzione perchè troppo complesso per me che sono alle prime armi, quindi ho deciso di scrivere dei frame a mano e passarli direttamente al 1000BASE-X.

Tutto questo lavoro verrà poi trasportato sul 10GBASE.

Se hai suggerimenti sono ben accetti :)

Grazie.
kaiyu
 
Posts: 6
Joined: 28 Jul 2013, 14:59


Return to VHDL x FPGA

Who is online

Users browsing this forum: No registered users and 3 guests

cron