1 |
12 |
bsa |
/*******************************************************************************************/
|
2 |
|
|
/** **/
|
3 |
|
|
/** ORIGINAL COPYRIGHT (C) 2011, SYSTEMYDE INTERNATIONAL CORPORATION, ALL RIGHTS RESERVED **/
|
4 |
|
|
/** COPYRIGHT (C) 2012, SERGEY BELYASHOV **/
|
5 |
|
|
/** **/
|
6 |
|
|
/** alu shifter module Rev 0.0 06/13/2012 **/
|
7 |
|
|
/** **/
|
8 |
|
|
/*******************************************************************************************/
|
9 |
|
|
module alu_shft (shft_c, shft_out, alub_in, aluop_reg, carry_bit);
|
10 |
|
|
|
11 |
|
|
input carry_bit; /* carry flag input */
|
12 |
|
|
input [7:0] alub_in; /* alu b input */
|
13 |
|
|
input [`AOP_IDX:0] aluop_reg; /* alu operation control subset */
|
14 |
|
|
output shft_c; /* alu shifter carry output */
|
15 |
|
|
output [7:0] shft_out; /* alu shifter output */
|
16 |
|
|
|
17 |
|
|
/*****************************************************************************************/
|
18 |
|
|
/* */
|
19 |
|
|
/* signal declarations */
|
20 |
|
|
/* */
|
21 |
|
|
/*****************************************************************************************/
|
22 |
|
|
reg shft_c; /* shifter carry output */
|
23 |
|
|
reg [7:0] shft_out; /* shifter output */
|
24 |
|
|
|
25 |
|
|
/*****************************************************************************************/
|
26 |
|
|
/* */
|
27 |
|
|
/* alu shifter function */
|
28 |
|
|
/* */
|
29 |
|
|
/*****************************************************************************************/
|
30 |
|
|
always @ (aluop_reg or alub_in) begin
|
31 |
|
|
casex (aluop_reg) //synopsys parallel_case
|
32 |
|
|
`AOP_RL,
|
33 |
|
|
`AOP_RLA: shft_c = alub_in[7];
|
34 |
|
|
`AOP_RLC,
|
35 |
|
|
`AOP_RLCA: shft_c = alub_in[7];
|
36 |
|
|
`AOP_RR,
|
37 |
|
|
`AOP_RRA: shft_c = alub_in[0];
|
38 |
|
|
`AOP_RRC,
|
39 |
|
|
`AOP_RRCA: shft_c = alub_in[0];
|
40 |
|
|
`AOP_SLL,
|
41 |
|
|
`AOP_SLA: shft_c = alub_in[7];
|
42 |
|
|
`AOP_SRA: shft_c = alub_in[0];
|
43 |
|
|
`AOP_SRL: shft_c = alub_in[0];
|
44 |
|
|
default: shft_c = 1'b0;
|
45 |
|
|
endcase
|
46 |
|
|
end
|
47 |
|
|
|
48 |
|
|
always @ (aluop_reg or alub_in or carry_bit) begin
|
49 |
|
|
casex (aluop_reg) //synopsys parallel_case
|
50 |
|
|
`AOP_RL,
|
51 |
|
|
`AOP_RLA: shft_out = {alub_in[6:0], carry_bit};
|
52 |
|
|
`AOP_RLC,
|
53 |
|
|
`AOP_RLCA: shft_out = {alub_in[6:0], alub_in[7]};
|
54 |
|
|
`AOP_RR,
|
55 |
|
|
`AOP_RRA: shft_out = {carry_bit, alub_in[7:1]};
|
56 |
|
|
`AOP_RRC,
|
57 |
|
|
`AOP_RRCA: shft_out = {alub_in[0], alub_in[7:1]};
|
58 |
|
|
`AOP_SLA: shft_out = {alub_in[6:0], 1'b0};
|
59 |
|
|
`AOP_SLL: shft_out = {alub_in[6:0], 1'b1};
|
60 |
|
|
`AOP_SRA: shft_out = {alub_in[7], alub_in[7:1]};
|
61 |
|
|
`AOP_SRL: shft_out = {1'b0, alub_in[7:1]};
|
62 |
|
|
default: shft_out = 8'h00;
|
63 |
|
|
endcase
|
64 |
|
|
end
|
65 |
|
|
|
66 |
|
|
endmodule
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
|