Some area improvements

This commit is contained in:
Clifford Wolf 2016-04-13 12:27:00 +02:00
parent 435232eb85
commit 49aef71641
1 changed files with 6 additions and 5 deletions

View File

@ -420,6 +420,11 @@ module picorv32 #(
end end
always @(posedge clk) begin always @(posedge clk) begin
if (mem_la_read || mem_la_write) begin
mem_addr <= mem_la_addr;
mem_wdata <= mem_la_wdata;
mem_wstrb <= mem_la_wstrb & {4{mem_la_write}};
end
if (!resetn) begin if (!resetn) begin
mem_state <= 0; mem_state <= 0;
mem_valid <= 0; mem_valid <= 0;
@ -427,9 +432,6 @@ module picorv32 #(
prefetched_high_word <= 0; prefetched_high_word <= 0;
end else case (mem_state) end else case (mem_state)
0: begin 0: begin
mem_addr <= mem_la_addr;
mem_wdata <= mem_la_wdata;
mem_wstrb <= mem_la_wstrb & {4{mem_la_write}};
if (mem_do_prefetch || mem_do_rinst) begin if (mem_do_prefetch || mem_do_rinst) begin
current_insn_addr <= next_pc; current_insn_addr <= next_pc;
end end
@ -449,14 +451,13 @@ module picorv32 #(
if (mem_xfer) begin if (mem_xfer) begin
if (COMPRESSED_ISA && mem_la_read) begin if (COMPRESSED_ISA && mem_la_read) begin
mem_valid <= 1; mem_valid <= 1;
mem_addr <= mem_la_addr;
mem_la_secondword <= 1; mem_la_secondword <= 1;
if (!mem_la_use_prefetched_high_word) if (!mem_la_use_prefetched_high_word)
mem_16bit_buffer <= mem_rdata[31:16]; mem_16bit_buffer <= mem_rdata[31:16];
end else begin end else begin
mem_valid <= 0; mem_valid <= 0;
mem_la_secondword <= 0; mem_la_secondword <= 0;
if (!mem_do_rdata) begin if (COMPRESSED_ISA && !mem_do_rdata) begin
if (~&mem_rdata[1:0] || mem_la_secondword) begin if (~&mem_rdata[1:0] || mem_la_secondword) begin
mem_16bit_buffer <= mem_rdata[31:16]; mem_16bit_buffer <= mem_rdata[31:16];
prefetched_high_word <= 1; prefetched_high_word <= 1;