]> jspc29.x-matter.uni-frankfurt.de Git - trb3.git/commitdiff
output and input pipeline stages for data simulation.
authorTobias Weber <toweber86@gmail.com>
Thu, 19 Jul 2018 10:03:41 +0000 (12:03 +0200)
committerTobias Weber <toweber86@gmail.com>
Thu, 19 Jul 2018 10:03:41 +0000 (12:03 +0200)
mupix/Mupix8/sources/Simulation/DataOutput.vhd
mupix/Mupix8/sources/Simulation/LinkSimulation.vhd
mupix/Mupix8/sources/Simulation/Mupix8StateMachine.vhd

index bf996f85d2ecc3cdbd44cdc244cd57e9fd21ab45..c9e7f9b562ba04673c106e0e8c1a45889ad44385 100644 (file)
@@ -20,32 +20,50 @@ architecture rtl of DataOutput is
 
   signal cnt5 : integer range 0 to 4 := 4;
 
+  signal datain_i   : std_logic_vector(9 downto 0) := (others => '0');
+  signal empty_i    : std_logic                    := '0';
+  signal data_out_i : std_logic_vector(1 downto 0);
+
   type output_fsm_type is (idle, readfifo, sending);
   signal output_state : output_fsm_type := idle;
 
 begin  -- architecture rtl
 
+  -- purpose: register input signals to state machine
+  input_register : process (clk) is
+  begin  -- process input_register
+    if rising_edge(clk) then            -- rising clock edge
+      if reset = '1' then               -- synchronous reset (active high)
+        datain_i <= (others => '0');
+        empty_i  <= '0';
+      else
+        datain_i <= datain;
+        empty_i  <= empty;
+      end if;
+    end if;
+  end process input_register;
+
   output_proc : process (clk) is
   begin  -- process output_proc
     if rising_edge(clk) then            -- rising clock edge
       if reset = '1' then
         output_state <= idle;
         cnt5         <= 0;
-        dataout      <= (others => '0');
+        data_out_i   <= (others => '0');
       else
-        dataout <= (others => '0');
-        rden    <= '0';
+        data_out_i <= (others => '0');
+        rden       <= '0';
         case output_state is
           when idle =>
             cnt5 <= 0;
-            if empty = '0' then
+            if empty_i = '0' then
               output_state <= readfifo;
               rden         <= '1';
             end if;
           when readfifo =>
             output_state <= sending;
           when sending =>
-            dataout <= datain((cnt5 + 1)*2 - 1 downto cnt5*2);
+            data_out_i <= datain_i((cnt5 + 1)*2 - 1 downto cnt5*2);
             -- counter
             if cnt5 < 4 then
               cnt5 <= cnt5 + 1;
@@ -58,7 +76,7 @@ begin  -- architecture rtl
                 rden <= '1';
               end if;
             elsif cnt5 = 4 then
-              if empty = '0' then
+              if empty_i = '0' then
                 output_state <= sending;
               else
                 output_state <= idle;
@@ -69,4 +87,15 @@ begin  -- architecture rtl
     end if;
   end process output_proc;
 
+  data_output_pipe : process (clk) is
+  begin  -- process data_output_pipe
+    if rising_edge(clk) then            -- rising clock edge
+      if reset = '1' then               -- synchronous reset (active high)
+        dataout <= (others => '0');
+      else
+        dataout <= data_out_i;
+      end if;
+    end if;
+  end process data_output_pipe;
+
 end architecture rtl;
index 893a058977acd862b892623603b213e7c2077ed8..ff0bc3c3efe924e18d76fc57bdd4d1fe666a64a0 100644 (file)
@@ -130,22 +130,11 @@ begin  -- architecture rtl
       rden    => fifo_rden_i,
       dataout => data_out_i);
 
-  data_output_pipe : process (sim_clk_i) is
-  begin  -- process data_output_pipe
-    if rising_edge(sim_clk_i) then      -- rising clock edge
-      if reset_reg = '1' then               -- synchronous reset (active high)
-        data_out_reg <= (others => '0');
-      else
-        data_out_reg <= data_out_i;
-      end if;
-    end if;
-  end process data_output_pipe;
-
   simlink_oddr : ODDRXD1
     port map (
       SCLK => sim_clk_i,
-      DA   => data_out_reg(0),
-      DB   => data_out_reg(1),
+      DA   => data_out_i(0),
+      DB   => data_out_i(1),
       Q    => data_out);
 
   dataclk <= data_clk_i;
index 4ad1edd25a4425f27e9febe7cc0ab8ec21ea04fc..ced8b0e8a53cdbd413aa4d6572004eacb56e14b4 100644 (file)
@@ -50,6 +50,9 @@ architecture rtl of MupixStateMachine is
   signal word_cnt_i     : unsigned(4 downto 0)  := (others => '0');
   signal slowdown_cnt_i : unsigned(15 downto 0) := (others => '0');
 
+  signal wr_en_i    : std_logic                    := '0';
+  signal data_out_i : std_logic_vector(9 downto 0) := (others => '0');
+
 begin  -- architecture rtl
 
   -- 8b10b encoding of data
@@ -76,9 +79,9 @@ begin  -- architecture rtl
   begin  -- process encoder_falling_to_rise
     if rising_edge(clk) then            -- rising clock edge
       if reset = '1' then               -- synchronous reset (active high)
-        data_out <= (others => '0');
+        data_out_i <= (others => '0');
       else
-        data_out <= data_encoded_falling;
+        data_out_i <= data_encoded_falling;
       end if;
     end if;
   end process encoder_falling_to_rise;
@@ -91,12 +94,12 @@ begin  -- architecture rtl
     if rising_edge(clk) then
       if reset = '1' then
         wait_after_reset  := 0;
-        wr_en             <= '0';
+        wr_en_i             <= '0';
         start_i           <= '0';
         wait_before_start := 0;
       else
         if wait_after_reset = 3 then
-          wr_en <= '1';
+          wr_en_i <= '1';
         else
           wait_after_reset := wait_after_reset + 1;
         end if;
@@ -260,4 +263,17 @@ begin  -- architecture rtl
     end if;
   end process mupix_proc;
 
+  data_output_pipe : process (clk) is
+  begin  -- process data_output_pipe
+    if rising_edge(clk) then            -- rising clock edge
+      if reset = '1' then               -- synchronous reset (active high)
+        wr_en    <= '0';
+        data_out <= (others => '0');
+      else
+        wr_en    <= wr_en_i;
+        data_out <= data_out_i;
+      end if;
+    end if;
+  end process data_output_pipe;
+
 end architecture rtl;