help with digital circuit

Thread Starter

David_Baratheon

Joined Feb 10, 2012
285
Here is the error message:

ispLEVER Auto-Make Log File
--------------------------

Updating: Compile Logic
Start to record tcl script...
Finished recording TCL script.

Starting: 'C:\ispLEVER_Classic1_6\ispcpld\BIN\ahdl2blf.exe "studentidtobcdinabel.abl" -mod StudentIDtoBCDinABEL -ojhd compile -def _PLSI_ _LATTICE_ -imp -err automake.err -gui'


AHDL2BLF ABEL-HDL Processor
ispLEVER Classic 1.6 Copyright(C), 1992-2005, Lattice Semiconductor Corporation. All rights reserved
Portions Copyright(c), 1992-1999, Vantis Corporation
Portions Copyright(C), 1993-1998, Data I/O Corporation
Portions Copyright(C), 1997-1998, MINC Washington Corporation
Portions Copyright(C), Alan Phillips, Lancaster University Computer Centre 1992-1998
Module: 'StudentIDtoBCDinABEL'


0009 |a, b, c, d pin 1,2,3,4; "Outputs" istype 'com'; "Outputs"
^
Warning 1070:In "studentidtobcdinabel.abl":9:pin number 1 is already declared as 'Two'.

0009 |a, b, c, d pin 1,2,3,4; "Outputs" istype 'com'; "Outputs"
^
Warning 1070:In "studentidtobcdinabel.abl":9:pin number 2 is already declared as 'ZeroA'.

0009 |a, b, c, d pin 1,2,3,4; "Outputs" istype 'com'; "Outputs"
^
Warning 1070:In "studentidtobcdinabel.abl":9:pin number 3 is already declared as 'ZeroB'.

0009 |a, b, c, d pin 1,2,3,4; "Outputs" istype 'com'; "Outputs"
^
Warning 1070:In "studentidtobcdinabel.abl":9:pin number 4 is already declared as 'ThreeA'.

0009 |a, b, c, d pin 1,2,3,4; "Outputs" istype 'com'; "Outputs"
^
Syntax Error 1041: In "studentidtobcdinabel.abl":9:Keyword 'istype' is out of context.

0011 |In_s = [Two, ZeroA, ZeroB, ThreeA, Four, ThreeB, Seven, Six]; "8-bit number"
^
Syntax Error 1028: In "studentidtobcdinabel.abl":11:EQUATIONS, STATE_DIAGRAM, TRUTH_TABLE or END expected.

Module 'studentidtobcdinabel' processing complete.

AHDL2BLF complete - 2 errors, 4 warnings. Time: 1 seconds

Done: failed with exit code: 0001.
 

thatoneguy

Joined Feb 19, 2009
6,359
"Input pins
Two, ZeroA, ZeroB, ThreeA, Four, ThreeB, Seven, Six pin 1,2,3,4,5,6,7,8; "Inputs"

"Output pins
a, b, c, d pin 1,2,3,4; "Outputs" istype 'com'; "Outputs"
You are telling it to use the same pin for inputs AND outputs, which cannot be mapped, unless you add a latch and Tri state.
 

Thread Starter

David_Baratheon

Joined Feb 10, 2012
285
Module: 'StudentIDtoBCDinABEL'


0009 |a, b, c, d pin 9,10,11,12; "Outputs" istype 'com'; "Outputs"
^
Syntax Error 1041: In "studentidtobcdinabel.abl":9:Keyword 'istype' is out of context.

0011 |In_s = [Two, ZeroA, ZeroB, ThreeA, Four, ThreeB, Seven, Six]; "8-bit number"
^
Syntax Error 1028: In "studentidtobcdinabel.abl":11:EQUATIONS, STATE_DIAGRAM, TRUTH_TABLE or END expected.

Module 'studentidtobcdinabel' processing complete.

AHDL2BLF complete - 2 errors, 0 warnings. Time: 1 seconds

Done: failed with exit code: 0001.
 

thatoneguy

Joined Feb 19, 2009
6,359
I know less about ABEL than you, my only exposure has been in this thread.

The errors seem to be asking for a state machine explained in the language using the correct keywords. The syntax error means you are using a keyword in the wrong place. Keywords and order of descriptions are one of the big quirks that are very application specific.

My only suggestion would be to try to look at the ABEL output from a previously designed system that DID work, and that should get you most of the way there if you can understand it.

I talked to google about it, and found This page

This is also not a tutorial of the ABEL language; perhaps the best way to learn ABEL is to look at and modify existing ABEL files.
 

Thread Starter

David_Baratheon

Joined Feb 10, 2012
285
Ok to be honest I've struggled with ABEL in the past and even shifted my project to schematic design so I think ABEL will be out of the question.

Is there any way of using the software i downloaded to find out whats wrong?
 

thatoneguy

Joined Feb 19, 2009
6,359
Open Logisim, lay out the gates the same way you did in the schematic capture in earlier post.

Then set inputs high or low, and see if the outputs match your desired behavior.

If the outputs don't match the expected behavior, break up the units to smaller blocks to ensure what you are attempting is "Logically correct".

There's an intro/howto on Logisim on Youtube, just search for "Using Logisim" or "Intro to logisim" on youtube for a visual walk through. Most that use the schematic capture method of programming are visually oriented in learning as well, so I won't point you at a wall of text to read. :)
 

Thread Starter

David_Baratheon

Joined Feb 10, 2012
285
Do you know of any tried and tested circuits where 1 bit can become BCD?

