Mod 8 Counter AHDL Design w/ External Source

  • Thread starter Thread starter lespaul5895
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around designing a mod 8 counter using AHDL for a digital electronics project. The specific requirement is that the counter should remain at the value 7 until an external source signals it to reset or continue counting.

Discussion Character

  • Homework-related
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant shares their initial AHDL code for a mod 8 counter and describes the requirement for the counter to hold at 7.
  • Another participant suggests modifying the IF statement to accommodate the requirement of holding at 7.
  • A different participant proposes that the first IF statement should check if the counter equals 7 to prevent it from counting further, expressing uncertainty about how to implement this in code.
  • One participant encourages further reading on IF statements and conditional logic to aid in the coding process.
  • A later reply presents a revised version of the AHDL code that includes a conditional check for whether the count is less than 7, indicating that it has been simulated and appears to work correctly.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the best approach to implement the required functionality, and there are multiple competing views on how to modify the code effectively.

Contextual Notes

There are unresolved aspects regarding the implementation of the external source signal and how it interacts with the counter's behavior once it reaches 7. Additionally, the participants have not fully clarified the conditions under which the counter should reset or continue counting.

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?
 

Similar threads

Replies
10
Views
5K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 1 ·
Replies
1
Views
8K
  • · Replies 1 ·
Replies
1
Views
28K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
12K
  • · Replies 2 ·
Replies
2
Views
3K