2

I am running a simple picoblaze code where I am using two addresses and sending a high strobe on both the addresses, the assembly code has no loop, so technically my code should run ONLY once but the high signal on the addresses that I am using is coming continuously. I used an oscilloscope to check the output. I am posting the Glue Logic and the pico code. I am using a Spartan3 Xc3s1000-4fg456 fpga board.

Anyone here has any idea what I am doing wrong here? Here is the pico code

;**************************************************************************************
; OUT Port definition
;**************************************************************************************
CONSTANT sx1,           16
CONSTANT sx2,           20
;**************************************************************************************
; Special Register usage
;***********************************************************************************
NAMEREG SE,     TEMP1
NAMEREG SD,     TEMP2

OUTPUT  TEMP1,      sx1
OUTPUT  TEMP2,      sx2

And the vhdl code for the glue logic is

 library IEEE;
 use IEEE.STD_LOGIC_1164.ALL;
 use IEEE.NUMERIC_STD.ALL;


entity Glue_Logic is
PORT    (
        CLK         :IN         STD_LOGIC;
        RESET       :IN         STD_LOGIC;
        DATA_IN_P   :IN         STD_LOGIC_VECTOR(7 DOWNTO 0);
        PORT_ADDR   :IN         STD_LOGIC_VECTOR(7 DOWNTO 0);

        PORT_OUT1   :OUT        STD_LOGIC_VECTOR(7 DOWNTO 0);
        PORT_OUT2   :OUT        STD_LOGIC_VECTOR(7 DOWNTO 0)
        );
end Glue_Logic;

architecture Behavioral of Glue_Logic is

signal port_out1_s          :STD_LOGIC_VECTOR   (7 downto 0);
signal port_out2_s          :STD_LOGIC_VECTOR   (7 downto 0);

begin

                            PORT_OUT1   <= port_out1_s; 
                            PORT_OUT2   <= port_out2_s; 

process(reset, clk)

begin
    if (reset = '1') then
        port_out1_s                 <= (others => '0');
        port_out2_s                 <= (others => '0');

    elsif (clk'event and clk = '1') then

        case (port_addr) is

            when x"16"          =>

                port_out2_s             <=      x"01";

            when x"20"          =>

                port_out1_s             <=      x"01";

            when others     =>

                port_out1_s             <= (others => '0');
                port_out2_s             <= (others => '0');


            end case;
end if;
end process;
end Behavioral;
Roh
  • 4,598
  • 6
  • 41
  • 86
alexhilton
  • 529
  • 2
  • 8
  • 16

1 Answers1

1

The problem is, that your program doesn't really end. After you've executed your two instructions the picoblaze will continue executing. Eventually the instruction pointer will overrun and your program restarts from address zero.

You need a way to halt your picoblaze. You can either do this by adding additional logic to gate the clock or put an endless loop at the end of your code like this:

;**************************************************************************************
; OUT Port definition
;**************************************************************************************
    CONSTANT sx1,           16
    CONSTANT sx2,           20
;**************************************************************************************
; Special Register usage
;***********************************************************************************
    NAMEREG SE,     TEMP1
    NAMEREG SD,     TEMP2

    OUTPUT  TEMP1,      sx1
    OUTPUT  TEMP2,      sx2

End:
    JUMP    End
Nils Pipenbrinck
  • 5,087
  • 1
  • 19
  • 28