Search found 25 matches
- Mon Jan 08, 2018 2:49 am
- Forum: Emulation and Simulation
- Topic: An Assembler for Xilinx Emulators
- Replies: 0
- Views: 6690
An Assembler for Xilinx Emulators
I've been working on a MOS 6502 core for an 8-bit NES core that I'm putting in a Xilinx 7-Series FPGA. My testbench combines a 64KB block memory with the CPU core. The block memory uses a couple of different input files to specify its initial contents. I had been doing initial programming manually ...
- Sun Nov 05, 2017 7:10 pm
- Forum: Emulation and Simulation
- Topic: Emulation and Testing of Overflow Conditions
- Replies: 7
- Views: 4009
Re: Emulation and Testing of Overflow Conditions
That's right. It's the joy of two's complement: the bit patterns do exactly the same in both cases. Which might also answer your question about overflow: the adder doesn't need to know or do anything about overflow, it just adds. The overflow bit is purely an additional output.
Ok, that helps a ...
Ok, that helps a ...
- Sun Nov 05, 2017 7:02 pm
- Forum: Emulation and Simulation
- Topic: Emulation and Testing of Overflow Conditions
- Replies: 7
- Views: 4009
Re: Emulation and Testing of Overflow Conditions
Thanks Ed.
Two great resources on the 6502 overflow flag:
http://www.6502.org/tutorials/vflag.html
http://www.righto.com/2012/12/the-6502- ... ained.html
Yep, I've read through both of those. In fact, I used the table from Ken Shirriff's blog to help construct the logic for the overflow flag ...
Two great resources on the 6502 overflow flag:
http://www.6502.org/tutorials/vflag.html
http://www.righto.com/2012/12/the-6502- ... ained.html
Yep, I've read through both of those. In fact, I used the table from Ken Shirriff's blog to help construct the logic for the overflow flag ...
- Sat Nov 04, 2017 11:20 pm
- Forum: Emulation and Simulation
- Topic: Emulation and Testing of Overflow Conditions
- Replies: 7
- Views: 4009
Emulation and Testing of Overflow Conditions
Working on a 6502 ALU implementation and wanted to see if I could get another pair of eyeballs on my method of simulating overflow behaviour during an addition operation. In pseudocode, I was planning to use the following:
for A in range(0, 256):
for B in range(0, 256):
carry_in = 1
# Add with ...
for A in range(0, 256):
for B in range(0, 256):
carry_in = 1
# Add with ...
- Sun Aug 20, 2017 5:52 am
- Forum: Emulation and Simulation
- Topic: Updating Processor Status Flags on Emulator
- Replies: 9
- Views: 5229
Re: Updating Processor Status Flags on Emulator
Any '02 data sheet will have that info. For the NMOS 6502, see for example:
6500 Microprocessors (Preliminary) (May 1976) http://6502.org/documents/datasheets/mos/mos_6500_mpu_preliminary_may_1976.pdf
or for 65c02 (which I highly encourage you make your simulator for, because it is far superior to ...
6500 Microprocessors (Preliminary) (May 1976) http://6502.org/documents/datasheets/mos/mos_6500_mpu_preliminary_may_1976.pdf
or for 65c02 (which I highly encourage you make your simulator for, because it is far superior to ...
- Sun Aug 20, 2017 3:25 am
- Forum: Emulation and Simulation
- Topic: Updating Processor Status Flags on Emulator
- Replies: 9
- Views: 5229
Re: Updating Processor Status Flags on Emulator
Klaus2m5 wrote:
Basically every operand going through the ALU must generate flags, every address must not.
- Sat Aug 19, 2017 6:40 am
- Forum: Emulation and Simulation
- Topic: Updating Processor Status Flags on Emulator
- Replies: 9
- Views: 5229
Re: Updating Processor Status Flags on Emulator
The branch, jump, no-op, store, push, and RTS instructions won't affect the status. Something like INX or PLX will make the status apply to the new X register value, while INY or PLY will make the status apply to the new Y register value. Something like INC <absolute> will make it reflect the new ...
- Sat Aug 19, 2017 6:25 am
- Forum: Emulation and Simulation
- Topic: Updating Processor Status Flags on Emulator
- Replies: 9
- Views: 5229
Re: Updating Processor Status Flags on Emulator
My thought was to use an 8-bit mask of some sort to determine what the new value of the P register should be based upon the mask and the value to be stored in the accumulator - then combinatorially generate a new value for the P register that gets registered in at the same time as the accumulator ...
- Sat Aug 19, 2017 5:59 am
- Forum: Emulation and Simulation
- Topic: Updating Processor Status Flags on Emulator
- Replies: 9
- Views: 5229
Updating Processor Status Flags on Emulator
So I've had to uproot and redo a lot of what I had done earlier because I didn't have a sophisticated enough FSM to do more complex addressing modes. I'm sort of at a crossroads when it comes to updating processor status registers with results.
As an example, I am implementing absolute addressing ...
As an example, I am implementing absolute addressing ...
- Mon Jul 31, 2017 1:50 pm
- Forum: Emulation and Simulation
- Topic: Left and Right Shifts and Absolute Addressing
- Replies: 4
- Views: 4237
Re: Left and Right Shifts and Absolute Addressing
Yeah, I completely missed that in the instruction description - for some reason it completely escaped me that I needed to do something with the result. I suppose that's what I deserve working on code at 3:00 AM. I need to go back and modify some of my design now.
- Sun Jul 30, 2017 7:49 am
- Forum: Emulation and Simulation
- Topic: Left and Right Shifts and Absolute Addressing
- Replies: 4
- Views: 4237
Re: Left and Right Shifts and Absolute Addressing
I may have answered my own question - the block diagram for the processor shows the ALU connected to an adder for some reason. Perhaps the ALU needed to use that to add something to the shifted result and then another clock cycle to register it back in the processor?
- Sun Jul 30, 2017 7:41 am
- Forum: Emulation and Simulation
- Topic: Left and Right Shifts and Absolute Addressing
- Replies: 4
- Views: 4237
Left and Right Shifts and Absolute Addressing
I've been working on my processor quite a bit over the last couple days and started implementing the ASL and LSR opcodes using absolute addressing mode. I observed that for other instructions that use the ALU (e.g., ADC) that mode takes 4 clock cycles to complete. Assuming that ASL and LSR are using ...
- Wed Jul 26, 2017 9:15 pm
- Forum: Emulation and Simulation
- Topic: 6502 Emulator in Verilog
- Replies: 19
- Views: 11835
Re: 6502 Emulator in Verilog
I've incorporated the ALU into my design and wrote a simple ROM to reset, do NOP, clear out the accumulator and start counting by 1. Now that I look at it, I think there is a bug in the ALU not clearing the zero bit in the status register. It took me a bit to figure out how to pipeline data through ...
- Tue Jul 18, 2017 5:01 pm
- Forum: Emulation and Simulation
- Topic: 6502 Emulator in Verilog
- Replies: 19
- Views: 11835
Re: 6502 Emulator in Verilog
I'm sure you're right - verification comes after code complete, for this. I don't think this kind of task is a terribly good fit for test-driven design.
Not necessarily test-driven - but writing the verification as you implement each instruction seems to me to be a good approach. But that's just ...
Not necessarily test-driven - but writing the verification as you implement each instruction seems to me to be a good approach. But that's just ...
- Tue Jul 18, 2017 7:16 am
- Forum: Emulation and Simulation
- Topic: 6502 Emulator in Verilog
- Replies: 19
- Views: 11835