signal ext_uart,ext_timer,ext_gpmp,ext_7seg : extmod_rec;
signal ext_uart_out, ext_timer_out, ext_gpmp_out : gp_register_t;
-signal sel_nxt, dmem_we, bus_rx, ext_anysel : std_logic;
+signal sel_nxt, dmem_we, ext_anysel : std_logic;
signal calc_mem_res : gp_register_t;
wb_reg.dmem_write_en <= '0';
wb_reg.hword <= '0';
wb_reg.byte_s <= '0';
- bus_rx <= '1';
wb_reg.byte_en <= (others => '0');
wb_reg.data <= (others =>'0');
elsif rising_edge(clk) then
wb_reg <= wb_reg_nxt;
- bus_rx <= '1';
end if;
end process;
-out_logic: process(write_en, result_addr, wb_reg, alu_jmp, wb_reg_nxt, data_ram_read_ext, calc_mem_res, data_ram_read, ext_anysel, result)
+out_logic: process(write_en, result_addr, wb_reg, alu_jmp, wb_reg_nxt, data_ram_read_ext, calc_mem_res, data_ram_read, ext_anysel, result, hword, byte_s)
variable reg_we_v : std_logic;
variable data_out : gp_register_t;
begin
data_out(4*byte_t'length-1 downto 3*byte_t'length) := (others => '0');
end if;
- data_out := to_stdlogicvector(to_bitvector(data_out) srl to_integer(unsigned(wb_reg.address(BYTEADDR-1 downto 0)))*byte_t'length);
+
+ if wb_reg.hword = '1' or wb_reg.byte_s = '1' then
+ if wb_reg.address(1)='1' then
+ data_out(hword_t'range) := data_out(data_out'high downto (data_out'length/2));
+ end if;
+ data_out(data_out'high downto (data_out'length/2)) := (others => '0');
+ if byte_s = '1' then
+ if wb_reg.address(0) = '1' then
+ data_out(byte_t'range) := data_out(hword_t'high downto (hword_t'length/2));
+ end if;
+ data_out(hword_t'high downto (hword_t'length/2)) := (others => '0');
+ end if;
+ end if;
+
+
+-- data_out := to_stdlogicvector(to_bitvector(data_out) srl to_integer(unsigned(wb_reg.address(BYTEADDR-1 downto 0)))*byte_t'length);
if (wb_reg_nxt.address(DATA_ADDR_WIDTH+2) /= '1') then
data_addr(DATA_ADDR_WIDTH+1 downto 0) <= wb_reg_nxt.address(DATA_ADDR_WIDTH+1 downto 0);
when EXT_UART_ADDR =>
ext_uart.sel <= enable;
ext_anysel <= enable;
+
-- ext_uart.wr_en <= wb_reg_nxt.dmem_write_en;
-- ext_uart.data <= ram_data;
-- ext_uart.addr <= wb_reg_nxt.address(31 downto 2);
when EXT_7SEG_ADDR =>
ext_7seg.sel <= enable;
ext_anysel <= enable;
+
-- ext_7seg.wr_en <= wb_regdmem_write_en;
-- ext_7seg.data <= ram_data;
-- ext_7seg.addr <= wb_reg_nxt.address(31 downto 2);