Cypress技术论坛
直播中

王妍炜

7年用户 248经验值
私信 关注
[问答]

PSoC 3伪随机序列PRC问题

你好,
我在我的一个项目中使用PRS 2组件来生成一步一步的伪随机值。
该组件被配置为具有单周期和单步API模式的种子值0xFFFFFFF的32位分辨率(32, 30, 26,25)。
初始化是通过以下方式完成的:
下面的代码行是一步一步迭代的:
(sBuffer-[0])(Unti8)(SnBuffel&App:0x000),SunButo[[ 2 ] ]=(UTIN 8)((BNPCR>GT;8)和0x000×0.00 FF);SeNdBuff[1 ]=(UTIN 8)((BNPCR>GT;16)和0x000 000 FFF);SeNdBuff[0 ]=(UITN8)((BNPCR>GT;24)和0x000×00 FFF);UIT32 32 BNPCR= PRSY1I读数4);
因此,我从USB发送的移位寄存器中得到二进制值。然后在二进制编码中显示值(每行4字节,左MSB):
(1):10111001111111111111111111α(2):0101011111111111111111111(3):010101111111111111111111110,4:110 1011111111111111111111100,5:111010011111111111111111111001,6:100101111111111111111111110011α7:011011111111111111111100100111 8α0:11111111111111111111111111111111011011111111111111111111001110 #九:11110001111111111111111110011101 #十:10100101111111111111111100111011 # 11: 00001101111111111111111001110111 # 12: 00011011111111111111110011101110 # 13: 00110111111111111111100111011100 #十四:15:11011111111111111110011101110000 01101111111111111111001110111000 ## 16:17:11111 001111111111100111011100001 # 10110101111111111001110111000011 # 18:00101101111111100011101110000111 # 19:01011011111111000111011100001110 # 20:10110111111110011110111000011100…
在我的理解看来,每一步,一位是从转移到LSB的一面。但是MSB部分的5…7比特是什么??伪随机值应该从一个到下一步的shiftet新位相等呢?
有人能帮助我吗?)
拜伊
弗兰兹

以上来自于百度翻译


     以下为原文
   Hello,
    i'am using the prs 2.0 component in one of my projects to generate step by step pseudo random values.
     
    The component is configured as 32bit Resolution (32, 30, 26, 25) with seed value 0xFFFFFFFF in single cycle and single step API mode.
    Initialization is done trough:
     PRS_1_Start();    An following lines of code are step by step iterated:
     uint32 binprc = PRS_1_Read();  SendBuffer[3] = (uint8)(binprc & 0x000000FF);  SendBuffer[2] = (uint8)((binprc>>8) & 0x000000FF);  SendBuffer[1] = (uint8)((binprc>>16) & 0x000000FF);  SendBuffer[0] = (uint8)((binprc>>24) & 0x000000FF);   USBUART_1_Write(SendBuffer, 4);  PRS_1_Step();     
    So I get the binary values from the shift register sent through u***. The values are then displayed in binary coding (each line a step of 4 bytes, left MSB):
     
     #0: 11111111111111111111111111111111   #1: 10111001111111111111111111111111   #2: 00110101111111111111111111111111   #3: 01101011111111111111111111111110   #4: 11010111111111111111111111111100   #5: 11101001111111111111111111111001   #6: 10010101111111111111111111110011   #7: 01101101111111111111111111100111   #8: 11011011111111111111111111001110   #9: 11110001111111111111111110011101  #10: 10100101111111111111111100111011  #11: 00001101111111111111111001110111  #12: 00011011111111111111110011101110  #13: 00110111111111111111100111011100  #14: 01101111111111111111001110111000  #15: 11011111111111111110011101110000  #16: 11111001111111111100111011100001  #17: 10110101111111111001110111000011  #18: 00101101111111100011101110000111  #19: 01011011111111000111011100001110  #20: 10110111111110011110111000011100    ...
    For my understanding it looks like that with each step one bit comes shifted in from the l*** side. But what are the 5..7 Bits in the MSB part?? Pseudo random values should be equal from one to the next step up to the shiftet in new bit?
     
    Can anybody help me :)
    Bye
    Franz

回帖(8)

王琳

2019-4-15 12:49:26
嗨,弗兰兹,
对我们来说,看看整个项目(或一个工作实例)总是比较容易的。
你介意吗?
第一清洁工程
第二档案(最小和压缩)
第三上传到这里
我来看看。
鲍勃

