Microblaze FSL peripheral problem

Hello All! We are newbies to FPGAs and VHDL. We're doing a project on it and we need to have custom hardware for it. We then settled for the FSL solution. We are just starting to work on it.. We wanted to have a very primitive ALU kind of a thing. We set out editing the a template file generated when we create a new peripheral on XPS (We use EDK7.1), which gets 8 input words and returns their sum. We modified the VHDL code to want to it to work this way: get an opcode, get two operands and return the sum or difference based on the opcode. Something kind of this: if(opcode == ) return a+b; else return a * b; But its not working. We tried out many things, but in vain. I'm copy-n-paste-ing the VHDL code here and also the C file. Please help us figure out the problem:

------------------------------------------------------------------------------

-- MyIP - entity/architecture pair

------------------------------------------------------------------------------

--

--

***************************************************************************

-- ** Copyright (c) 1995-2005 Xilinx, Inc. All rights reserved. **

-- ** **

-- ** Xilinx, Inc. **

-- ** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" **

-- ** AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND **

-- ** SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, **

-- ** OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, **

-- ** APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION **

-- ** THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, **

-- ** AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE **

-- ** FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY **

-- ** WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE **

-- ** IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR **

-- ** REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF **

-- ** INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS **

-- ** FOR A PARTICULAR PURPOSE. **

-- ** **

-- ** YOU MAY COPY AND MODIFY THESE FILES FOR YOUR OWN INTERNAL USE SOLELY **

-- ** WITH XILINX PROGRAMMABLE LOGIC DEVICES AND XILINX EDK SYSTEM OR **

-- ** CREATE IP MODULES SOLELY FOR XILINX PROGRAMMABLE LOGIC DEVICES AND **

-- ** XILINX EDK SYSTEM. NO RIGHTS ARE GRANTED TO DISTRIBUTE ANY FILES **

-- ** UNLESS THEY ARE DISTRIBUTED IN XILINX PROGRAMMABLE LOGIC DEVICES. **

-- ** **

--

***************************************************************************

--

------------------------------------------------------------------------------

-- Filename: MyIP

-- Version: 1.00.a

-- Description: Example FSL core (VHDL).

-- Date: Mon Mar 13 20:23:40 2006 (by Create and Import Peripheral Wizard Wizard)

-- VHDL Standard: VHDL'93

------------------------------------------------------------------------------

-- Naming Conventions:

-- active low signals: "*_n"

-- clock signals: "clk", "clk_div#", "clk_#x"

-- reset signals: "rst", "rst_n"

-- generics: "C_*"

-- user defined types: "*_TYPE"

-- state machine next state: "*_ns"

-- state machine current state: "*_cs"

-- combinatorial signals: "*_com"

-- pipelined or register delay signals: "*_d#"

-- counter signals: "*cnt*"

-- clock enable signals: "*_ce"

-- internal version of output port: "*_i"

-- device pins: "*_pin"

-- ports: "- Names begin with Uppercase"

-- processes: "*_PROCESS"

-- component instantiations: "I_"

------------------------------------------------------------------------------

library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all;

-------------------------------------------------------------------------------------

--

--

-- Definition of Ports

-- FSL_Clk : Synchronous clock

-- FSL_Rst : System reset, should always come from FSL bus

-- FSL_S_Clk : Slave asynchronous clock

-- FSL_S_Read : Read signal, requiring next available input to be read

-- FSL_S_Data : Input data

-- FSL_S_CONTROL : Control Bit, indicating the input data are control word

-- FSL_S_Exists : Data Exist Bit, indicating data exist in the input FSL bus

-- FSL_M_Clk : Master asynchronous clock

-- FSL_M_Write : Write signal, enabling writing to output FSL bus

-- FSL_M_Data : Output data

-- FSL_M_Control : Control Bit, indicating the output data are contol word

-- FSL_M_Full : Full Bit, indicating output FSL bus is full

--

-------------------------------------------------------------------------------

------------------------------------------------------------------------------

-- Entity Section

------------------------------------------------------------------------------

entity MyIP is port ( -- DO NOT EDIT BELOW THIS LINE --------------------- -- Bus protocol ports, do not add or delete. FSL_Clk : in std_logic; FSL_Rst : in std_logic; FSL_S_Clk : out std_logic; FSL_S_Read : out std_logic; FSL_S_Data : in std_logic_vector(0 to 31); FSL_S_Control : in std_logic; FSL_S_Exists : in std_logic; FSL_M_Clk : out std_logic; FSL_M_Write : out std_logic; FSL_M_Data : out std_logic_vector(0 to 31); FSL_M_Control : out std_logic; FSL_M_Full : in std_logic -- DO NOT EDIT ABOVE THIS LINE --------------------- );

