- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-09-2012 09:47 AM
I designed a VHDL code that i had linked to a project that i made in XPS, using microblaze as its soft processor. in my vhdl code i only need two inputs, one is the clk and the other is a reset. I designed my vhdl code in a way that when clk is at positive edge and reset is 1 (reset should be at least hold the value for 1 clock cycle), my code will automatically force 5 values sequentially to my output namely data. what i did in the user logic is
--USER logic implementation added here
test_0 : test
port map (
clk => Bus2IP_Clk,
reset => WFIFO2IP_Data(0),
data => IP2RFIFO_Data);
In my C program i did use write function to write value of 1 (incorporate a software delay) then write 0; and 5 read functions
some how i could only read the 5th value 5 times
I'm still new to microblazeand XPS
would really appreciate for some help
Re: MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-09-2012 12:39 PM
What causes the VHDL code to place the next value on data? If it doesn't wait until
the current data is read by hte MicroBlaze, then the behavior would be just as you describe.
-- Gabor
Re: MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-10-2012 10:16 PM
hi thanks for the fast response
i did a little change in the userlogic section to control the clk and reset because the read function can't catch up
simple_regctrl_0 : simple_regctrl
port map (
clk => slv_reg0(0),
reset => slv_reg0(4),
fis_data => slv_reg1);
and my c program
#include "xparameters.h"
#include "xbasic_types.h"
#include "xstatus.h"
#include "test.h"
int main (void) {
Xuint32 i;
Xuint32 temp;
Xuint32 temp1;
for (i=0 ; i<63; i++)
{
TEST_mWriteReg(0xC7400000,0,i);
temp1= TEST_mReadReg(0xC7400000,4);
xil_printf("Read %08x: 0x%08x\n\r", i, temp1);
}
}
and still no luck for the read part, all that has been read showed a value of zero
any advice so that i could read the right values
thanks in advance!
i also attached the verilog file that i had created
Re: MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-11-2012 02:15 AM
Is it always the same number? (Probably not)
Do you understand handshaking and semaphores?
I suggest you add a 'next' input to your userlogic module, driven from the MB.
------------------------------------------
"If it don't work in simulation, it won't work on the board."
Re: MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-13-2012 04:00 AM
I made a clock divider inside the user logic so that it takes 50,000,000 MB clock cycles for the user logic clock to rise, and another 50,000,000 MB clock cycles for the user logic clock to fall. The values on the registers in the user logic need only 1 user logic clock cycle to change to the next value. The MB clock is set to 50MHz. Essentially, we've been able to solve a bit about providing the correct output.
I do not know much about the handshaking and semaphores.
Anyway here's my c code.
#include "xparameters.h"
#include "xbasic_types.h"
#include "xstatus.h"
#include "test.h"
int main (void) {
Xuint32 i;
Xuint32 temp;
Xuint32 temp1;
xil_printf("start test\n\r");
TEST_mReset(0xC7400000);
for(i=0; i<28; i++)
{
xil_printf("host: %x\n\r",TEST_mReadReg(0xC7400000,0));
xil_printf("device: %x\n\r",TEST_mReadReg(0xC7400000,4));
}
}
when i comment one of the xil_printf, for example the host, the device will show correct outputs. But when both xil_printf is not commented out, the outputs become screwed up. For example when i=3, host will print the value for i =3, device will also print the value for i=3, then the next printed value will be for i=5. Somehow it skips the printing for i=4, prints values for i=5, skips printing for i=6, prints values for i=7, skips for i=8 and so on. Is it not possible to use 2 ReadReg functions on a single loop?
Re: MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-13-2012 04:16 AM
Your assignment for this week is to read up on handshaking. Start with Wikipedia and FOLDOC.
http://foldoc.org/handshaking
------------------------------------------
"If it don't work in simulation, it won't work on the board."
Re: MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-13-2012 07:39 PM
Thanks, i'll try to understand the reading as much as i can
Re: MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-14-2012 12:31 AM
Hi i've gone through the handshake discussion that you've suggested, and to solve my problem, i have put an modified my clock divider circuit many times until the correct output is displayed. This was purely due to trial and error. Do you know any data sheet where i can find the specific number of machine cycles required by the microblaze so that the xil_printf function is performed?
Also i used the m_Reset function and the m_readReg functions as well. Where can i find the datasheet where it can tell me the specific amount of machine cycles to perform such functions?
Thanks so much for your previous suggestions and questions. They've really help me a lot in terms of finding a solution for my problems.
Re: MicroBlaze on Virtex 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-14-2012 02:08 AM
Then you haven't really understood it.
The point is to partially decouple the real-time hardware part from the software.
In your case you need a signal controlled by the software to ask the 'test' block for a new item of data to be put on its output port that the software can then (eventually) read. 'test' would detect the rising edge (synchronously - 2 flip-flops and a gate!), and do it.
'reset' is a seriously bad name for such an input, BTW.
------------------------------------------
"If it don't work in simulation, it won't work on the board."











