memory: remove unused functions
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
		
							
								
								
									
										26
									
								
								src/bus.cc
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								src/bus.cc
									
									
									
									
									
								
							@@ -1,4 +1,5 @@
 | 
			
		||||
#include "bus.hh"
 | 
			
		||||
#include "util/log.hh"
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
namespace matar {
 | 
			
		||||
@@ -17,21 +18,38 @@ Bus::write_byte(size_t address, uint8_t byte) {
 | 
			
		||||
 | 
			
		||||
uint16_t
 | 
			
		||||
Bus::read_halfword(size_t address) {
 | 
			
		||||
    return memory->read_halfword(address);
 | 
			
		||||
    if (address & 0b01)
 | 
			
		||||
        glogger.warn("Reading a non aligned halfword address");
 | 
			
		||||
 | 
			
		||||
    return memory->read(address) | memory->read(address + 1) << 8;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Bus::write_halfword(size_t address, uint16_t halfword) {
 | 
			
		||||
    memory->write_halfword(address, halfword);
 | 
			
		||||
    if (address & 0b01)
 | 
			
		||||
        glogger.warn("Writing to a non aligned halfword address");
 | 
			
		||||
 | 
			
		||||
    memory->write(address, halfword & 0xFF);
 | 
			
		||||
    memory->write(address + 1, halfword >> 8 & 0xFF);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t
 | 
			
		||||
Bus::read_word(size_t address) {
 | 
			
		||||
    return memory->read_word(address);
 | 
			
		||||
    if (address & 0b11)
 | 
			
		||||
        glogger.warn("Reading a non aligned word address");
 | 
			
		||||
 | 
			
		||||
    return memory->read(address) | memory->read(address + 1) << 8 |
 | 
			
		||||
           memory->read(address + 2) << 16 | memory->read(address + 3) << 24;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Bus::write_word(size_t address, uint32_t word) {
 | 
			
		||||
    memory->write_word(address, word);
 | 
			
		||||
    if (address & 0b11)
 | 
			
		||||
        glogger.warn("Writing to a non aligned word address");
 | 
			
		||||
 | 
			
		||||
    memory->write(address, word & 0xFF);
 | 
			
		||||
    memory->write(address + 1, word >> 8 & 0xFF);
 | 
			
		||||
    memory->write(address + 2, word >> 16 & 0xFF);
 | 
			
		||||
    memory->write(address + 3, word >> 24 & 0xFF);
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -89,43 +89,6 @@ Memory::write(size_t address, uint8_t byte) {
 | 
			
		||||
 | 
			
		||||
#undef MATCHES
 | 
			
		||||
 | 
			
		||||
uint16_t
 | 
			
		||||
Memory::read_halfword(size_t address) const {
 | 
			
		||||
    if (address & 0b01)
 | 
			
		||||
        glogger.warn("Reading a non aligned halfword address");
 | 
			
		||||
 | 
			
		||||
    return read(address) | read(address + 1) << 8;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Memory::write_halfword(size_t address, uint16_t halfword) {
 | 
			
		||||
    if (address & 0b01)
 | 
			
		||||
        glogger.warn("Writing to a non aligned halfword address");
 | 
			
		||||
 | 
			
		||||
    write(address, halfword & 0xFF);
 | 
			
		||||
    write(address + 1, halfword >> 8 & 0xFF);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t
 | 
			
		||||
Memory::read_word(size_t address) const {
 | 
			
		||||
    if (address & 0b11)
 | 
			
		||||
        glogger.warn("Reading a non aligned word address");
 | 
			
		||||
 | 
			
		||||
    return read(address) | read(address + 1) << 8 | read(address + 2) << 16 |
 | 
			
		||||
           read(address + 3) << 24;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Memory::write_word(size_t address, uint32_t word) {
 | 
			
		||||
    if (address & 0b11)
 | 
			
		||||
        glogger.warn("Writing to a non aligned word address");
 | 
			
		||||
 | 
			
		||||
    write(address, word & 0xFF);
 | 
			
		||||
    write(address + 1, word >> 8 & 0xFF);
 | 
			
		||||
    write(address + 2, word >> 16 & 0xFF);
 | 
			
		||||
    write(address + 3, word >> 24 & 0xFF);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
Memory::parse_header() {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user