PS4a

Home Assignments Lecture Blog Resources Discussion Group

Linear Feedback Shift Register (part A)

We'll be completing the linear feedback shift register assignment described at http://www.cs.princeton.edu/courses/archive/fall13/cos126/assignments/lfsr.html.

For this portion of the assignment, you will:

  • implement the LFSR class
  • implement unit tests using the Boost test framework.

Details

Please do the following:

  • Install Boost or use the CS cluster. See http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/ for an introduction to installing and using Boost.
  • Per the Princeton assignment, implement the LFSR class, with the following methods:
    • constructor which accepts a String of 1s and 0s and a tap position;
    • step() function of zero args which returns an int that will be a zero or a one;
    • generate(int k) function that returns a k–bit integer;
    • an overload of the << stream insertion operator to display its current register value in printable form (see these instructions)
The implementation should be contained in files named LFSR.cpp and LFSR.hpp.
  • A number of unit tests in Boost, in a file test.cpp. Here is a starter file for your tests: Attach:test.cpp. (This will be discussed further on Monday.)
  • Create a Makefile or include short, direct instructions for how to build your project.

Submit instructions

Submit your code files test.cpp, LFSR.cpp, and LFSR.hpp plus your Makefile or make instructions. If you additionally have a main.cpp file with some printf-style tests, you may include that too:

submit fredm 204-ps4a files

Grading rubric

Note: A main file is not required for this assignment.

FeatureValueComment
core implementation4full & correct implementation=4 pts; nearly complete=3pts; part way=2 pts; started=1 pt
Makefile2Makefile or explicit build/link instructions included
your own test.cpp2should have at least 3 test cases for full credit
Total8