mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 13:27:29 -04:00
Parameterization working
This commit is contained in:
parent
05a79bd51d
commit
cb1bf65017
2 changed files with 33 additions and 15 deletions
23
rtl/cache/VX_d_cache.v
vendored
23
rtl/cache/VX_d_cache.v
vendored
|
@ -169,17 +169,18 @@ module VX_d_cache
|
|||
|
||||
|
||||
wire[`DCACHE_BANKS - 1 : 0] detect_bank_miss;
|
||||
assign threads_serviced_Qual = threads_serviced_per_bank[0] | threads_serviced_per_bank[1] |
|
||||
threads_serviced_per_bank[2] | threads_serviced_per_bank[3] |
|
||||
threads_serviced_per_bank[4] | threads_serviced_per_bank[5] |
|
||||
threads_serviced_per_bank[6] | threads_serviced_per_bank[7];
|
||||
// genvar bbid;
|
||||
// always @(*) begin
|
||||
// for (bbid = 0; bbid < NUMBER_BANKS; bbid=bbid+1)
|
||||
// begin
|
||||
// assign threads_serviced_Qual = threads_serviced_Qual | threads_serviced_per_bank[bbid];
|
||||
// end
|
||||
// end
|
||||
//assign threads_serviced_Qual = threads_serviced_per_bank[0] | threads_serviced_per_bank[1] |
|
||||
// threads_serviced_per_bank[2] | threads_serviced_per_bank[3] |
|
||||
// threads_serviced_per_bank[4] | threads_serviced_per_bank[5] |
|
||||
// threads_serviced_per_bank[6] | threads_serviced_per_bank[7];
|
||||
integer bbid;
|
||||
always @(*) begin
|
||||
threads_serviced_Qual = 0;
|
||||
for (bbid = 0; bbid < `DCACHE_BANKS; bbid=bbid+1)
|
||||
begin
|
||||
threads_serviced_Qual = threads_serviced_Qual | threads_serviced_per_bank[bbid];
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <../simulate/ram.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "svdpi.h"
|
||||
|
||||
#include "../simulate/VX_define.h"
|
||||
|
@ -27,11 +28,22 @@ unsigned refill_addr;
|
|||
unsigned num_cycles;
|
||||
|
||||
unsigned getIndex(int, int, int);
|
||||
unsigned calculate_bits_per_bank_num(int);
|
||||
|
||||
unsigned getIndex(int r, int c, int numCols)
|
||||
{
|
||||
return (r * numCols) + c;
|
||||
}
|
||||
|
||||
unsigned calculate_bits_per_bank_num(int num)
|
||||
{
|
||||
int shifted_num = 0;
|
||||
for(int i = 0; i < num; i++){
|
||||
shifted_num = (shifted_num << 1)| 1 ;
|
||||
}
|
||||
return shifted_num;
|
||||
}
|
||||
|
||||
|
||||
void load_file(char * filename)
|
||||
{
|
||||
|
@ -69,6 +81,7 @@ void ibus_driver(bool clk, unsigned pc_addr, unsigned * instruction)
|
|||
|
||||
}
|
||||
|
||||
|
||||
void dbus_driver(bool clk, unsigned o_m_read_addr, unsigned o_m_evict_addr, bool o_m_valid, svLogicVecVal * o_m_writedata, bool o_m_read_or_write, svLogicVecVal * i_m_readdata, bool * i_m_ready)
|
||||
{
|
||||
|
||||
|
@ -116,8 +129,10 @@ void dbus_driver(bool clk, unsigned o_m_read_addr, unsigned o_m_evict_addr, bool
|
|||
|
||||
|
||||
unsigned addr_without_byte = new_addr >> 2;
|
||||
unsigned bank_num = addr_without_byte & 0x7;
|
||||
unsigned addr_wihtout_bank = addr_without_byte >> 3;
|
||||
unsigned bits_per_bank = (int)log2(CACHE_NUM_BANKS);
|
||||
unsigned maskbits_per_bank = calculate_bits_per_bank_num(bits_per_bank);
|
||||
unsigned bank_num = addr_without_byte & maskbits_per_bank;
|
||||
unsigned addr_wihtout_bank = addr_without_byte >> bits_per_bank;
|
||||
unsigned offset_num = addr_wihtout_bank & 0x3;
|
||||
|
||||
unsigned value;
|
||||
|
@ -149,8 +164,10 @@ void dbus_driver(bool clk, unsigned o_m_read_addr, unsigned o_m_evict_addr, bool
|
|||
|
||||
|
||||
unsigned addr_without_byte = new_addr >> 2;
|
||||
unsigned bank_num = addr_without_byte & 0x7;
|
||||
unsigned addr_wihtout_bank = addr_without_byte >> 3;
|
||||
unsigned bits_per_bank = (int)log2(CACHE_NUM_BANKS);
|
||||
unsigned maskbits_per_bank = calculate_bits_per_bank_num(bits_per_bank);
|
||||
unsigned bank_num = addr_without_byte & maskbits_per_bank;
|
||||
unsigned addr_wihtout_bank = addr_without_byte >> bits_per_bank;
|
||||
unsigned offset_num = addr_wihtout_bank & 0x3;
|
||||
unsigned index = getIndex(bank_num,offset_num, CACHE_WORDS_PER_BLOCK);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue