Individual Project Report

Similar documents
LFSRs as Functional Blocks in Wireless Applications Author: Stephen Lim and Andy Miller

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Design for Test. Design for test (DFT) refers to those design techniques that make test generation and test application cost-effective.

Synchronous Sequential Logic

A Pseudorandom Binary Generator Based on Chaotic Linear Feedback Shift Register

Inside Digital Design Accompany Lab Manual

HDL & High Level Synthesize (EEET 2035) Laboratory II Sequential Circuits with VHDL: DFF, Counter, TFF and Timer

Programmable Logic Design I

ENGG2410: Digital Design Lab 5: Modular Designs and Hierarchy Using VHDL

Scanned by CamScanner

Laboratory Exercise 7

Design and Implementation of Encoder for (15, k) Binary BCH Code Using VHDL

CARLETON UNIVERSITY. Facts without theory is trivia. Theory without facts is bull 2607-LRB

VLSI System Testing. BIST Motivation

Why FPGAs? FPGA Overview. Why FPGAs?

2.6 Reset Design Strategy

International Journal of Scientific & Engineering Research, Volume 5, Issue 9, September ISSN

OpenXLR8: How to Load Custom FPGA Blocks

Debugging of Verilog Hardware Designs on Altera s DE-Series Boards. 1 Introduction. For Quartus Prime 15.1

Chapter 4: One-Shots, Counters, and Clocks

LED Array Tutorial. This guide explains how to set up and operate the LED arrays that can be used for your. Internal Structure of LED Array

Design and FPGA Implementation of 100Gbit/s Scrambler Architectures for OTN Protocol Chethan Kumar M 1, Praveen Kumar Y G 2, Dr. M. Z. Kurian 3.

Hardware Modeling of Binary Coded Decimal Adder in Field Programmable Gate Array

Registers and Counters

Microprocessor Design

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 2200

Laboratory 4. Figure 1: Serdes Transceiver

Peak Dynamic Power Estimation of FPGA-mapped Digital Designs

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

ELEC 204 Digital System Design LABORATORY MANUAL

Modeling Latches and Flip-flops

Analysis of Different Pseudo Noise Sequences

Design of Fault Coverage Test Pattern Generator Using LFSR

COMPUTER ENGINEERING PROGRAM

True Random Number Generation with Logic Gates Only

Modeling Digital Systems with Verilog

LFSR Counter Implementation in CMOS VLSI

Sequential Logic Notes

VHDL Design and Implementation of FPGA Based Logic Analyzer: Work in Progress

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Sequential Circuit Design: Principle

Lab #12: 4-Bit Arithmetic Logic Unit (ALU)

DESIGN and IMPLETATION of KEYSTREAM GENERATOR with IMPROVED SECURITY

Instructions. Final Exam CPSC/ELEN 680 December 12, Name: UIN:

Design of BIST with Low Power Test Pattern Generator

FPGA IMPLEMENTATION AN ALGORITHM TO ESTIMATE THE PROXIMITY OF A MOVING TARGET

CSE 352 Laboratory Assignment 3

Design of a Binary Number Lock (using schematic entry method) 1. Synopsis: 2. Description of the Circuit:

Testing Results for a Video Poker System on a Chip

ECSE-323 Digital System Design. Datapath/Controller Lecture #1

Design and Implementation of SOC VGA Controller Using Spartan-3E FPGA

FPGA Implementation of Convolutional Encoder And Hard Decision Viterbi Decoder

Half-Adders. Ch.5 Summary. Chapter 5. Thomas L. Floyd

Laboratory Exercise 7

CS150 Fall 2012 Solutions to Homework 4

[Krishna*, 4.(12): December, 2015] ISSN: (I2OR), Publication Impact Factor: 3.785

CSE140L: Components and Design Techniques for Digital Systems Lab. FSMs. Tajana Simunic Rosing. Source: Vahid, Katz

LAB 3 Verilog for Combinational Circuits

Testing Digital Systems II

Fundamentals of Digital Electronics

S.K.P. Engineering College, Tiruvannamalai UNIT I

Static Timing Analysis for Nanometer Designs

EEM Digital Systems II

Enable input provides synchronized operation with other components

LAB 3 Verilog for Combinatorial Circuits

Traffic Light Controller

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science SOLUTIONS

Hardware Implementation of Viterbi Decoder for Wireless Applications

21.1. Unit 21. Hardware Acceleration

Bit Swapping LFSR and its Application to Fault Detection and Diagnosis Using FPGA

CHAPTER 4 RESULTS & DISCUSSION

EE178 Lecture Module 4. Eric Crabill SJSU / Xilinx Fall 2005

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

Flip-flop and Registers

DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING DIGITAL DESIGN

(12) Patent Application Publication (10) Pub. No.: US 2003/ A1

TEST PATTERN GENERATION USING PSEUDORANDOM BIST

