On Tuesday, December 13, 2022 at 7:13:24 PM UTC-4, SpainHackForth wrote:
> > > > I'm curious as to what you think this assignment will do in hardware that results from this code.
> > > Not sure how to take your request, it’s just assigning a temp space for register temp… <Size>’<base><number>
> > I'm asking an honest question. Verilog is an HDL, Hardware Description Language. It is used to "describe" hardware in terms of it's actions. What exactly do you think that assignment does in terms of an action. "assigning a temp space" has no meaning in hardware.
> >
> > I'm trying to understand how you are visualizing Verilog. I'm guessing that you don't actually have much understanding of the nature of the hardware produced.
> >
> > "Assigning a space" is something done in Verilog by declaring the signal, or whatever they call them in Verilog. I'm more conversant in VHDL which has signals and variables. Both can be thought of as "wires" with defined logic states. But most of the states possible in the default types have some states that are not actually realizable in hardware. They are mostly used to show results of poor logic design.
> >
> > Not try to be rude or anything. I'm just trying to figure out if I can help you in any way.
> Again, not sure how to take your request, I’m very conscious of overly apologetic conversations when I don’t see a reason for it, it raises a high level of suspicion on my end, so not really sure why you are apologizing?
There are some real whackos in this group, so I'm trying to not be condescending by trying to teach you something you don't need or want to learn. Some people here are set off very easily, and would find that highly offensive.
> As clearly stated… I’m learning Verilog, so I don’t have a deep understanding of the language nor do I claim to be a subject matter expert.
>
> Please feel free to “show” me what the line does?
> I’m always open to an opportunity to learn, hence my original questions.
In terms of hardware synthesis, it does nothing useful, unless you want temp to be a tri-state bus. If implementing in a modern FPGA, there are no tri-state buses, so not a good idea. The only other use is to flag that the contents of that register are invalid, as you say, but it makes no sense for the designer to set that value. In fact, I think the more appropriate value would be 'x', but, as I said, I'm much more conversant in VHDL, so I'm not sure of all the values available, or what is best. Verilog may not have all the same choices as VHDL.
> In the mean time, I can share with you my understanding… "zzzz_zzzz" is a placeholder value that indicates an unknown or undefined state. It is often used in Verilog code as a default value for registers or other variables when their actual value is not known or not relevant. In the code you provided, "zzzz_zzzz" is assigned to the "temp" register in several cases where the value of the "temp" register is not used or is not important.
I guess my question would be, why is temp undefined or unknown at the times you are assigning z's?
The code you've written in the always block should specify an assignment in every part of the code, unless you want that signal to hold it's previous value. This would be implemented by using a clock enable.
Just to make sure we are on the same foot, assignments in a clocked always clause, define a register. If the register output is not defined in any flow through the always block, it will have a clock enable to be disabled in that condition.
> Here, let me explain what i’m trying to do and by al means, show me a sample VHDL of how accomplish the following:
>
> I’m just building a simple program counter…. 3 bit mode, a clock, a pc_value and a temp value… If mode is 010 i assign the pc_value to the data bus, if the mode is 000 I value to 0’s set temp z’ s else if mode is 001 I set value to the bus and temp so z’ s, and if 010 again does nothing * has been set in first case, else if mode changes 011 and temp is set to z’s and if mode is 100, value reg is incremented to 1…. block waits for raising edge to execute each instruction…
I never see temp set to a value other than z's. It would appear to have no valid assignment, so no valid value, ever. In addition, temp is never used by any other logic. So even if it were assigned a value, it would be optimized away by the tools, unless you turn off that feature (discarding useless logic, i.e. no outputs).
So we can ignore temp in understanding what this code does.
When pc_mode is zero, initialize pc_value to 0
When pc_mode is one, set pc_value from data_bus
When pc_mode is four, set pc_value to pc_value + 1
That's it. Seems like a reasonable set of operations for a program counter if you are limiting it to simple jumps, or calculating the address elsewhere for more complex jumps.
> I’ve implemented this on a read board about 10 times playing with my kids… all it takes is a 555 and a 4027 (from memory).
I don't know what a "read board" is. I'm not sure how a 555 timer and a pair of FFs could implement this design. You would need four 4027 chips for the pc_value register. You would also need an adder for the increment operation, or some gates to implement half adders. Oh, and mux chips to switch the load between data_bus and pc_value + 1.
Is any of this useful? Any questions? Or am I missing the point entirely? Is there some use for temp which has not been coded yet?
--
Rick C.
-- Get 1,000 miles of free Supercharging
-- Tesla referral code -
https://ts.la/richard11209