Mod 8 Counter AHDL Design w/ External Source

  • Thread starter Thread starter lespaul5895
  • Start date Start date
AI Thread Summary
The discussion focuses on designing a mod 8 counter using AHDL that holds at 7 until an external signal resets it. The initial code provided was functional but needed modification to prevent counting beyond 7. A suggested solution involves adding a conditional statement to check if the count is less than 7 before incrementing. The revised code successfully implements this logic and has been simulated with positive results. Overall, the conversation emphasizes understanding conditional statements in AHDL for effective counter design.
lespaul5895
Messages
7
Reaction score
0
I'm working on a project for my digital electronics class and part of it is designing a mod 8 counter using AHDL, I have the counter designed no problem but the only catch is the counter once it reaches the number 7 should stay there and not start over until an external source tells it to.

here's my code so far
SUBDESIGN mod8_counter
(
CLK, CLR :INPUT;
Y[2..0] :OUTPUT;
)

VARIABLE
count[2..0] :DFF;

BEGIN
count[].clk = clk;
IF !CLR THEN
count[] = count[] + 1;
END IF;
Y[] = count[];
END;
 
Engineering news on Phys.org
IF !CLR THEN
count[] = count[] + 1;
END IF;
Seems like that's the part you need to modifiy the IF on, eh?
 
I'm getting that my first if statement should be something to the effect of telling it that if y = 7 then it stays there else it will count up to 7 but I have no idea how to do that code, probably something easy but I'm still kinda new to this and I'm sure I'm just overlooking it.
 
You're on the right track. Just do some more reading about IF statements and other conditional statements.
 
SUBDESIGN mod8_counter
(
CLK, CLR :INPUT;
Y[2..0] :OUTPUT;
)

VARIABLE
count[2..0] :DFF;

BEGIN
count[].clk = clk;
IF !CLR THEN
IF count[] < 7 THEN
count[] = count[] + 1;
ELSE count[] = count[];
END IF;
END IF;
Y[] = count[];
END;

How's that look? I simulated and it seems to work ok?
 
Hey guys. I have a question related to electricity and alternating current. Say an alien fictional society developed electricity, and settled on a standard like 73V AC current at 46 Hz. How would appliances be designed, and what impact would the lower frequency and voltage have on transformers, wiring, TVs, computers, LEDs, motors, and heating, assuming the laws of physics and technology are the same as on Earth?
I used to be an HVAC technician. One time I had a service call in which there was no power to the thermostat. The thermostat did not have power because the fuse in the air handler was blown. The fuse in the air handler was blown because there was a low voltage short. The rubber coating on one of the thermostat wires was chewed off by a rodent. The exposed metal in the thermostat wire was touching the metal cabinet of the air handler. This was a low voltage short. This low voltage...
Thread 'Electromagnet magnetic field issue'
Hi Guys We are a bunch a mechanical engineers trying to build a simple electromagnet. Our design is based on a very similar magnet. However, our version is about 10 times less magnetic and we are wondering why. Our coil has exactly same length, same number of layers and turns. What is possibly wrong? PIN and bracket are made of iron and are in electrical contact, exactly like the reference design. Any help will be appreciated. Thanks. edit: even same wire diameter and coil was wounded by a...
Back
Top