/* * brlsft16.sfl --- 16-Bit Barrel Shifter */ module brlsft16 { input shift; input right; input sign; input a<16>, b<4>; output y<16>; instrin enable; instrself n0, n1, n2, n3; instrself sr0, sr1, sr2, sr3; instrself sl0, sl1, sl2, sl3; instrself rr0, rr1, rr2, rr3; instrself rl0, rl1, rl2, rl3; tmp t0<16>, t1<16>, t2<16>; tmp s; instruct enable par { s = a<15> & sign; alt { shift: alt { right: par { alt { b<3>: sr3(); else: n3(); } alt { b<2>: sr2(); else: n2(); } alt { b<1>: sr1(); else: n1(); } alt { b<0>: sr0(); else: n0(); } } else: par { alt { b<3>: sl3(); else: n3(); } alt { b<2>: sl2(); else: n2(); } alt { b<1>: sl1(); else: n1(); } alt { b<0>: sl0(); else: n0(); } } } else: alt { right: par { alt { b<3>: rr3(); else: n3(); } alt { b<2>: rr2(); else: n2(); } alt { b<1>: rr1(); else: n1(); } alt { b<0>: rr0(); else: n0(); } } else: par { alt { b<3>: rl3(); else: n3(); } alt { b<2>: rl2(); else: n2(); } alt { b<1>: rl1(); else: n1(); } alt { b<0>: rl0(); else: n0(); } } } } } instruct n3 y = t2; instruct n2 t2 = t1; instruct n1 t1 = t0; instruct n0 t0 = a; instruct sr3 y = s || s || s || s || s || s || s || s || t2<15:8>; instruct sr2 t2 = s || s || s || s || t1<15:4>; instruct sr1 t1 = s || s || t0<15:2>; instruct sr0 t0 = s || a<15:1>; instruct sl3 y = t2< 7:0> || 0b00000000; instruct sl2 t2 = t1<11:0> || 0b0000; instruct sl1 t1 = t0<13:0> || 0b00; instruct sl0 t0 = a<14:0> || 0b0; instruct rr3 y = t2<7:0> || t2<15:8>; instruct rr2 t2 = t1<3:0> || t1<15:4>; instruct rr1 t1 = t0<1:0> || t0<15:2>; instruct rr0 t0 = a<0:0> || a<15:1>; instruct rl3 y = t2< 7:0> || t2<15: 8>; instruct rl2 t2 = t1<11:0> || t1<15:12>; instruct rl1 t1 = t0<13:0> || t0<15:14>; instruct rl0 t0 = a<14:0> || a<15:15>; } /* brlsft16 */