diff --git a/programs/timer_blinky.prog b/programs/timer_blinky.prog index 651226f..46d9a8b 100644 --- a/programs/timer_blinky.prog +++ b/programs/timer_blinky.prog @@ -21,7 +21,8 @@ timer_status_addr: .word 0x000F000C dmem_start_addr: .word 0x00000400 dmem_end_addr: .word 0x000004FC priority_mask: .word 0xFFFFFF03 -timer_target_value: .word 127 // change for simulation / real board +// timer_target_value: .word 127 // for simulation +timer_target_value: .word 65536 // for real board main: // Initialize stack pointer to the end of the data memory diff --git a/soc/peripheral/switches.vhd b/soc/peripheral/switches.vhd index d1070ff..4826a1e 100644 --- a/soc/peripheral/switches.vhd +++ b/soc/peripheral/switches.vhd @@ -38,8 +38,10 @@ begin data <= (others=>'0'); else if wslvi.stb = '1' and wslvi.cyc = '1' then - data(15 downto 0) <= switches; - data(20 downto 16) <= buttons; + if wslvi.we='0' then + data(15 downto 0) <= switches; + data(20 downto 16) <= buttons; + end if; if ack = '0' then ack <= '1'; diff --git a/soc/testbench/switches_tb.vhd b/soc/testbench/switches_tb.vhd index 61f63b5..b93c07e 100644 --- a/soc/testbench/switches_tb.vhd +++ b/soc/testbench/switches_tb.vhd @@ -57,15 +57,25 @@ BEGIN switches <= "1001000101010111"; wait for CLK_PERIOD; - data <= (others => '0'); generate_sync_wb_single_read(slvi,slvo,clk,data); wait for 2 ns; - data <= (others => '0'); generate_sync_wb_single_read(slvi,slvo,clk,data); + + buttons <= "11011"; + switches <= x"DEAD"; + wait for 10 ns; + + generate_sync_wb_single_read(slvi,slvo,clk,data, SIZE => "00"); -- Single byte + + wait for 10 ns; + + generate_sync_wb_single_read(slvi,slvo,clk,data, SIZE => "01"); -- Half word + + wait for 100 ns; - wait; + assert false report "Simulation terminated!" severity failure; end process stimuli; END ARCHITECTURE;