Verilog Custom Core To Read and Write From RAM

I want to add a custom verilog core to an already established pipeline of microblaze. The core should be able to read data from memory locations from DDR RAM (external) which is already present on PLB, process it i.e add to value of data and replace the data it has read with the new processed data. In short i want to add certain constant number to data on RAM in a parallel fashion,(video frame) and write back to those very locations.

Please guide me how should i go about. Should i create a custom peripheral?

Should i use FSL?

As i am new in this field kindly guide me!

Thank You

I am using Xilinx Spartan3E 1600.

With ISE and XPS 10.1 sp1

--------------------------------------- Posted through

formatting link

Reply to
aibk01
Loading thread data ...

You can just do this with the Microblaze processor. Just read the value from memory, do what you want with it and then write it back. If you need to do it faster than this then you would need to write a custom IP block to interface with the PLB bus that could read and write from memory.

Jon

--------------------------------------- Posted through

formatting link

Reply to
maxascent

Well i am trying to do the very same thing but i am having problems in writing the user_logic file as i am accustomed only to verilog. Even in verilog the custom_core.vhd file is in VHDL. I am having problems if any one can guide me on that.

How should i manage, i have already put two registers in the core, one for reading data and other for writing.

Now can u guide me in configuring it so that it can read and write data.(verilog part)

Reply to
Ali Iqbal

writing the user_logic file as i am accustomed only to verilog. Even in verilog the custom_core.vhd file is in VHDL. I am having problems if any one can guide me on that.

reading data and other for writing.

data.(verilog part)

When you generate a custom core in EDK, set the check box to create a Verilog template for the user logic. You can then write your logic in Verilog.

Jon

--------------------------------------- Posted through

formatting link

Reply to
maxascent

Well i selected the Verilog thing and it generated user_logic in Verilog.

But now what i want to write to one register and read after adding a constant value to it. (I have used to registers). What do i do with the sample code. Should i delete or modify it. But How kindly guide.

i can post the code if it helps:

//---------------------------------------------------------------------------- // user_logic.v - module //---------------------------------------------------------------------------- // //

*************************************************************************** // ** Copyright (c) 1995-2008 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. ** // ** ** // *************************************************************************** // //---------------------------------------------------------------------------- // Filename: user_logic.v // Version: 1.00.a // Description: User logic module. // Date: Wed Jul 06 11:20:21 2011 (by Create and Import Peripheral Wizard) // Verilog Standard: Verilog-2001 //---------------------------------------------------------------------------- // 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_" //----------------------------------------------------------------------------

module user_logic ( // -- ADD USER PORTS BELOW THIS LINE --------------- // --USER ports added here // -- ADD USER PORTS ABOVE THIS LINE ---------------

// -- DO NOT EDIT BELOW THIS LINE ------------------ // -- Bus protocol ports, do not add to or delete Bus2IP_Clk, // Bus to IP clock Bus2IP_Reset, // Bus to IP reset Bus2IP_Data, // Bus to IP data bus Bus2IP_BE, // Bus to IP byte enables Bus2IP_RdCE, // Bus to IP read chip enable Bus2IP_WrCE, // Bus to IP write chip enable IP2Bus_Data, // IP to Bus data bus IP2Bus_RdAck, // IP to Bus read transfer acknowledgement IP2Bus_WrAck, // IP to Bus write transfer acknowledgement IP2Bus_Error // IP to Bus error response // -- DO NOT EDIT ABOVE THIS LINE ------------------ ); // user_logic

// -- ADD USER PARAMETERS BELOW THIS LINE ------------ // --USER parameters added here // -- ADD USER PARAMETERS ABOVE THIS LINE ------------

// -- DO NOT EDIT BELOW THIS LINE -------------------- // -- Bus protocol parameters, do not add to or delete parameter C_SLV_DWIDTH = 32; parameter C_NUM_REG = 2; // -- DO NOT EDIT ABOVE THIS LINE --------------------

// -- ADD USER PORTS BELOW THIS LINE ----------------- // --USER ports added here // -- ADD USER PORTS ABOVE THIS LINE -----------------

// -- DO NOT EDIT BELOW THIS LINE -------------------- // -- Bus protocol ports, do not add to or delete input Bus2IP_Clk; input Bus2IP_Reset; input [0 : C_SLV_DWIDTH-1] Bus2IP_Data; input [0 : C_SLV_DWIDTH/8-1] Bus2IP_BE; input [0 : C_NUM_REG-1] Bus2IP_RdCE; input [0 : C_NUM_REG-1] Bus2IP_WrCE; output [0 : C_SLV_DWIDTH-1] IP2Bus_Data; output IP2Bus_RdAck; output IP2Bus_WrAck; output IP2Bus_Error; // -- DO NOT EDIT ABOVE THIS LINE --------------------

//---------------------------------------------------------------------------- // Implementation //----------------------------------------------------------------------------

// --USER nets declarations added here, as needed for user logic

// Nets for user logic slave model s/w accessible register example reg [0 : C_SLV_DWIDTH-1] slv_reg0; reg [0 : C_SLV_DWIDTH-1] slv_reg1; wire [0 : 1] slv_reg_write_sel; wire [0 : 1] slv_reg_read_sel; reg [0 : C_SLV_DWIDTH-1] slv_ip2bus_data; wire slv_read_ack; wire slv_write_ack; integer byte_index, bit_index;

// --USER logic implementation added here

// ------------------------------------------------------ // Example code to read/write user logic slave model s/w accessible registers // // Note: // The example code presented here is to show you one way of reading/writing // software accessible registers implemented in the user logic slave model. // Each bit of the Bus2IP_WrCE/Bus2IP_RdCE signals is configured to correspond // to one software accessible register by the top level template. For example, // if you have four 32 bit software accessible registers in the user logic, // you are basically operating on the following memory mapped registers: // // Bus2IP_WrCE/Bus2IP_RdCE Memory Mapped Register // "1000" C_BASEADDR + 0x0 // "0100" C_BASEADDR + 0x4 // "0010" C_BASEADDR + 0x8 // "0001" C_BASEADDR + 0xC // // ------------------------------------------------------

assign slv_reg_write_sel = Bus2IP_WrCE[0:1], slv_reg_read_sel = Bus2IP_RdCE[0:1], slv_write_ack = Bus2IP_WrCE[0] || Bus2IP_WrCE[1], slv_read_ack = Bus2IP_RdCE[0] || Bus2IP_RdCE[1];

// implement slave model register(s) always @( posedge Bus2IP_Clk ) begin: SLAVE_REG_WRITE_PROC

if ( Bus2IP_Reset == 1 ) begin slv_reg0

Reply to
aibk01

To help us keep accurate statistics, are you a lazy student or a clueless would-be hobbyist?

--------------------------------------- Posted through

formatting link

Reply to
RCIngham

You need to first understand how the IPIF works. You can't just expect someone to learn it for you. Once you have the knowledge then it is simple to write your code in Verilog or VHDL.

Jon

--------------------------------------- Posted through

formatting link

Reply to
maxascent

Neither a lazy student nor a hobbyist

I am a student. It is easier to critique than to help some one. It was a easy question. I have not asked you to write down a code for me just asked "Will I be requiring the sample code or can i replace it with my own like in Usual verilog codes".

I want really appreciate some help here.

--------------------------------------- Posted through

formatting link

Reply to
aibk01

Thank you Jon i will read about the IPIF for both PLB/OPB which ever i can use.If i face any problem i will ask. Thanks again

--------------------------------------- Posted through

formatting link

Reply to
aibk01

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.