The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Simple question about output assignment https://designers-guide.org/forum/YaBB.pl?num=1145567877 Message started by Anexanhume on Apr 20th, 2006, 2:17pm |
Title: Simple question about output assignment Post by Anexanhume on Apr 20th, 2006, 2:17pm Hello all, I am in a FPGA design class right now, and our VHDL/Verilog class is not listed as a prereq, but we have to code with it, so I'm stuck with a rather trivial problem. It's a simple low pass filter, and Xilinx and Icarus alike tell me something along the lines of y not being a register. Perhaps you could tell me what is wrong, and maybe point out some things I did poorly in the code? Thank you very much. Code:
|
Title: Re: Simple question about output assignment Post by jbdavid on Apr 21st, 2006, 1:34am 1 assignments are ALWAYS ON .. so don't put inside any block.. input A; reg re3; output y; assign y = reg3; // whatever value reg3 has y will have FOR ALL TIME!!! always @(posedge clk) begin reg3 = A; end you didn't define mult_const_b1 .. I'm assuming its a function you declare? I dont do FPGA's and try not to do digital w/o at least a V(Vdd) somewhere in the module! <grin> jbd |
Title: Re: Simple question about output assignment Post by Anexanhume on Apr 21st, 2006, 6:08am Ok, so when you say it will have that value for all time, it will also change with its value as well, hence the block that just changes the register? Also, you were corect about the const functions. They are just functions which multiply the operand by a certain constant needed for my filter. I redid the code, and got it to compile like this: Code:
|
Title: Re: Simple question about output assignment Post by jbdavid on Aug 3rd, 2006, 5:53am Yes. the output (a wire) is (in this block) assigned to TAKE its value from the register.. so you can set the value of a register in an always block, but you do the assign before (or AFTER the end of the always block.. Never "inside" |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |