Building blocks with 7400 series logic
Building blocks with 7400 series logic
I've been looking around on the web for something like a library with 7400 logic used to perform various functions, like a register or a range comparator circuit (say 8bit, has to be within the range of 0b00110000 and 0b00110011), but I've yet to find something useful. Have you guys any pointers to where they might be or should we actually have a thread with self contained circuit blocks that can be used to do stuff like an ALU, barrel shifter or counter circuit with settable reset on specific values?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Building blocks with 7400 series logic
I guess the days of data books are gone. I'm sure glad I kept my three shelf-feet of National Semiconductor data books. Actually now National has been gobbled up by TI, and TI says, "We already have that part, so we'll replace National's data sheet with our own," and a lot of helpful info is lost, even in their online data sheets. Typical of TI. With real books, it was easier to look up functions like you want. You can try http://www.ti.com/lsds/ti/logic/home_st ... logic.page though. Try the '521 or '688 for the selector you mention.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Building blocks with 7400 series logic
Jokse wrote:
a range comparator circuit (say 8bit, has to be within the range of 0b00110000 and 0b00110011),
ALU 74181 ,add 74182,7483
http://en.wikipedia.org/wiki/List_of_74 ... d_circuits
Re: Building blocks with 7400 series logic
Jokse wrote:
I've been looking around on the web for something like a library with 7400 logic used to perform various functions, like a register or a range comparator circuit (say 8bit, has to be within the range of 0b00110000 and 0b00110011), but I've yet to find something useful. Have you guys any pointers to where they might be or should we actually have a thread with self contained circuit blocks that can be used to do stuff like an ALU, barrel shifter or counter circuit with settable reset on specific values?
Code: Select all
0b00110000
0b00110011
----------
0b001100xx (x= don't care)Code: Select all
______
7 -| |
| |
6 -| |
| NOR o-+
3 -| | |
| | |
2 -|______| |
| ______
+-| |
| |
5 -| AND |-
| |
4 -|______|
6502 sources on GitHub: https://github.com/Klaus2m5
Re: Building blocks with 7400 series logic
Thanks for the suggestions, but I didn't mean a list of 7400 logic, but a library of circuits already predesigned for a specific function. I've already been looking at designing stuff myself and reuse circuit blocks for the same functions across board instead of just reinventing the wheel over and over again, while others might have already accomplished a certain function with a circuit block that could easily be reused.
It could be a standard way to wire up a '374 with one ore more '245s to create a simple 8bit register block that could be used over and over again.
It could be a standard way to wire up a '374 with one ore more '245s to create a simple 8bit register block that could be used over and over again.
Re: Building blocks with 7400 series logic
I'm thinking about building an "SPI interface" using 7400 ICs. I am not sure if it's already done by someone else though. It does not seem to be complex, but the evil is always in details
What I can think, that some standard shift-in, shift-out register parts can solve the problem of generating signal for MOSI and accepting data from MISO. The clocking though can be tricky, if it's need to be "self running" some kind of counter is needed to stop after 8 steps. I am also thinking on a semi-hardware/semi-software solution, when SPI bandwidth/clock is important but not _that_ important. So the two shift registers remains but eg CPU generates the shift clock (still faster than software-only bit banging the SPI bus). I was thinking to use something like SYNC signal of 65C02 to generate clock and the last op (the previous ones can be NOPs) should stop the clocking (ie some kind of flip-flop can be reset with that which is set with the serial shift-out write). However I would like to use 65816 and it does not have SYNC if I remember correctly. I can't decide which would be the best: the block move opcodes would be nice to use to read/write data from/to SPI but it needs more complex interface. I know about 65SPI, but somehow I feel more interesting if I do myself. If I can at all, even with some help
What are your opinions? Thanks.
Re: Building blocks with 7400 series logic
LGB wrote:
The clocking though can be tricky, if it's need to be "self running" some kind of counter is needed to stop after 8 steps.
Re: Building blocks with 7400 series logic
LGB wrote:
What I can think, that some standard shift-in, shift-out register parts can solve the problem of generating signal for MOSI and accepting data from MISO.
To save board space and reduce wiring, a '299 universal shift register could replace both the '595 and the '165. This chip has lots of modes, but most of that can be ignored. Just remember, the mode is always "shift right" except when you're writing to it. That's the only time you need "parallel load" mode. Notice a clock pulse is required when you're writing to it. (Be careful with the bit order. SPI shifts the most-significant bit first. And the '299 document numbers its bits left to right. If you wire the '299 so its I/O0 pin connects to CPU data-bus d0, I/O1 -> d1, I/O2 -> d2 and so on -- not the other way around -- then, according to the '299 doc, the shift required by SPI is called a "shift right.")
LGB wrote:
The clocking though can be tricky, if it's need to be "self running" some kind of counter is needed to stop after 8 steps. I am also thinking on a semi-hardware/semi-software solution
cheers,
Jeff
Last edited by Dr Jefyll on Mon Apr 27, 2015 7:15 pm, edited 1 time in total.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Building blocks with 7400 series logic
nyef wrote:
I'm not too familiar with SPI,
Code: Select all
SPI Mode | Clock Polarity | Clock Edge
| (CPOL/CKP) | (CKE/NCPHA)
----------+------------------+-------------
0 | 0 | 1
1 | 0 | 0
2 | 1 | 1
3 | 1 | 0
and http://wilsonminesco.com/6502primer/pot ... ITBANG_SPI
I never remember which mode is which. I just follow the timing diagrams in the data sheet for each SPI-interfaced IC I use, and it always works.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Building blocks with 7400 series logic
Thanks for the answers!
SPI has 4 different modes, I would implement only "mode 0" since it seems to be the common "language" among almost all of the SPI capable devices I would need. But anyway, all SPI modes has the attribute to have rising or falling edge of the clock to "read" the signal (ie, read or "capture" MISO by the master) and the other (the opposite) edge to "write" the signal (ie, write or "propagate" MOSI level by the master). I am not sure if a single '299 can do this, as it seems to have a single "CP" pin for clock and the truth table only mentions low-to-high transition (= raising edge) for operations. It would be nice since I am not so familiar with more complex 74' parts other than simplier gates, the usual '138 and similar "usual" stuffs for a more-or-less beginner etc
The other problem: as far as I can understand, the '299 has a single register, I can store a value which is shifted out, while the "received" data is shifted in, to replace (?) the original value in the shift register bit-by-bit. However, for some tasks like SD card interfacing I would need to read a block which requires the output of $FF on MOSI while reading data on MISO from the card (well, SPI is full duplex synchronous serial bus after all). Surely, it's not a problem as I can "refill" the shift register $FF after each shift (well, actually it means to keep MOSI on 1 always, so technically it can be solved in a different way too without providing "true" full duplex interface), but it's a performance bottleneck then, and I would lose the ability to use block move opcode of 65816 which is kinda nice (and would allow to put I/O to the non-zero bank (which is nice: simplier address decoding!) without too much performance problem long addressing would mean, because block movement is the same in speed from any bank, if I am correct).
What I thought for I/O possibilities for the CPU, like this (remember, SPI for real does not have read and write mode, always happens the same time so I name that "transfer" for a 8 bit transaction):
CPU read (read on IO-addr-0): shift-in (MISO) result of the previous transfer (but do NOT start a new transfer for now!)
CPU read (read on IO-addr-1): shift-in (MISO) result of the previous transfer AND start a new transfer with the last written shift-out value by the CPU
CPU write (write on IO-addr-0): shift-out register which will be used on the next transfer (but do NOT start a new transfer for now!)
CPU write (write on IO-addr-1): shift-out register AND start a new transfer
So basically CPU R/W would select shift-in or shift-out register and a single bit difference in the I/O address decides that only reading/writing the shift register, or also the start of a new transfer then. SPI would be clocked to have faster than the minimal possible CPU clocks to access the registers again, so no need for busy flag, etc. This seems to be odd (SD card specification for example writes about max of 400KHz clock - or something like that - before card is identified), but eg the SD-card cartridge for Enterprise-128 (Z80 based though, but never mind) has SPI interface implemented in a CPLD clocked at constant 16MHz - so Z80 would never worry about unfinished 8 bit transfer -, and no problem with most SD cards still. Well, here and in my whole post, SD card is only (but important) example to use SPI for, of course, than can be others (like ENC28J60 for ethernet). This interface would need (I guess) at least two shift registers (for "write" and "read") so maybe one '299 is not enough, but seems not to be overcomplicated yet, still. Or whatever
The trick would be that no need for the I/O address of the SPI interface decoded from the LSB of the CPU address actually. It's because block movement opcode in 65816 has the "problem" that both of source and target address is incremented (well, or decremented) after each copy of a byte. Thus, if we need at least read/write (let's say) 512 bytes with block move op in a clean way (fast enough, short code), then at least 512 continual addresses needed for the I/O with the very same purpose (again, with I/O not in bank zero of 65816, it's usually not problem to "waste" addressing space, unless you need 16MByte RAM and minimal "waste" for I/O ... not my case, 512K SRAM would be enough, practical and also cheap).
My post seems to be somewhat eclectic, since I talked about "not so much performance oriented method" (eg with semi-software solution), but somehow I also feel that performance is not a bad thing of course, if it can be got with a little more complexity. The unused ops of 65C02 is a good idea for the other solution, but I would go with the 65816.
I am not sure how dumb ideas I have, so let's just laugh on me
I am really not so experienced but I would like to start to build something at last!! 
SPI has 4 different modes, I would implement only "mode 0" since it seems to be the common "language" among almost all of the SPI capable devices I would need. But anyway, all SPI modes has the attribute to have rising or falling edge of the clock to "read" the signal (ie, read or "capture" MISO by the master) and the other (the opposite) edge to "write" the signal (ie, write or "propagate" MOSI level by the master). I am not sure if a single '299 can do this, as it seems to have a single "CP" pin for clock and the truth table only mentions low-to-high transition (= raising edge) for operations. It would be nice since I am not so familiar with more complex 74' parts other than simplier gates, the usual '138 and similar "usual" stuffs for a more-or-less beginner etc
The other problem: as far as I can understand, the '299 has a single register, I can store a value which is shifted out, while the "received" data is shifted in, to replace (?) the original value in the shift register bit-by-bit. However, for some tasks like SD card interfacing I would need to read a block which requires the output of $FF on MOSI while reading data on MISO from the card (well, SPI is full duplex synchronous serial bus after all). Surely, it's not a problem as I can "refill" the shift register $FF after each shift (well, actually it means to keep MOSI on 1 always, so technically it can be solved in a different way too without providing "true" full duplex interface), but it's a performance bottleneck then, and I would lose the ability to use block move opcode of 65816 which is kinda nice (and would allow to put I/O to the non-zero bank (which is nice: simplier address decoding!) without too much performance problem long addressing would mean, because block movement is the same in speed from any bank, if I am correct).
What I thought for I/O possibilities for the CPU, like this (remember, SPI for real does not have read and write mode, always happens the same time so I name that "transfer" for a 8 bit transaction):
CPU read (read on IO-addr-0): shift-in (MISO) result of the previous transfer (but do NOT start a new transfer for now!)
CPU read (read on IO-addr-1): shift-in (MISO) result of the previous transfer AND start a new transfer with the last written shift-out value by the CPU
CPU write (write on IO-addr-0): shift-out register which will be used on the next transfer (but do NOT start a new transfer for now!)
CPU write (write on IO-addr-1): shift-out register AND start a new transfer
So basically CPU R/W would select shift-in or shift-out register and a single bit difference in the I/O address decides that only reading/writing the shift register, or also the start of a new transfer then. SPI would be clocked to have faster than the minimal possible CPU clocks to access the registers again, so no need for busy flag, etc. This seems to be odd (SD card specification for example writes about max of 400KHz clock - or something like that - before card is identified), but eg the SD-card cartridge for Enterprise-128 (Z80 based though, but never mind) has SPI interface implemented in a CPLD clocked at constant 16MHz - so Z80 would never worry about unfinished 8 bit transfer -, and no problem with most SD cards still. Well, here and in my whole post, SD card is only (but important) example to use SPI for, of course, than can be others (like ENC28J60 for ethernet). This interface would need (I guess) at least two shift registers (for "write" and "read") so maybe one '299 is not enough, but seems not to be overcomplicated yet, still. Or whatever
The trick would be that no need for the I/O address of the SPI interface decoded from the LSB of the CPU address actually. It's because block movement opcode in 65816 has the "problem" that both of source and target address is incremented (well, or decremented) after each copy of a byte. Thus, if we need at least read/write (let's say) 512 bytes with block move op in a clean way (fast enough, short code), then at least 512 continual addresses needed for the I/O with the very same purpose (again, with I/O not in bank zero of 65816, it's usually not problem to "waste" addressing space, unless you need 16MByte RAM and minimal "waste" for I/O ... not my case, 512K SRAM would be enough, practical and also cheap).
My post seems to be somewhat eclectic, since I talked about "not so much performance oriented method" (eg with semi-software solution), but somehow I also feel that performance is not a bad thing of course, if it can be got with a little more complexity. The unused ops of 65C02 is a good idea for the other solution, but I would go with the 65816.
I am not sure how dumb ideas I have, so let's just laugh on me
Last edited by LGB on Mon Apr 27, 2015 9:42 pm, edited 1 time in total.
Re: Building blocks with 7400 series logic
LGB wrote:
I am not sure how dumb ideas I have, so let's just laugh on me
I am really not so experienced but I would like to start to build something at last!! 
LGB wrote:
actually it means to keep MOSI on 1 always, so technically it can be solved in a different way too
Considering these points, using separate shift registers (eg 165 and 595) may be better after all, space-wise. But the '299s is a chip worth studying, given its ability to reconfigure itself for different jobs. It's a classic example of 7400 series MSI logic.
LGB wrote:
I also feel that performance is not a bad thing of course, if it can be got with a little more complexity. The unused ops of 65C02 is a good idea for the other solution, but I would go with the 65816.
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html