以上来自于百度翻译


     以下为原文
  Hi Franz,
    it is always easier for us to have a look at the complete project (or a working example).
    Would you mind to
    1st Clean project
    2nd Archive (minimal and compressed)
    3rd upload here
     
    I'll have a look at it.
    Bob
举报

王琳

2019-4-15 13:05:40

所观察到的行为(从MSB到LSB的比特移位)是定义这些伪随机数序列的算法的一部分。
这意味着:
数字不是随机数
数字序列满足随机数序列的数学测试。
当显示为二进制值时,移位变得明显,但是当显示为小数时,“伪”会被隐藏。
所以我的问题是:你想用那个数字序列做什么?
或者你只需要一个(一些)随机数?
鲍勃

以上来自于百度翻译


     以下为原文
  and
    the watched behaveour (shifting in bits from MSB into LSB) is part of the defined algorithm to generate those Pseudo-Randomnumber-Sequence.
    That implies:
    The numbers are not random-numbers
    The sequence of the numbers fulfills a math test for a random-number sequence.
     
    When displayed as binary values, the shifts become obvious, but when displayed as decimals, the "pseudo" gets a bit hidden.
    So my question is: What do you want to do with that Sequence of numbers?
    Or do you just need a (some) Random-number(s)?
    Bob
举报

王妍炜

2019-4-15 13:15:11
好吧,好像误解了…
从右侧移位(LSB侧)是正确的行为(典型的LFSR)。我的问题是左边的5个.7位(MSB边)没有正确的移位。我不知道他们是从哪里来的。
我期待:
α0:11111111
α1:1111111 N
α2:111111
α3:11111 NNN
α3:1111NNNN
“N”是一个伪随机移位在新的位每次。每次MSB位移出MSB侧。
我需要这个来解码一个提取的序列。也许我可以打包一个剥离版本的项目,并上传到这里。
谢谢你的帮助。

以上来自于百度翻译


     以下为原文
   Ok it seems to missunderstood...
     
    The shifted in bit from the right side (l*** side) is the correct behaviour (typical LFSR). My Problem is the 5..7Bits on the left side (m*** side) that doesn't shift correctly. I do not know where they come from.
     
    I expect:
    #0: 11111111
    #1: 1111111n
    #2: 111111nn
    #3: 11111nnn
    #3: 1111nnnn
    ...and so on with "n" is one pseudo random shifted in new bit each time. Ane each time a MSB bit is shifted out on the MSB side.
     
    I need this for decoding a fetched sequence. Maybe I can pack a stripped version of the project and upload it here.
     
    Thanks for your help.
举报

王妍炜

2019-4-15 13:24:31
或者上面的例子:
(1):11111111111111111111111111(2):11111111111111111111111111,3:11111111111111111111111111 0,0:4:11111111111111111111111111 00 00α:111111111111111111111111111 001 6 6:111111111111111111111111110011 0011 7:11111111111111111111111111占星虫:α0:111111111111111111111111111111111111111111111111111111 001110α9(1111111111111111111111 0011101 0011101):1111111111111111111111 00111011α11:1111111111111111111111 001110111 001110111 12:1111111111111111111111 0011101110 13 13:11111111111111111111 00111011100 00111011100 14:11111111111111111111 00111011100α(16):111111111111111111,00111011100001,17:11111111111111111,001110111000011,18,111111111111111,00011101110000111,19,11111111111111,000111011100001110,000111011100001110:希望对我有帮助。谢谢。

以上来自于百度翻译


     以下为原文
   Or with the example above:
     
    #0: 11111111111111111111111111111111  #1: 11111111111111111111111111111111  #2: 11111111111111111111111111111111  #3: 11111111111111111111111111111110  #4: 11111111111111111111111111111100  #5: 11111111111111111111111111111001  #6: 11111111111111111111111111110011  #7: 11111111111111111111111111100111  #8: 11111111111111111111111111001110  #9: 11111111111111111111111110011101  #10: 11111111111111111111111100111011  #11: 11111111111111111111111001110111  #12: 11111111111111111111110011101110  #13: 11111111111111111111100111011100  #14: 11111111111111111111001110111000  #15: 11111111111111111110011101110000  #16: 11111111111111111100111011100001  #17: 11111111111111111001110111000011  #18: 11111111111111100011101110000111  #19: 11111111111111000111011100001110  #20: 11111111111110011110111000011100   I hope will help. Thanks. 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分