lfsr

Pseudo Random Number Generator using LFSR in VHDL

廉价感情. 提交于 2019-12-10 12:16:45
问题 I'm having a bit of trouble creating a prng using the lfsr method. Here is my code: library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity pseudorng is Port ( clock : in STD_LOGIC; reset : in STD_LOGIC; Q : out STD_LOGIC_VECTOR (7 downto 0); check: out STD_LOGIC); constant seed: STD_LOGIC_VECTOR(7 downto 0) := "00000001"; end pseudorng; architecture Behavioral of pseudorng is signal temp: STD_LOGIC; signal Qt: STD_LOGIC_VECTOR(7 downto 0); begin PROCESS(clock) BEGIN IF rising_edge(clock) THEN IF

Efficient bit-fiddling in a LFSR implementation

旧城冷巷雨未停 提交于 2019-11-30 21:18:47
Although I have a good LSFR C implementation I thought I'd try the same in Haskell - just to see how it goes. What I came up with, so far, is two orders of magnitude slower than the C implementation, which begs the question: How can the performance be improved? Clearly, the bit-fiddling operations are the bottleneck, and the profiler confirms this. Here's the baseline Haskell code using lists and Data.Bits : import Control.Monad (when) import Data.Bits (Bits, shift, testBit, xor, (.&.), (.|.)) import System.Environment (getArgs) import System.Exit (exitFailure, exitSuccess) tap :: [[Int]] tap

Efficient bit-fiddling in a LFSR implementation

我是研究僧i 提交于 2019-11-30 05:17:36
问题 Although I have a good LSFR C implementation I thought I'd try the same in Haskell - just to see how it goes. What I came up with, so far, is two orders of magnitude slower than the C implementation, which begs the question: How can the performance be improved? Clearly, the bit-fiddling operations are the bottleneck, and the profiler confirms this. Here's the baseline Haskell code using lists and Data.Bits : import Control.Monad (when) import Data.Bits (Bits, shift, testBit, xor, (.&.), (.|.)