diff --git a/controller.vhd b/controller.vhd index 945f2e98a874a5fe53a33899e327cb4a1387213e..b8c45c24a6dd44fae25c5e230ee7c11f575108c4 100644 --- a/controller.vhd +++ b/controller.vhd @@ -65,6 +65,25 @@ architecture RTL of Controller is end if; end function statusCheck; + function getStatusFromRx(databus: std_logic_vector(7 downto 0))return std_logic is + begin + Rd_sig <= '1'; + adress <= "101"; + end function getStatusFromRx; + + function sendDataToTx(databus: std_logic_vector(7 downto 0)) return std_logic is + begin + if txBusy = '0' then + adress <= "001"; + Data_bus <= databus; + Wr_sig <= '1'; + else + Rd_sig <= '1'; + Data_bus <= databus; + end if; + + end function sendDataToTx; + --Arkitekturen begynner begin @@ -104,19 +123,22 @@ begin statusChecker(turnTaker); if Data_bus = "ZZZZZZZZ" then - --do nothing + Rd_sig <= '0'; + else if Rd_sig = '1' then + sendDataToTx(Data_bus); else if turnTaker = '1' then -- da skal vi sjekke om TX er busy if Data_bus(0 downto 0) = "1" then txBusy <= '1'; elsif turnTaker = '0' then -- Skal sjekke om Rx har data til oss, status på fifo osv. - --if Data_bus() + getStatusFromRx(Data_bus); + else end if; end if; end if; end if; - --end if; + end if; end process p_clk;