Skip to content

Commit

Permalink
Saving some gates by making registers write only.
Browse files Browse the repository at this point in the history
  • Loading branch information
GideonZ committed Sep 10, 2021
1 parent 0fbc1fe commit a904294
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 5 additions & 5 deletions fpga/io/acia/vhdl_source/acia6551.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ begin
io_resp_regs.data(2) <= appl_tx_irq;
io_resp_regs.data(3) <= control_change;
io_resp_regs.data(4) <= dtr_change;
when c_reg_slot_base =>
io_resp_regs.data(6 downto 0) <= std_logic_vector(slot_base);
io_resp_regs.data(7) <= nmi_selected;
when c_reg_rx_rate =>
io_resp_regs.data <= std_logic_vector(rx_rate);
-- when c_reg_slot_base =>
-- io_resp_regs.data(6 downto 0) <= std_logic_vector(slot_base);
-- io_resp_regs.data(7) <= nmi_selected;
-- when c_reg_rx_rate =>
-- io_resp_regs.data <= std_logic_vector(rx_rate);
when others =>
null;
end case;
Expand Down
8 changes: 6 additions & 2 deletions software/io/acia/acia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Acia :: Acia(uint32_t base)
rx_ram = (volatile uint8_t *)(base + ACIA_RX_RAM_OFFSET);

regs->slot_base = 0;
slot_base = 0;
regs->enable = 0;
controlQueue = NULL;
dataQueue = NULL;
Expand Down Expand Up @@ -45,6 +46,8 @@ int Acia :: init(uint16_t base, bool useNMI, QueueHandle_t controlQueue, QueueHa
}
// regs->enable = 0;
regs->slot_base = (uint8_t)base;
slot_base = (uint8_t)base;

printf("ACIA: Wrote %b to the base register.\n", (uint8_t)base);

this->controlQueue = controlQueue;
Expand Down Expand Up @@ -199,14 +202,15 @@ void Acia :: AdvanceRx(int adv)

void Acia :: SetRxRate(uint8_t value)
{
// Warning: Write only register
regs->rx_rate = value;
}

void Acia :: GetHwMapping(uint8_t& enabled, uint16_t& address, uint8_t& nmi)
{
enabled = regs->enable;
address = (uint16_t(regs->slot_base & 0x7F) << 2) + 0xDE00;
nmi = regs->slot_base >> 7;
address = (uint16_t(slot_base & 0x7F) << 2) + 0xDE00;
nmi = slot_base >> 7;
}

// Global Static
Expand Down
2 changes: 2 additions & 0 deletions software/io/acia/acia.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class Acia
QueueHandle_t controlQueue;
QueueHandle_t dataQueue;
DataBuffer *buffer;
uint8_t slot_base; // copy of HW register, as register is now write only

static void TaskStart(void *a);
void Task();
public:
Expand Down

0 comments on commit a904294

Please sign in to comment.