forked from ingaramop/MIPS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFF_Buf_Interface.v
More file actions
66 lines (61 loc) · 1.16 KB
/
FF_Buf_Interface.v
File metadata and controls
66 lines (61 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:49:28 10/30/2013
// Design Name:
// Module Name: FF_Buf_Interface
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module FF_Buf_Interface(
input clock,
input reset,
input clr_flag, //Limpia
input set_flag, //Setea
input [7:0] din, //Datain
output flag,
output [7:0] dout //Dataout
);
//Declaracion de seales
reg [7:0] buf_reg,buf_next;
reg flag_reg,flag_next;
//Main
always @(posedge clock)
if(reset)
begin
buf_reg <= 0;
flag_reg <= 1'b0;
end
else
begin
buf_reg <= buf_next;
flag_reg <= flag_next;
end
//Siguiente estado
always @*
begin
buf_next = buf_reg;
flag_next = flag_reg;
if(set_flag)
begin
buf_next = din;
flag_next = 1'b1;
end
else if(clr_flag)
flag_next = 1'b0;
end
//Logica de salida
assign dout= buf_reg;
assign flag= flag_reg;
endmodule