The question in my textbook was:
Design and implement a Serial 2’s Complementer with a Shift Register and a flip–flop. The binary number is shifted out from one side and it’s 2’s complement shifted into the other side of the shift register.
I got the solution but I was curious to know the Verilog implementation of it. How do I do that? circuit diagram
This is the solution.
EDIT: my actual circuit diagram. My circuit diagram
-
\$\begingroup\$ Why is your output fed back to the input? \$\endgroup\$Shashank V M– Shashank V M2020年11月11日 14:44:29 +00:00Commented Nov 11, 2020 at 14:44
-
\$\begingroup\$ Where did you get your solution from? \$\endgroup\$Shashank V M– Shashank V M2020年11月11日 14:48:49 +00:00Commented Nov 11, 2020 at 14:48
-
\$\begingroup\$ @ShashankVM because they have asked to \$\endgroup\$Savannah Madison– Savannah Madison2020年11月16日 11:09:20 +00:00Commented Nov 16, 2020 at 11:09
-
\$\begingroup\$ @ShashankVM i did that because i dont have a good quality cam to take the pic of my circuit. \$\endgroup\$Savannah Madison– Savannah Madison2020年11月16日 13:54:10 +00:00Commented Nov 16, 2020 at 13:54
-
1\$\begingroup\$ If you feedback, what happens is that: Suppose I load 1010 initially, I will get 0110 serially, which is fed back to the input Then I get 1010 serially at output, which is fed back again. It goes 1010, 0110, 1010, 0110 .... Ah maybe this is the intention. \$\endgroup\$Mitu Raj– Mitu Raj2020年11月16日 16:57:42 +00:00Commented Nov 16, 2020 at 16:57
1 Answer 1
ESE doesn't promote free coding service, we can only guide. You already have the circuit with you. So look at it and try to code structurally for example -
- Design a simple shift register which is loadable with a parallel binary data (tons of references in google).
- Design a D flip-flop module with reset (basics).
- Instantiate and integrate both of them in a top module.
- Just map the signals between your shift register and flip-flop as shown in the figure, imagine them as wires and how you would connect these two hardwares on a breadboard.
Otherwise, understand the functionality and code the complete circuit in behaviour model. You can do design this in Verilog in many ways.
-
\$\begingroup\$ It would be the binary number whose 2's compliment is serially output if this is implemented using a PISO shift register. \$\endgroup\$Mitu Raj– Mitu Raj2020年11月16日 14:30:18 +00:00Commented Nov 16, 2020 at 14:30
-
\$\begingroup\$ The circuit shows serial output has to be fed back to the input. So tell me what you will do if I want to find the 2's compliment of say no. "1010"? How will you feed it to the shift register in this scenario? \$\endgroup\$Mitu Raj– Mitu Raj2020年11月16日 14:38:55 +00:00Commented Nov 16, 2020 at 14:38
-
1\$\begingroup\$ Otherwise, the circuit given by @Savannah has to be wrong. Feed input serially. Take the 2's compliment out serially. No feed back as shown in her circuit. \$\endgroup\$Mitu Raj– Mitu Raj2020年11月16日 14:42:02 +00:00Commented Nov 16, 2020 at 14:42
-
\$\begingroup\$ Yes, I also feel the circuit is wrong. Apparently the OP copied it from here, on page 3. ece.uwaterloo.ca/~msachdev/ECE223/… \$\endgroup\$Shashank V M– Shashank V M2020年11月16日 14:43:11 +00:00Commented Nov 16, 2020 at 14:43
-
1\$\begingroup\$ @MituRaj Thanks for the guidelines.I will try to code and post my code here. \$\endgroup\$Savannah Madison– Savannah Madison2020年11月16日 15:50:02 +00:00Commented Nov 16, 2020 at 15:50
Explore related questions
See similar questions with these tags.