ENGN3213 Digital Systems and Microprocessors Sequential Circuits

FPGA Development for Radar, Radio-Astronomy and Communications

VLSI Design: 3) Explain the various MOSFET Capacitances & their significance. 4) Draw a CMOS Inverter. Explain its transfer characteristics

Chapter 6. sequential logic design. This is the beginning of the second part of this course, sequential logic.

Product Obsolete/Under Obsolescence

Efficient Architecture for Flexible Prescaler Using Multimodulo Prescaler

Performance Evolution of 16 Bit Processor in FPGA using State Encoding Techniques

Figure 1 Block diagram of a 4-bit binary counter

2e 23-1 Peta Bits Per Second (Pbps) PRBS HDL Design for Ultra High Speed Applications/Products

Segmented Leap-Ahead LFSR Architecture for Uniform Random Number Generator

Available online at ScienceDirect. Procedia Technology 24 (2016 )

Optimization of Multi-Channel BCH Error Decoding for Common Cases. Russell Dill Master's Thesis Defense April 20, 2015

Chapter 4. Logic Design

1. Synopsis: 2. Description of the Circuit:

hochschule fu r angewandte wissenschaften hamburg Prof. Dr. B. Schwarz FB Elektrotechnik/Informatik

SEQUENTIAL CIRCUITS SEQUENTIAL CIRCUITS

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

VLSI Test Technology and Reliability (ET4076)

VARIABLE FREQUENCY CLOCKING HARDWARE

Lab Assignment 5 I. THE 4-BIT CPU AND CONTROL

Rice University, ECE. InsBtute of Technology, EECS 1

SRAM Based Random Number Generator For Non-Repeating Pattern Generation

Transcription:

EN 3542: Digital Systems Design Individual Project Report Pseudo Random Number Generator using Linear Feedback shift registers Index No: Name: 110445D I.W.A.S.U. Premaratne

1. Problem: Random numbers are useful in a wide variety of applications. There are basically two types of Random Number Generators, namely True Random Number Generators (TRNG) and Pseudo Random Number Generators (PRNG). True random number generators (TRNG) are slow and expensive while pseudo random number generators (PRNG) suffice for most applications. Although a majority of random number generators have been implemented in software level, increasing demand exists for hardware implementation due to the advent of faster and high density Field Programmable Gate Arrays (FPGA). Verilog language which is used to program FPGAs, also has a built in random Number generator but it can only be used in test benches. So, for a hardware design where random numbers are needed, such as encryption systems, we need a hardware implementation of a random number generator. 2. Solution: There are two main methods used to generate random numbers. Using a physical process: Measuring results of some physical phenomena which produces random results such as thermal noise and atmospheric noise generates true random numbers, since these are completely unpredictable. Using computational algorithms: Take an initial short value using which random results are generated. This method produces pseudo random numbers the algorithm might produce the same number sequence after a period of time. What matters is making that period as large as possible. Most pseudo random number generating algorithms, such as the most widely used PRNG - Mersenne twister method, involve complex mathematical operations which are not suitable to be implemented on hardware. Linear Feedback Shift Register based method is a less complex method that can be implemented in hardware. Hence the solution chosen was to implement a pseudo random number generator in hardware level using LFSRs. 3. Methodology: LFSR can be specified by means of a characteristic polynomial which is also called the feedback polynomial. Polynomial determines the width and the repeatability of random numbers. For most optimum solution feedback items (taps) should be selected such that maximum length sequence occurs. Maximum length sequence is the sequence of length 2 n 1 produced by n length registers. A LFSR is maximal length if an only if the following conditions are met. Number of taps should be even Set of taps taken altogether must be relatively prime.

For our convenience Xilinx has provided a table of appropriate taps for maximum length LFSR counters upto 168 bits, in their application note xapp052. Figure 1: Maximum length sequence generating LFSR

For a LFSR of 4 bits, Taps = 4, 3 Number of states = 2 4 1 = 15 Characteristic polynomial = x 4 + x 3 + 1 Figure 2: 4 Bit LFSR Here 1 is given as the initial value, from which the number sequence is initiated. 0001 1001 0101 1000 1100 1010 0011 0100 0110 1101 0111 0010 1011 1110 1111 Figure 3: State diagram of 4 bit LFSR For a number generator of 4 decimal digits, number of bits = 13 Therefore taps = 13, 4, 3, 1 Number of states = 2 13 1 = 8191 State diagram will have 8191 different states and is difficult to graphically represent. Characteristic polynomial = x 13 + x 4 + x 3 + 1 Figure 4: 13 bit LFSR

