forked from C-L-G/public_atom_modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflooring.v
36 lines (28 loc) · 949 Bytes
/
flooring.v
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
/**********************************************
______________ ______________
______________ \ /\ /|\ /| ______________
______________ \/ \/ | \/ | ______________
descript:
author : Young
Version: VERA.0.0
creaded: 2015/7/23 13:56:28
madified:2015/10/30 10:56:34
***********************************************/
`timescale 1ns/1ps
module flooring #(
parameter DSIZE = 16,
parameter CSIZE = 4, //must smaller than DSIZE
parameter OSIZE = 8, //must not bigger than DSIZE-CSIZE
parameter SEQUENTIAL = "TRUE"
)(
input clock ,
input [DSIZE-1:0] indata ,
output[OSIZE-1:0] outdata
);
reg [OSIZE-1:0] result;
wire[OSIZE-1:0] cm_result;
assign cm_result = (indata[DSIZE-1-:CSIZE] == {CSIZE{1'b0}})? indata[DSIZE-1-CSIZE-:OSIZE] : {OSIZE{1'b1}};
always@(posedge clock)
result <= cm_result;
assign outdata = (SEQUENTIAL == "TRUE")? result : (SEQUENTIAL == "FALSE")? cm_result : {OSIZE{1'b0}};
endmodule