-
Notifications
You must be signed in to change notification settings - Fork 5
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
fifo first implementation #776
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
`include "macros.vh" | ||
|
||
module PS2_cntrl { | ||
input logic data; | ||
input logic clk; | ||
input logic rst; | ||
input logic output_enable; | ||
output logic [7:0] paral_data; | ||
output logic serial_output; | ||
} | ||
|
||
logic [10:0] curr_data; | ||
logic [10:0] next_reg; | ||
assign next_reg = {curr_data [9:0],data}; | ||
|
||
MAFIA_ASYNC_RST_VAL_DFF(curr_data,next_reg,clk,output_enable,rst,0); | ||
|
||
logic [3:0] clk_counter = 0; | ||
|
||
always_ff @( Posedge clk or negedege rst ) begin | ||
if(!rst)begin | ||
counter <=0; | ||
end | ||
else begin | ||
counter ++ | ||
if(counter == 12) | ||
counter <= 1; | ||
end | ||
end | ||
|
||
|
||
|
||
if(counter == 11 && curr_data[0]) begin | ||
MAFIA_DFF(paral_data,curr_data[3:9],clk) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
`ifndef SC_CORE_PKG_SV | ||
`define SC_CORE_PKG_SV | ||
package sc_core_train_pkg; | ||
|
||
`include "common_pkg.vh" | ||
|
||
typedef enum logic [3:0]{ | ||
ADD = 4'b0000; | ||
SUB = 4'b0001; | ||
SLL = 4'b0010; | ||
SLT = 4'b0011; | ||
SLTU = 4'b0100; | ||
XOR = 4'b0101; | ||
SRL = 4'b0110; | ||
SRA = 4'b0111; | ||
OR = 4'b1000; | ||
AND = 4'b1001; | ||
IN_2 = 4'b1010; | ||
}t_alu_op_train; | ||
|
||
typedef enum logic [2:0]{ | ||
BEQ = 3'b000; | ||
BNE = 3'b001; | ||
BLT = 3'b010; | ||
BGE = 3'b011; | ||
BLTU = 3'b100; | ||
BGEU = 3'b101; | ||
}t_branch_type_train; | ||
|
||
typedef enum logic [6:0]{ | ||
LUI = 7'b0110111; | ||
AUIPC = 7'b0010111; | ||
JAL = 7'b1101111; | ||
JALR = 7'b1100111; | ||
BRANCH = 7'b1100011; | ||
LOAD = 7'b0000011; | ||
STORE = 7'b0100011; | ||
I_TYPE = 7'0010011; | ||
R_TYPE = 7'0110011; | ||
FENCE = 7'0001111; | ||
SYSCALL = 7'1110011; | ||
}t_opcode_train; | ||
|
||
typedef enum logic [2:0]{ | ||
R_TYPE = 3'b000; | ||
I_TYPE = 3'b001; | ||
S_TYPE = 3'b010; | ||
B_TYPE = 3'b011; | ||
U_TYPE = 3'b100; | ||
J_TYPE = 3'b101; | ||
}t_inst_type_train; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use macros instead of
always_ff
try to reverse the order and make MSB first
MAFIA_DFF(paral_data,curr_data[3:9],clk)
have you tried to compile it?did it work?