use work.core_pkg.all;
use work.mem_pkg.all;
+use work.extension_pkg.all;
architecture behav of writeback_stage is
-
signal data_ram_read : word_t;
signal wb_reg, wb_reg_nxt : writeback_rec;
+signal ext_uart,ext_timer,ext_gpmp : extmod_rec;
+
+
+
begin
data_ram_read
);
-
+
syn: process(clk, reset)
begin
end if;
end if;
- jump <= alu_jmp xor br_pred;
+ jump <= (alu_jmp xor br_pred) and (write_en or wb_reg.dmem_en);
+
+ if alu_jmp = '0' and br_pred = '1' and write_en = '0' then
+ jump <= '1';
+ end if;
+
jump_addr <= result;
if ((alu_jmp and wb_reg.dmem_en) = '1') then
jump_addr <= data_ram_read;
reg_addr <= result_addr;
end process;
+
+addr_de_mult: process(wb_reg_nxt.address)
+
+begin
+
+ ext_uart.sel <='0';
+ ext_uart.wr_en <= '0';
+ ext_uart.byte_en <= (others => '0');
+ ext_uart.data <= (others => '0');
+ ext_uart.addr <= (others => '0');
+
+ ext_timer.sel <='0';
+ ext_timer.wr_en <= '0';
+ ext_timer.byte_en <= (others => '0');
+ ext_timer.data <= (others => '0');
+ ext_timer.addr <= (others => '0');
+
+ ext_gpmp.sel <='0';
+ ext_gpmp.wr_en <= '0';
+ ext_gpmp.byte_en <= (others => '0');
+ ext_gpmp.data <= (others => '0');
+ ext_gpmp.addr <= (others => '0');
+ -- wenn ich hier statt dem 4rer die konstante nehme dann gibts an fehler wegen nicht lokaler variable -.-
+ case wb_reg_nxt.address(wb_reg_nxt.address'high downto 4) is
+ when EXT_UART_ADDR =>
+ ext_uart.sel <='1';
+ ext_uart.wr_en <= wb_reg_nxt.dmem_write_en;
+ ext_uart.data <= ram_data;
+ ext_uart.addr <= wb_reg_nxt.address(wb_reg_nxt.address'high downto BYTEADDR);
+ case wb_reg.address(1 downto 0) is
+ when "00" => ext_uart.byte_en <= "0001";
+ when "01" => ext_uart.byte_en <= "0010";
+ when "10" => ext_uart.byte_en <= "0100";
+ when "11" => ext_uart.byte_en <= "1000";
+ when others => null;
+ end case;
+ when EXT_TIMER_ADDR =>
+ ext_timer.sel <='1';
+ ext_timer.wr_en <= wb_reg_nxt.dmem_write_en;
+ ext_timer.data <= ram_data;
+ ext_timer.addr <= wb_reg_nxt.address(wb_reg_nxt.address'high downto BYTEADDR);
+ case wb_reg.address(1 downto 0) is
+ when "00" => ext_timer.byte_en <= "0001";
+ when "01" => ext_timer.byte_en <= "0010";
+ when "10" => ext_timer.byte_en <= "0100";
+ when "11" => ext_timer.byte_en <= "1000";
+ when others => null;
+ end case;
+ when EXT_GPMP_ADDR =>
+ ext_gpmp.sel <='1';
+ ext_gpmp.wr_en <= wb_reg_nxt.dmem_write_en;
+ ext_gpmp.data <= ram_data;
+ ext_gpmp.addr <= wb_reg_nxt.address(wb_reg_nxt.address'high downto BYTEADDR);
+ case wb_reg.address(1 downto 0) is
+ when "00" => ext_gpmp.byte_en <= "0001";
+ when "01" => ext_gpmp.byte_en <= "0010";
+ when "10" => ext_gpmp.byte_en <= "0100";
+ when "11" => ext_gpmp.byte_en <= "1000";
+ when others => null;
+ end case;
+ -- hier kann man weiter extensions adden :) Konstanten sind im extension pkg definiert
+ when others => null;
+ end case;
+
+end process;
+
end behav;