4. Simulation Results and Test bench Separate modules were used for LFSR and seven segment display. LFSR module is the top module. module lfsr( input clock, input reset, output a, output b, output c, output d, output e, output f, output g, output dp, output [3:0] an ); //------------Internal Variables-------- reg [12:0] out = 0; wire linear_feedback; //-------------XNOR each tap output with previous tap------- assign linear_feedback =! (!(!(out[12] ^ out[3])^out[2])^out[0]); reg [24:0] delay; //register to produce the delay in number generation wire test; always @ (posedge clock or posedge reset) begin if (reset) delay <= 0; else delay <= delay + 1; assign test = &delay; //AND each bit of delay with itself; test will be high only when //all bits of delay are high always @(posedge test or posedge reset) if (reset) begin // active high reset out <= 13'b0 ; else begin out <= {out[11],out[10], out[9],out[8], out[7],out[6], out[5],out[4], out[3],out[2], out[1],out[0],linear_feedback}; sseg S(.clock(clock),.reset(reset),.out(out),.a(a),.b(b),.c(c),.d(d),.e(e),.f(f),.g(g),.dp(dp),.an(an)); module

module sseg( input clock, input reset, input [12:0] out, output a, output b, output c, output d, output e, output f, output g, output dp, output [3:0] an ); reg[3:0] ones, tens, hundreds, thousands=0; /*Binary to BCD conversion of state_out*/ // Internal variable reg [28:0] shift; integer i; always @(*) begin // Clear previous and store new number in shift register shift[28:13] = 0; shift[12:0] = out; // Loop eight times for (i=0; i<13; i=i+1) begin if (shift[16:13] >= 5) shift[16:13] = shift[16:13] + 3; if (shift[20:17] >= 5) shift[20:17] = shift[20:17] + 3; if (shift[24:21] >= 5) shift[24:21] = shift[24:21] + 3; if (shift[28:25] >= 5) shift[28:25] = shift[28:25] + 3; // Shift entire register left once shift = shift << 1; // Push decimal numbers to output thousands = shift[28:25]; hundreds = shift[24:21]; tens = shift[20:17]; ones = shift[16:13]; /*7 segment multiplexing*/ localparam N = 18; reg [N-1:0]count; always @ (posedge clock or posedge reset) begin if (reset) count <= 0; else count <= count + 1; reg [6:0]sseg; reg [3:0]an_temp; always @ (*) begin case(count[n-1:n-2]) 2'b00 : begin sseg = ones; an_temp = 4'b1110; 2'b01: begin sseg = tens; an_temp = 4'b1101; 2'b10: begin sseg = hundreds; an_temp = 4'b1011; 2'b11: begin sseg = thousands; an_temp = 4'b0111; case assign an = an_temp; reg [6:0] sseg_temp; always @ (*) begin case(sseg) 4'd0 : sseg_temp = 7'b1000000; //0 4'd1 : sseg_temp = 7'b1111001; //1 4'd2 : sseg_temp = 7'b0100100; //2 4'd3 : sseg_temp = 7'b0110000; //3 4'd4 : sseg_temp = 7'b0011001; //4 4'd5 : sseg_temp = 7'b0010010; //5 4'd6 : sseg_temp = 7'b0000010; //6 4'd7 : sseg_temp = 7'b1111000; //7 4'd8 : sseg_temp = 7'b0000000; //8 4'd9 : sseg_temp = 7'b0010000; //9 default : sseg_temp = 7'b0111111; //dash case assign {g, f, e, d, c, b, a} = sseg_temp; assign dp = 1'b1; module

Test bench: module lfsr_rng_test; // Inputs reg clock; reg reset; // Outputs wire a; wire b; wire c; wire d; wire e; wire f; wire g; wire dp; wire [3:0] an; // Instantiate the Unit Under Test (UUT) lfsr uut (.clock(clock),.reset(reset),.a(a),.b(b),.c(c),.d(d),.e(e),.f(f),.g(g),.dp(dp),.an(an) ); initial begin // Initialize Input clock = 0; reset = 0; #10 reset = 1; #10 reset = 0; always #10 clock =!clock; module

Clock and an register values change too fast. Delay register was shortened to 15 bits for simulation so that number generation will be faster than in hardware implementation, because if not, a limit on number of transitions that can be stored in waveform database (.wdb) file will be reached and waveform tracing will be stopped. Figure 5: Simulation window

4. Synthesized Circuit and Net list User constraints file (.ucf) contents # Pin assignment for pushbutton switches NET "reset" LOC = "a7"; # Pin assignment for 7-segment displays NET "a" LOC = "l14" ; NET "b" LOC = "h12" ; NET "c" LOC = "n14" ; NET "d" LOC = "n11" ; NET "e" LOC = "p12" ; NET "f" LOC = "l13" ; NET "g" LOC = "m12" ; NET "dp" LOC = "n13" ; NET "an<3>" LOC = "k14"; NET "an<2>" LOC = "m13"; NET "an<1>" LOC = "j12"; NET "an<0>" LOC = "f12"; # Pin assignment for clock NET "clock" LOC = "b8"; Figure 6: RTL schematic

Figure 7: Technology Schematic

Figure 10: Netlist

Figure 9: Project summary