Pulse Counter

Problem #142

Tags: logic

Who solved this?

Previous:DFF


Now we'll take a look at another useful chip - the Pulse Counter. This chip reads how many times its input has been pulsed, and then transmits how many pulses have been received.

     ┌─────────┐        
 P ●─┤         │        
     │         ├─● Y[0] 
 R ●─┤ COUNTER ├─● Y[1] 
     │         ├─● Y[2] 
 D ●─┤         ├─● Y[3] 
     └─────────┘        

The COUNTER chip has 3 input pins named P, R, and D.
The chip will look for Pulses on P.
A rising edge on R will cause the counter to Reset to 0000.
The state of D determines the Direction that the counter will increment. If D = 0 then the chip will count up, otherwise it will count down.
The chip has a 16-bit output named Y, which transmits the total number of rising edges that the P pin has seen since the last time R was pulsed.

If the internal counter counts one above 1111, then it should roll over to 0000.
Likewise if the counter counts one below 0000, then it should roll over to 1111.

The circuit board will come pre-installed with INPUT and OUTPUT chips as shown below:

───────┐                                                   ┌────────
       ├─● P                                               │        
       │                                            Y[0] ●─┤        
 INPUT ├─● P                                        Y[1] ●─┤ OUTPUT 
       │                                            Y[2] ●─┤        
       ├─● D                                        Y[3] ●─┤        
───────┘                                                   └────────

Problem Statement

Digital Logic Circuit Interface
For these Digital Logic Circuits tasks, you will not be providing an answer string you would for other tasks.
Instead, your Solution Code will be interpreted directly to place chips onto the circuitboard and connect them with wires.
Click here to learn the Digital Logic Circuit Syntax used on this site.

After the chips have been placed and connected, the server will run a series of tests, randomly assigning values to the input pin(s) and checking to see if the output pins read the corresponding expected values. If all tests produce the expected outputs, then the circuitboard is considered a success.

Even though we won't be using the "Your answer" box, you'll still need to put something in that box to submit your solution. Just put anything - it will not be passed to the interpreter.

You need to login to get test data and submit solution.