Verilog Code For Serial Adder Table
’ is not ' (notice the shape difference). Verilog works with the apostrophe character ( ', ASCII 0x27).
Try the following model. I didn’t simulate so it should be buggy by definition, but it might just work The assumption is that the inputs and output are serial and that the adder starts sampling the data inputs on the first rising edge of the cloc.
Your ’ is likely an extended ASCII character. There is also a » character, which I believe should be! I'm guessing you wrote your code in word editor (ex Microsoft Word, LibreOffice Writer, Apple iWork, etc).
These kinds of editors tend to swap ' for ’ while you type because it is more visually appealing for humans. Email clients and some messaging apps tend to do this too. You should always write your code in a plain texted editor or an editor intended for writing code. Emacs and Vim are popular editors for writing code; syntax highlighting plugins are available for both. An IDE, like Eclipse, is another option. Notepad does work as well. I also noticed you used and assign statement on the reg type temp.
Serial Adder Verilog
This is not legal in verilog. Assign statements can only be done on net types (e.g. You may have other compiling errors that will show up after fixing ’ and », the error message will likely be more helpful. The compiler will not flag it, but recommend coding style is to use blocking assignments ( =) inside combination block ( always@(.)), not non-blocking (.