Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ifu cache update #769

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open

Ifu cache update #769

wants to merge 40 commits into from

Conversation

abdkeb
Copy link
Collaborator

@abdkeb abdkeb commented Dec 22, 2024

change the the design of the cache,
using now always_comb blocks instead,
defined new interface with cpu,
interface with prefetecher should be added latre

@abdkeb abdkeb requested a review from roman012285 December 22, 2024 13:00
@abdkeb abdkeb linked an issue Dec 22, 2024 that may be closed by this pull request
7 tasks
Copy link
Collaborator

@amichai-bd amichai-bd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start

import ifu_pkg::*;

#(
parameter NUM_TAGS, // Number of tags
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameters that we don't expect to override in the instance could and should be part of the ifu package

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as amichai said, Please move the parameters into ifu_package. Its not an error its a preferred coding style in mafia

///////////////
// Utilities //
///////////////
task updatePLruTree(inout logic [NUM_LINES - 2 : 0 ] tree , input int line );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not code that is RTL compatible..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use a function instead or macros if possible. as Amichai posted. Tasks can be synthesizable if you write synthesizable code inside them. Task may work but lets not use them for proper coding style

endtask


function int getPLRUIndex(logic [NUM_LINES - 2 : 0 ] tree);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be compatible with RTL, but I do not recommend..
Macros or module are better options

if (freeLine == -1)begin
freeLine = getPLRUIndex(plruTree);
end
dataArray[freeLine] = mem_rspInsLineIn;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the Code seems like there are lots of latches that are not intended..
You should have explicit DFF for the arrays.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid latches, give some default value at the beginning of the always block (let me know if I was clear). Additionally, if you use always_comb with inferred latches Quartus will give you an error

Copy link
Collaborator

@amichai-bd amichai-bd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to have a different file for each module.
Also make sure module name and file name match!

///////////////////
// Internal Modules
///////////////////

module updatePLruTree (
module updatePLruTree
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have 2 modules in the same file.

Each file one module, and the name of the module and the file must match

Copy link
Collaborator

@roman012285 roman012285 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good progress

if (freeLine == -1)begin
freeLine = getPLRUIndex(plruTree);
end
dataArray[freeLine] = mem_rspInsLineIn;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid latches, give some default value at the beginning of the always block (let me know if I was clear). Additionally, if you use always_comb with inferred latches Quartus will give you an error

///////////////
// Utilities //
///////////////
task updatePLruTree(inout logic [NUM_LINES - 2 : 0 ] tree , input int line );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use a function instead or macros if possible. as Amichai posted. Tasks can be synthesizable if you write synthesizable code inside them. Task may work but lets not use them for proper coding style

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to put all the parameters in the right package. If you use additional parameters for the test bench that are not in the package, then add them here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you have been talking about. It's better to separate and put each module into different files.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out simulator does not support assertion. you don't have to use assertion. If you want we have a special macro inside macros.vh that imitates that but its not necessary to use it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good the best way to evaluate it is to see it will work or not and how. good job

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not necessary to declare parameter al logic. when you declare something as logic, it can be 0,1,x, Z. Its not wrong but for consistent coding style its better not to use logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design of IFU unit
5 participants