attribute SIGIS : string; attribute SIGIS of FSL_Clk : signal is "Clk"; attribute SIGIS of FSL_S_Clk : signal is "Clk"; attribute SIGIS of FSL_M_Clk : signal is "Clk";

end MyIP;

------------------------------------------------------------------------------

-- Architecture Section

------------------------------------------------------------------------------

-- In this section, we povide an example implementation of ENITY MyIP

-- that does the following:

--

-- 1. Read all inputs

-- 2. Add each input to the contents of register 'sum' which

-- acts as an accumulator

-- 3. After all the inputs have been read, write out the

-- content of 'sum' into the output FSL bus NUMBER_OF_OUTPUT_WORDS times

--

-- You will need to modify this example or implement a new architecture for

-- ENTITY MyIP to implement your coprocessor

architecture EXAMPLE of MyIP is

-- Total number of input data. constant NUMBER_OF_INPUT_WORDS : natural := 3;

-- Total number of output data constant NUMBER_OF_OUTPUT_WORDS : natural := 1;

type STATE_TYPE is (Idle, Read_Operands, Write_Outputs);

signal state : STATE_TYPE;

-- Accumulator to hold sum of inputs read at any point in time signal sum : std_logic_vector(0 to 31); signal op : std_logic_vector(0 to 31);

-- Counters to store the number inputs read & outputs written signal nr_of_reads : natural range 0 to NUMBER_OF_INPUT_WORDS - 1; signal nr_of_writes : natural range 0 to NUMBER_OF_OUTPUT_WORDS - 1;

-- Stack definition starts ======================= -- The Stack constant MAXSTACK:INTEGER := 256; -- the max stack file length type stack_file is array (MAXSTACK-1 downto 0) of std_logic_vector(0 to 31); -- 256 entry stack. signal TheStack : stack_file;

-- Stack variables and pointers signal sp : std_logic_vector ( 0 to 8-1 ) := (others=>'0') ; -- the stack pointer signal localStart : std_logic_vector ( 0 to 8-1 ) := (others=>'0') ; signal argsStart : std_logic_vector ( 0 to 8-1 ) := (others=>'0') ;

type StackState is (CTRL, DATA, ARGSDATA, LDLOCS); signal nextState : StackState := CTRL; -- first to start with: Ctrl signal.

-- Stack definition ends =========================

begin -- CAUTION: -- The sequence in which data are read in and written out should be -- consistant with the sequence they are written and read in the -- driver's MyIP.c file

FSL_S_Read

Reply to
dotnetters
Loading thread data ...

...

This sounds to me to be a pure VHDL problem. -> comp.lang.vhdl

You seek for a pure combinational solution (add, mul, mux) and post a code of a state machine, which is sequential. What do you want? ;-)

Do your try to get something running by modifying examples so that it fits your requirements? I would not recommend this. Use examples as ideas and guidelines, but write your own code.

Wouldn't it be a good idea to post a _minimal example_ of your problem?

Ralf

Reply to
Ralf Hildebrandt

Ralf, Sorry, we were right from the start doubtful whether this was the right group to ask for clarification. But since we had problems with FSL, which was more to the MicroBlaze side, we thought it would be fine to do so.. And obviously, we were wrong.. Anyway, thanks.

Cheers, everyone..

-- DotNetters

Reply to
dotnetters

Your first VHDL looks wrong ...

You put :

FSL_S_Read We are newbies to FPGAs and VHDL. We're doing a project on it and we

-------------------------------------------------------------------------------------

Reply to
Sylvain Munaut

Can you explore "not working as intended"?

The C code looks a little strange. You write on FSL channel 0 but read on FSL channel 1. Is that how you have connected the FSL accelerator to MicroBlaze?

Göran Bilski

snipped-for-privacy@gmail.com wrote:

-------------------------------------------------------------------------------------

Reply to
Göran Bilski

Hello All, especially Sylvian and Goran!! As i had pointed out, we were quite new to VHDL and had a few hiccups while trying it out for the first time. We figured out the problems ourselves. The code was simply just incorrect. We've learnt to overcome that..

Thanks a lot, everyone!!

-- DotNetters

Reply to
dotnetters

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.