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.

How to get random bit sequence in XSDK through UART from HLS IP

Status
Not open for further replies.

Thaus

Newbie level 3
Joined
Apr 11, 2017
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
66
Hi,

Currently I'm working with Kintex 7, for random bit sequence function. I have created HLS IP for the function, integrated IP with vivado and exported it to SDK.
But in SDK, i am getting only "Single bit" value instead of sequence of random bits in Tera Terminal. I think its showing last bit of sequence in Hardware. Please anyone guide me. What`s wrong in my coding? Need help from anyone.

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <stdint.h>
#include <stdio.h>
#include "ap_cint.h"
 
int PRBS_prj()
{
#pragma HLS INTERFACE s_axilite port=return bundle=a
int start_state = 0xCD;
int lfsr = start_state;
bool bit;
unsigned period = 0;
 
do
{
 /* taps:  3, 2 and 1 ; feedback polynomial:  x^3 + x^2 + 1 */
 bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 4) ) & 1;
 printf("%d", bit);
 lfsr = (lfsr >> 1) | (bit << 7);
 ++period;
 } while (lfsr != start_state);
return bit;
}
 
 
Test Bench
#include <stdint.h>
#include <stdio.h>
#include "ap_cint.h"
int main()
{
int start_state = 0xCD;
int lfsr = start_state;
bool bit;
unsigned period = 0;
PRBS_prj();
do
{
 bit = ((lfsr >> 0) ^ (lfsr >> 2) ^ (lfsr >> 3) ^ (lfsr >> 4) ) & 1;
 printf("%d", bit);
lfsr = (lfsr >> 1) | (bit << 7);
++period;       
} while (lfsr != start_state);
return 0;
 }
 
SDK Source Code
 
#include "xprbs_prj.h"
int main()
{
 init_platform();
 bool Resulth;
 xil_printf("%c[2J",27);
 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 0;
}
 
 
 
************************** 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);[ATTACH=CONFIG]138437._xfImport[/ATTACH][ATTACH=CONFIG]138438._xfImport[/ATTACH][ATTACH=CONFIG]138439._xfImport[/ATTACH]
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

 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top