Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pseudorandom binary sequence_Error Result Getting in XSDK

Status
Not open for further replies.

Saras015

Banned
Joined
Apr 5, 2017
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
0
Hi,

Implementing "pseudorandom bit sequence generator" in HLS and in XSDK, and using Kintex 705. Since, i have completed the following pocesses like IP creation from HLS, IP integration through Vivado IP integrator, bit_stream generation in Vivado, export hardware and Lunch SDK. But, in SDK i am getting incorrect result while calling the API.

I am getting "0 (zero)" in UART (Tera Terminal). I dont know why. please help me.

I have attached HLS Csim and SDK file.



HLS Source code

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdint.h>
#include <stdio.h>
#include "ap_cint.h"
 
int PRBS_Func(void)
{
 
  #pragma HLS INTERFACE s_axilite port=return bundle=a
   int start_state = 0xCD;     /* Any nonzero start state will work. */
   int lfsr = start_state;
   int bit;                    /*  8bit to allow bit<<7 later in the code */
   unsigned period = 0;
 
   do
{
    /* Using LFSR = taps: 8, 6, 5 and 4; feedback polynomial: x^8+ x^6 + x^5 + x^4 + 1 */
   bit  = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 4) ) & 1;
   lfsr =  (lfsr >> 1) | (bit << 7);
   ++period;
} while (lfsr != start_state);
   return 0;
}



Source Code in SDK

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include "platform.h"
#include "xuartlite.h"
#include "xparameters.h"
#include "xil_printf.h"
#include "stdlib.h"
#include "XPrbs_prj.h"
 
int main()
{
  init_platform();
  u32 Resulth;
  XPrbs_prj PRBS;
  XPrbs_prj  *PRBSPTR=&PRBS;
  XPrbs_prj_Initialize(PRBSPTR,XPAR_PRBS_PRJ_0_DEVICE_ID);
  XPrbs_prj_Start(PRBSPTR);
  while (!XPrbs_prj_IsDone(PRBSPTR));
  Resulth=XPrbs_prj_Get_return(PRBSPTR);
  xil_printf("[hw] Resulth = %d \r\n", Resulth);
  cleanup_platform();
  return Resulth;
}



SDK- Function Header File


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
************************** Function Prototypes *****************************/
#ifndef __linux__
int XPrbs_prj_Initialize(XPrbs_prj *InstancePtr, u16 DeviceId);
XPrbs_prj_Config* XPrbs_prj_LookupConfig(u16 DeviceId);
int XPrbs_prj_CfgInitialize(XPrbs_prj *InstancePtr, XPrbs_prj_Config *ConfigPtr);
#else
int XPrbs_prj_Initialize(XPrbs_prj *InstancePtr, const char* InstanceName);
int XPrbs_prj_Release(XPrbs_prj *InstancePtr);
#endif
 
void XPrbs_prj_Start(XPrbs_prj *InstancePtr);
u32 XPrbs_prj_IsDone(XPrbs_prj *InstancePtr);
u32 XPrbs_prj_IsIdle(XPrbs_prj *InstancePtr);
u32 XPrbs_prj_IsReady(XPrbs_prj *InstancePtr);
void XPrbs_prj_EnableAutoRestart(XPrbs_prj *InstancePtr);
void XPrbs_prj_DisableAutoRestart(XPrbs_prj *InstancePtr);
u32 XPrbs_prj_Get_return(XPrbs_prj *InstancePtr);
 
 
void XPrbs_prj_InterruptGlobalEnable(XPrbs_prj *InstancePtr);
void XPrbs_prj_InterruptGlobalDisable(XPrbs_prj *InstancePtr);
void XPrbs_prj_InterruptEnable(XPrbs_prj *InstancePtr, u32 Mask);
void XPrbs_prj_InterruptDisable(XPrbs_prj *InstancePtr, u32 Mask);
void XPrbs_prj_InterruptClear(XPrbs_prj *InstancePtr, u32 Mask);
u32 XPrbs_prj_InterruptGetEnabled(XPrbs_prj *InstancePtr);
u32 XPrbs_prj_InterruptGetStatus(XPrbs_prj *InstancePtr);
 
#ifdef __cplusplus
}
#endif

 

Attachments

  • HLS_Csim.PNG
    HLS_Csim.PNG
    31.3 KB · Views: 74
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top