E.g. if you had a 9 button key pad, you only have one bit coming from the keypad, but you want that bit to trigger 4 bits of numerical information e.g. if you press a 4, the button 4 sends a signal which then triggers the BCD form of 4 (0100). Do you know of any logical ways to do this without using HDL?
 

thatoneguy

Joined Feb 19, 2009
6,359
Do you know of any tried and tested circuits where 1 bit can become BCD?

E.g. if you had a 9 button key pad, you only have one bit coming from the keypad, but you want that bit to trigger 4 bits of numerical information e.g. if you press a 4, the button 4 sends a signal which then triggers the BCD form of 4 (0100). Do you know of any logical ways to do this without using HDL?
No. 1 bit can convey 2 states of information, true or false, there isn't a way to expand that out UNLESS you are aware of the origin of the bit, such as keypad location to map into BCD.

If you write out the truth table for a 4x4 matrix keypad (4 rows, 4 columns), you can then make the logic based on those 8 bits of information as to which number is being pressed. Actually, it can be done with fewer, but that should get you started.

Without a way to determine the significance/magnitude/location of a bit in a byte, it is an impossible transformation.
 

Thread Starter

David_Baratheon

Joined Feb 10, 2012
285
yes but is it possible to have some logic that says if keypad1 = true, BCD = 0001, if keypad2 = true, BCD = 0010 etc?

A way of converting a single signal into a bit BCD signal
 

thatoneguy

Joined Feb 19, 2009
6,359
yes but is it possible to have some logic that says if keypad1 = true, BCD = 0001, if keypad2 = true, BCD = 0010 etc?

A way of converting a single signal into a bit BCD signal
Yes, if you have the position of the bit, padded with zeros and unique, it is a simple lookup table to be built, rather than a series of logic gates.

The 7 segment and hex LED drivers are essentially masked ROMs where each unique input binary "address" goes to a lookup table and the "data" at that address is put on the output pins with enough current to drive an LED segment. That is a more efficient implementation than an equivalent logic circuit to light the correct segments.
 

Thread Starter

David_Baratheon

Joined Feb 10, 2012
285
Is it possible to implement it with gates though as I'm having difficulty with HDL and unfortunately I won't be able to learn it before the deadline
 

thatoneguy

Joined Feb 19, 2009
6,359
If you are looking at a 3x3 keypad, you should have 6 bits output.

You will be missing 1 number in 0-9, so 4x3 would be the minimum for a matrix output.

Define either rows as Most significant nybble or columns as most significant, concatenate the least significant to the end, so you will end up with 7 wires (4 row wires + 3 column wires, V+ connected to other side of all wires).

This would give you a 7 bit output in the form of RRRRCCC

Assuming only one button will be pressed at any given time, you only need to write logic to give an output when one R bit and one C bit are True.

Following the idea, using the RRRRCCC format of the wires, 1000100 would be the key for 1, or 0001 in BCD, 1000010 would be 2, or 0010, etc.

The only requirement is the inputs are unique so they map to a specific output. This can be done with either gates or a LUT. This Logisim .circ File should get you started :) Copy the code, save it as BCD-7Seg.circ, and open it in Logisim to see how BCD is decoded to drive a 7 segment display. Your logic will be similar, transforming keypad to BCD. Write out the truth table for the 7 bits and what the 4 outputs should be. Then decide what combination of gates would be needed to realize those outputs for the given inputs.

You could go further with this to test if more than one R bit or C bit is true, meaning more than one key was pressed at the same time, and producing no output due to the unknown state.

Here is a video on the concepts
 
Last edited:

absf

Joined Dec 29, 2010
1,968
yes but is it possible to have some logic that says if keypad1 = true, BCD = 0001, if keypad2 = true, BCD = 0010 etc?

A way of converting a single signal into a bit BCD signal
Yes but the inputs and outputs of 74HC147 are all active low. If you want a "H" for true then just add an inverter on each of the i/p and o/p.

Or you can use the circuit that you've designed. Should work too. But you cannot combine all the outputs of the inverters together if they are not "open collector/drain". And you need a pull-up resistor on the o/p of the open-collector inverters. May be it is allowed in HDL as long as you defined the outputs as "wired OR".

See my attached schematic, I added a 74HC367 with an "enable" input so you can have hi-impedance outputs when no key is selected. But it is optional anyway.

Allen
 

Attachments

Last edited:

WBahn

Joined Mar 31, 2012
30,077
Logical Error 3509: Output 'd' in upper-level source 'studentidtobcd' can't be redriven to functional_block 'g_output'
I've only skimmed all the responses, so perhaps I missed something, but I didn't see that the fundamental problem was ever truly resolved. As Ron_H pointed out, there are signals that are driven from multiple sources. This issue is strongly indicated by the error message when it says that signals can't be "redriven" by some other block.

I saw where the OP said that this was what he wanted, but I'm not convinced he understands what he is asking for in saying that. Let's take an example.

If the output from I28 is HI, what should the output of I57 be? What should the signal 'd' be?

If the output from I24 is LO, what should the output of I53 be? What should the signal 'd' be?

If the answer to these questions are not all the same, then there is a problem since all of these questions refer to the same signal which can only take on a single value.

Now, if the block represented by I57 and I53 are intended to be open-collector (or otherwise can pull the ouput only HI or LO, but not both and is high impedance for the other) then the problem is probably that the schematic capture tool is not reflecting this hehavior for the pins involved.
 
Top