2
\$\begingroup\$

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;
\$\endgroup\$
  • 1
    \$\begingroup\$ You also need to decode the write_strobe. The address bus is not valid in every cycle. \$\endgroup\$ – Paebbels Aug 15 '15 at 12:15
1
\$\begingroup\$

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
\$\endgroup\$
  • \$\begingroup\$ I did what you asked me to, put an endless loop but now i see nothing on the output line, it should go high once but the line is dead! \$\endgroup\$ – alexhilton Aug 15 '15 at 8:22
  • \$\begingroup\$ Have you tried running a simulation? \$\endgroup\$ – Nils Pipenbrinck Aug 15 '15 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.